This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # I currently have the following aliases on mac osx, that I use to allow a bunch of different port forwarding through ssh | |
| # the 10.0.2.16 alias appears to work fine without the route add -host call for it | |
| # but the 10.0.2.18 alias doesn't. | |
| # test (order important?) | |
| # test (more than 2?) | |
| # look at netstat -nr to see routes | |
| alias aliasip='sudo ifconfig en1 alias 10.0.2.16 255.255.255.0; sudo ifconfig en1 alias 10.0.2.18 255.255.255.0; sudo route add -host 10.0.2.18 -interface 127.0.0.1' | |
| alias unaliasip='sudo ifconfig en1 -alias 10.0.2.16; sudo route delete -host 10.0.2.18 -interface 127.0.0.1; sudo ifconfig en1 -alias 10.0.2.18' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # if you are dropping packets using iptables, you can use a couple commands to log those blocked packets | |
| # for example, to log & block all traffic incoming to 172.25.0.1, you could use the following: | |
| iptables -A INPUT -p tcp -d 172.25.0.1 -j LOG --log-prefix "blocked 172.25.0.1 :" | |
| iptables -A INPUT -p tcp -d 172.25.0.1 -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # generally speaking if you run ssh -X <remotehost> | |
| # you'll be able to run X applications on the remote host, displaying them on your machine | |
| # if you need to run them as a different user, there are a couple things you need to setup as the new user | |
| # after su'ing to the new user, you need to: | |
| # (note that the .Xauthority file must be readable by the su'd to user -- or else you need to copy the file somewhere it is readable) | |
| # export XAUTHORITY=/home/[the original user]/.Xauthority | |
| # export DISPLAY=(whatever the DISPLAY property was before you su'd -- probably localhost:10.0) | |
| # the .Xauthority file needs to be readable by the new user as well (when I've done it, I've just copied ~/.Xauthority to /tmp or something for a bit -- of course this means anyone can display on your screen who sees that file -- so caution is a good thing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //this method should mostly set up a java app to act as a jconsole server, with static ports so you can configure forwarding through a firewall or over a vpn | |
| public static void setupJConsole(MBeanServer mbs, String hostname, Integer port1, Integer port2) { | |
| // from http://download.oracle.com/javase/6/docs/technotes/guides/management/agent.html#gdfvv | |
| // note you need to set the following startup parameters: | |
| // -Dcom.sun.management.jmxremote.authenticate=true | |
| // -Dcom.sun.management.jmxremote.ssl=false | |
| // and this one, if you don't want the rmi server to tell people to connect to the default ip (as is the case if using a vpn ip) | |
| // -Djava.rmi.server.hostname=vpnhostip | |
| // Ensure cryptographically strong random number generator used | |
| // to choose the object number - see java.rmi.server.ObjID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| make sure the following lines are set in /etc/sshd_config (or /etc/ssh/sshd_config on ubuntu) | |
| (they all exist already, but are commented, some may have a value of yes) | |
| PasswordAuthentication no | |
| ChallengeResponseAuthentication no | |
| UsePAM no | |
| then restart the ssh server (uncheck / recheck 'Remote Login' in the 'System Preferences' -> 'Sharing' panel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <root> | |
| <item> | |
| <name>Kems custom keybindings</name> | |
| <list> | |
| <item> | |
| <name>Fix broken keyboard</name> | |
| <list> | |
| <item> | |
| <name>Remap broken keys</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config --global user.name “My Name” (put in your name) | |
| git config --global user.email “[email protected]” (put in your email address) | |
| git config --global branch.autosetuprebase always | |
| git config --global core.excludesfile ~/.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| you can pipe stuff through ssh -- e.g., concatenate your SSH key on another host. | |
| cat ~/.ssh/id_dsa.pub | ssh me@remotebox "cat >> ~/.ssh/authorized_keys" | |
| lsof - http://danielmiessler.com/study/lsof/ | |
| disown (detach from process so when close your terminal it doesn't get killed -- like doing nohup in advance) | |
| xargs / parallel | |
| sudo !! -- repeat last command with sudo prepended | |
| !$ -- last argument to last command | |
| !* -- all arguments to last command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #create file containing something like below -- in /etc/apache2/sites/localweb.conf | |
| # (you may need to create the /etc/apache2/sites directory) | |
| <VirtualHost 127.0.0.1:80> | |
| ServerName www.localweb.com | |
| ServerAlias *.localweb.com | |
| DocumentRoot "/Users/kem/src/localweb" | |
| <Directory "/Users/kem/src/localweb"> | |
| Options Indexes FollowSymLinks MultiViews | |
| AllowOverride None | |
| Order allow,deny |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from: http://macw.us/sek9nV | |
| (for more information on creating launch daemons / agents, go to http://j.mp/uYtpsJ ) | |
| create a file in ~/Library/LaunchAgents | |
| named something like: | |
| com.yourdomain.smb_server.domain_announce.plist | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> |