Mac OSX - Set PATH variable
If you want to edit the PATH variable in Mac OSX, you can edit the /etc/paths file and add your entry. The default version looks like this:/usr/bin/bin/usr/sbin/sbin/usr/local/bin
View ArticleMac OSX - View Apache Errors
To view Apache errors, you have to look at the error log file called error_log. It is either in /var/log/httpd, or /var/log/apache2 depending on your Apache setup. You can see the most recent errors by...
View ArticleFind modules loaded in iptables
To find out what modules are loaded in iptables try:cat /proc/net/ip_tables_matches
View Articleiptables Port Forwarding
If you need to forward one port to another you can type:iptables -t nat -A PREROUTING -i eth0 -p udp --dport SOURCEPORT -j REDIRECT --to-port DESTPORTSo if you wanted to route all traffic from port...
View ArticleBlocking domains with BInd 9 like WebEx
You can block domains with bind 9 by first creating a dummy zone file called "poison" that has no records (copy the following file exactly):@ IN SOA ( ns1.domain.com. hostmaster.domain.com. 1...
View ArticleUbuntu, CentOS ssh hangs when you try to log in
You may encounter a server where ssh hangs when you try to login. Sometimes this error is due to a missing DNS record. You can fix this by editing your /etc/ssh/sshd_config file on the server to have...
View ArticleSSL: View certificate info
I frequently need to do this to verify when a cert expires or who issued it. You can get all the information associated with a cert by typing:openssl x509 -text -in cert.pem
View ArticleUsing screen
Here is a quick how-to for the screen utility found on *nix systems:1. To start a new screen session type 'screen'2. Once inside to open a new window 'ctrl-a c' (create)3. To cycle through the windows...
View ArticleHow to see what a program is calling or files it is using?
Sometimes it is useful to see what system calls a compiled program is making. strace is a great utility to use for this, here is an example:strace -f -s 500 -o /tmp/strace.output dig somedomain.comThe...
View ArticleTunnel X Windows over SSH from a Linux Server to Mac OS X Mountain Lion
First lets setup the Linux Server. You need to add the following two directives to the sshd config, on Ubuntu it is found in /etc/ssh/sshd_config (look at the file first, it might already be in...
View ArticleHow to run processes concurrently or simultaneously on Linux aka Instant DDOS
There may be a time that you want to run a script like "dothis.sh" multiple times concurrently (simultaneously) - the following script runs 5 concurrent instances of...
View ArticleMac OSX - Use your old Airport, Airport Extreme or Time Capsule to extend...
If you have an old Airport, Airport Extreme or Time Capsule and want to use it to extend a wireless network you already have setup (with some other brand wireless router), then you can follow these...
View ArticleHow to run Windows programs (like Internet Explorer) on a Mac
Here is a nice free way to run Windows on a Mac without having to buy VMWare or use WINE.1. First download VirtualBox from Oracle:https://www.virtualbox.org/2. Then open a terminal...
View ArticleCentOS: Add another ip to interface eth0
To add another IP address to interface eth0, create a file /etc/sysconfig/network-scripts/ifcfg-eth0:1and add the following:DEVICE=eth0:1...
View ArticlePostfix: Send from a particular IP address
To make Postfix send from a specified IP address, first make sure the IP address is present on the server and routable (i.e. has right subnet, gateway, and is enabled). Then add the following to...
View ArticleUse grep and regular expressions to find a URL
I spent a lot of time searching through a number of different regular expressions to find a URL in a body of text and finally ended up with this one - make sure you replace somefile.txt with the file...
View ArticleEmacs: Permanently stop creating backup files and auto-save
In case you ever wanted to permanently stop creating backup emacs files (the ones with ~ at the end of the filename) add the following to your .emacs file:(setq backup-inhibited t)and/or disable the...
View ArticleFind the current directory in a bash script
This is a useful one line to find the current directory in a bash script:DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")"&& pwd )"
View ArticleChange gpg key passphrase on Mac OS X
How to change your gpg (private) key passphrase0. If you dont have gpg installed, you can get GPGTools a nifty application suite to manipulate your keys and much more from http://gpgtools.org1. First...
View Articlesshd error: buffer_get_ret: trying to get more bytes 4 than in buffer 0
You try to ssh to a server and the connection is immediately closed.In the logs you see this strange and cryptic error:Oct 29 10:24:24 sbweb03 sshd[30714]: error: buffer_get_ret: trying to get more...
View ArticleMySQL error: Got error 28 from storage engine
If you receive this error "Got error 28 from storage engine" from MySQL, check your disk space on the server. Typically the error is due to a full disk.
View ArticleEnable sar on Ubuntu
System Activity Report (sar) is a utility that lets you measure performance on *nix machines.sar comes in the sysstat package and includes: - sar: collects and reports system activity information;-...
View Articlecheck the number of command line arguments in a bash script
You can add the following to the beginning of your bash script to check for the number of arguments and exit if you don't have the required number, simply modify the EXPECTED_ARGS to the desired number...
View ArticleUsing Chrome with tor on Mac OSX Mavericks
After spending some time using the Tor Bundle that is distributed for Mac OSX, I decided that Firefox just wasn't for me. I prefer Chrome, and was able to get it working with tor on a Mac running...
View ArticleMacbook Air/Pro Thunderbolt Port not working
In case you are using an external monitor and you get a no signal message from your computer. You can reset the ports via the following method:1. Shutdown the computer2. Hold down the...
View Article