temporary tm - about - notes atom/rss

commands.md

modified .

I keep around a file called commands.md which is a gigantic list of tiny how-tos. Whenever I catch myself spending forever finding the right commands to run, I add to this list.

Here are some of those how-tos that I find myself referencing all the time. (newest first)

Compress pngs

for file in *.png; do pngcrush -ow "$file"; done

Compress gifs

gifsicle -O3 --colors 256 --batch -i *.gif

Setting up swap

Storing 1024 * 1M of swap in /var/swap.1

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo chmod 0600 /var/swap.1
sudo /sbin/mkswap /var/swap.1

Enable:

sudo /sbin/swapon /var/swap.1

Add to /etc/fstab to start swap on boot:

/var/swap.1   swap    swap    defaults        0   0

(from https://stackoverflow.com/a/17173973)

Set a debugger breakpoint before page reload

addEventListener('beforeunload',()=>{debugger})

Patch pip packages from source

e.g. for https://github.com/rkern/line_profiler:

git clone https://github.com/rkern/line_profiler.git
find line_profiler -name '*.pyx' -exec cython {} \;
# do some edits
cd line_profiler && pip install . --user 

Installing AUR package from source (PKGBUILD file)

make sure the base-devel group is installed

sudo pacman -S base-devel

then e.g. for https://aur.archlinux.org/packages/bluez-utils-compat/:

git clone https://aur.archlinux.org/bluez-utils-compat.git
# -s installs build deps, -r uninstalls them after build
makepkg -sr
# -i installs
makepkg -i

other flags you can add to makepkg -sr:

-A   to ignore architecture restriction
-c   to remove build files after a successful build

bash script: cd to where the script is

cd "${0%/*}"

imagemagick change image white to transparency

mogrify -transparent white image.png

with fuzzy matching:

mogrify -transparent white -fuzz 10% image.png

install packages in octave

e.g. to install symbolic:

pkg -forge install symbolic
pkg load symbolic

add to ~/.octaverc to load on startup:

pkg load symbolic
tagged: linux commands.md (permalink) (tweet)
Strategy notes for Chu Shogi the no-JavaScript necronomicon