Working Ninja
2018-10-31T20:18:39

Here's a simple shell wrapper that prints all sockets opened by Firefox.

1. Add the following function to your ~/.bashrc:

function ffsocks() {
    netstat -anp --inet | awk '/firefox/ { print $5 }'
}

2. Reload your shell (or run source ~/.bashrc) to make ffsocks callable from your shell environment.

3. Finally, execute ffsocks!

$ ffsocks ...

READ MORE

2016-11-01T16:55:19

Before adding a script to cron and finding that it doesn't work because of a PATH issue, here's a handy command to test:

env -i ./script

This will run your script in the same environment that cron will.

READ MORE

2014-11-11T17:56:26

Get to vhost root:
alias www='cd /var/www/vhosts/'

From domain.name, get to WordPress theme directory:
alias t='cd httpdocs/wp-content/themes/'

Restart Apache gracefully:
alias apachegrace='/etc/init.d/httpd restart graceful'

Directory listing with timestamp, ownership, permissions, etc:
alias ls="ls -l"

READ MORE

2015-10-13T07:38:08

This script will find (including subdirectories) and convert all m4a files to mp3.

find -name "*.m4a" -exec ~/m4atomp3 {} \;

m4atomp3:

#!/bin/bash
m4afile=$@
avconv -i "$m4afile" -ab 320k "${m4afile/.m4a/.mp3}"

Remember to chmod +x m4atomp3.

READ MORE

2016-01-17T12:08:12

Use dmesg after plugging in your USB thumb drive to find the device name (/dev/sdb).

# umount /media/username/devicename
# dd bs=4M if=/path/to/filename.iso of=/dev/sdb

Note, do not output to a partition (e.g. /dev/sdb1). In the past this has created a loop ...

READ MORE

2016-01-17T12:54:16

Error:

The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.

Solution:

# dd if=/dev/zero of=/dev/sdb bs=2048

Source: http://askubuntu.com/questions/675649/unable-to-delete-usb-drive-partitions-block-size-error

READ MORE

2016-03-26T10:26:48

GitLab was throwing me a 500 server error this morning after an upgrade via yum. To troubleshoot, I ran the self diagnose command from terminal:

# gitlab-rake gitlab:check

Which gave me the following error to fix:

All migrations up? ... no
  Try fixing it:
  sudo -u git -H bundle exec rake ...

READ MORE

2016-05-01T11:09:13