Skip to content

Instantly share code, notes, and snippets.

View combusean's full-sized avatar

Sean Horan combusean

  • San Francisco, CA
View GitHub Profile
[root@ip-172-16-20-13 ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
169.254.255.1 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
172.16.20.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
172.17.0.0 169.254.255.1 255.255.0.0 UG 0 0 0 tun0
0.0.0.0 172.16.20.1 0.0.0.0 UG 0 0 0 eth0
[root@ip-172-17-20-47 ~]# netstat -rn
salt_cmd = if return_code
"salt -t #{SALT_TIMEOUT} -L --out=yaml '#{key}' cmd.retcode 'export HOME=#{@home}; #{cmd} 2>> #{@remote_log}'"
else
"salt -t #{SALT_TIMEOUT} -L --out=yaml '#{key}' cmd.run '#{cmd}'"
end
@combusean
combusean / etc init.d nginx
Last active August 29, 2015 14:00
nginx Red Hat init.d script beta
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon for Red Hat-based distributions
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@combusean
combusean / quiz_1_ops_1
Last active August 29, 2015 14:00
Quiz 1: Ops 1 (ssh, X11, AWS, opsworks, nginx, Linux)
Explain as much as possible what's going on in the following real-world terminal session.
Guidance:
Tell us what Linux distros these might be by what their PS1 is or are based off.
What are the vars in each prompt used to produce it?
In ssh, why did we get an X11 error once and what does -C and -X do?
@combusean
combusean / gist:10341727
Created April 10, 2014 04:06
refactor example
- salt_cmd = "salt -L '#{key}' cmd.retcode 'export HOME=#{@home}; #{cmd} >> #{@local_log}'"
- unless redirect
- salt_cmd = "salt '#{key}' cmd.run '#{cmd}'"
- end
+ salt_cmd = redirect ? "salt -L '#{key}' cmd.retcode 'export HOME=#{@home}; #{cmd} >> #{@local_log}'" : "salt '#{key}' cmd.run '#{cmd}'"
@combusean
combusean / fib.rb
Created December 18, 2013 08:41
Fibonacci sequences in an iterative and recursive manner in Ruby
class Fib
@tracking = [0,1]
def self.iter_compute(index)
tracking = [0,1]
index.times do |i|
tracking << tracking[-2] + tracking[-1]
tracking.shift if tracking.size > 2
end
@combusean
combusean / color_less
Last active October 10, 2015 13:08
Color less instructions on OS X
1) Run
brew install source-highlight
Presuming you are using brew, of course.
2) Create the file /usr/local/share/source-highlight/src-hilite-lesspipe.sh
with the following as its contents
#!/bin/bash