Skip to content

Instantly share code, notes, and snippets.

Christopher Sexton csexton

Block or report user

Report or block csexton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@csexton
csexton / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View foo.rb
class Foo
def a_string
"abcdef8"
end
end
View gist:4992036
#!/usr/bin/env ruby
require 'pty'
interface = 'en0'
cmd = %W[tshark -i #{interface} -R http -T fields -e wlan.sa -e http.user_agent]
cmd = "yes"
begin
PTY.spawn( cmd ) do |r, w, pid|
View Compiling
Compile with `gcc -Wall -lssl -lcrypto shait.c`
View Compiling
Compile with `gcc -Wall -lssl -lcrypto shait.c`
View chef_solo_bootstrap.sh
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
@csexton
csexton / kapow.zsh
Created Jun 10, 2011
Zsh function to restart an app running under pow
View kapow.zsh
# Restart a rack app running under pow
# http://pow.cx/
#
# Adds a kapow command that will restart an app
#
# $ kapow myapp
#
# Supports command completion.
#
# If you are not already using completion you might need to enable it with
View gist:515754
class Person
attr_accessor :name, :weight
#want to set a default for @weight in here
#Tried @weight ||= 45 and
# @weight = 45 and
# self.weight = 45
def initialize
@weight = 45
end
end
View gist:381243
def update
params[:server][:network_interfaces].collect!{|x| NetworkInterface.new(x)}
@server = Server.find(params[:id])
respond_to do |format|
if @server.update_attributes(params[:server])
flash[:notice] = 'Server was successfully updated.'
format.html { redirect_to(@server) }
format.xml { head :ok }
else
View menu.mm
- (void)installButtonBeforeItem:(NSString *)beforeItem toToolbar:(NSString *)toolbarIdentifier
{
log_enter();
NSToolbar *toolbar = nil;
for (NSWindow *window in [NSApp orderedWindows]) {
if (NO == [[[window toolbar] identifier] isEqualToString:toolbarIdentifier]) continue;
toolbar = [window toolbar];
if ([toolbar respondsToSelector:@selector(onepasswordSetDelegate:)]) {
[toolbar setDelegate:[toolbar delegate]]; // this will call a swizzled method
You can’t perform that action at this time.