Skip to content

Instantly share code, notes, and snippets.

View SeanPlusPlus's full-sized avatar

Sean Stephenson SeanPlusPlus

View GitHub Profile
#!/bin/bash
#
# tmuxConnect SessionName FileWithMachineNames
#
# pass a file with a list of machine names as a parameter to this script
# and it will open a new tmux session with a window ssh'd into each host
SESSION=$1
MACHINE_FILE=$2
@SeanPlusPlus
SeanPlusPlus / rest.php
Created June 11, 2011 01:40
PHP restful foo
# URL: http://mysite/?project=foo&category=bar&task=yo
<html>
<body>
<?php
foreach ($_GET as $key => $value) {
echo "key = $key :: value = $value";
echo "<br/>";
}
?>
@SeanPlusPlus
SeanPlusPlus / pyserv
Created June 14, 2011 20:15
super simple python server
python -m SimpleHTTPServer 4020
// Javascript in Ten Minutes
// Breakdown...
// Basic Types
var intValue = 1;
var floatValue = 3.0;
var stringValue = "This is a string\n";
var sqString = 'This is also a string';
@SeanPlusPlus
SeanPlusPlus / White_Space_Before_Caps
Created October 6, 2011 19:47
Add White Space Before Caps
$ cat myOldFile
HelloJesseAndGlen
IHopeThatYouAreChillin
$ irb
>> myNewFile = File.open('myNewFile', 'w')
=> #<File:myNewFile>
>> File.open('myOldFile').each { |line|
?> myNewFile.puts line.scan(/[A-Z][a-z]+/) * " "
>> }
=> #<File:myOldFile>
@SeanPlusPlus
SeanPlusPlus / capParser.rb
Created October 7, 2011 01:32
Cap Parser
#!/usr/bin/ruby
myNewFile = File.open('myNewFile', 'w')
File.open(ARGV[0]).each do |line|
i = 0
line.each_byte do |c|
while i < line.length
if (line[i] =~ /[A-Z]/) and ((line[i-1] =~ /[a-z]/) or (line[i-1] =~ /[,.:;!?]/))
myNewFile.printf " %c", line[i]
else
myNewFile.printf"%c", line[i]
@SeanPlusPlus
SeanPlusPlus / multi_dimensional_hash.rb
Created October 28, 2011 04:22
Multidimensional Ruby Hash
#!/usr/bin/ruby
presidents = {}
presidents["jefferson"] = "3","virginia"
presidents["truman"] = "33","missouri"
presidents["obama"] = "44","hawaii"
presidents.each do |k,v|
surname = k
@SeanPlusPlus
SeanPlusPlus / findReplaceBig.sh
Created January 12, 2012 18:43
Recursively replace string matching regex
grep -ilr "foo" * | xargs -i@ sed -i 's/foo/bar/' @
@SeanPlusPlus
SeanPlusPlus / style.css
Created April 15, 2012 20:50
style for sean++
l/*
Theme Name: Cordobo Green Park 2
Theme URI: http://cordobo.com/green-park-2/
Description: Lightweight fast-rendering theme with 2-3 column layout and right sidebar, Widget-ready (4 slots), built-in support for plugins (e.g. twitter), support for threaded/nested comments, fully localized, easy to customize via settings-page. By <a href="http://cordobo.com">Andreas Jacob</a>.
Version: 0.9.502
Author: Andreas Jacob
Author URI: http://cordobo.com/
Tags: green, white, silver, black, light, two-columns, right-sidebar, fixed-width
<html>
<head>
</head>
<body>
<pre></pre>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script>
var HTML_FILE_URL = 'data.txt';
$(document).ready(function() {