Skip to content

Instantly share code, notes, and snippets.

# set -e
# if set -e was actually set, the first time the -f command
# returns non-zero, the entire program would exit with the return code
# from the ssh command. DO NOT WANT
while true
do
retval=`ssh user@some.server.com "ls -1 $src_dir/nz_${DOMAIN}_done.flag 2>/dev/null|wc -l"`
if [[ $retval -eq 0 ]]
then
@MarkRoddy
MarkRoddy / gist:2782429
Created May 24, 2012 16:03
Bash - Command Sub
Command Substitution
Command substitution allows the output of a command to replace the command name. There are two forms:
$(command)
or
`command
Bash performs the expansion by executing command
$(cat file) can be replaced by the equivalent but faster $(< file).
@MarkRoddy
MarkRoddy / gist:3158017
Created July 22, 2012 02:42
Error when running knife bootstrap using ubuntu12.04-gems.erb
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/lib/chef/json_compat.rb
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/lib/chef/knife.rb
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/lib/chef/version_class.rb
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/lib/chef.rb
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/bin/chef-client
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/bin/chef-solo
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/bin/knife
^[[36m192.168.1.5^[[0m /var/lib/gems/1.8/gems/chef-0.10.8/bin/shef
^[[36m192.168.1.5^[[0m /usr/local/bin/chef-client
^[[36m192.168.1.5^[[0m /usr/local/bin/chef-solo
@MarkRoddy
MarkRoddy / gist:3746388
Created September 18, 2012 22:31
Repos with uncommitted changes
for d in `find -type d -name '.git'`; do pushd $d/.. > /dev/null; if [ 0 -ne `git st --short|wc -l` ]; then echo "Need to commit $d"; fi; popd > /dev/null; done
High-Memory Instances
Instances of this family offer large memory sizes for high throughput applications, including database and memory caching applications.
High-Memory Extra Large Instance
17.1 GiB of memory
6.5 EC2 Compute Units (2 virtual cores with 3.25 EC2 Compute Units each)
420 GB of instance storage
64-bit platform
#!/usr/bin/ruby
require 'rubygems'
gem 'chef', ">= 0"
require 'chef/role'
if 1 != ARGV.length then
print "Please specify a role name or path to it's ruby file\n"
exit
end
mroddy@mroddy-local-vm:~/code/mhc/web$ git diff
diff --git a/web/mhc/tests/__init__.py b/web/mhc/tests/__init__.py
index b8b1956..0e1d260 100644
--- a/web/mhc/tests/__init__.py
+++ b/web/mhc/tests/__init__.py
@@ -278,7 +278,7 @@ class TestController(MortarTestCase):
# setup the context object for our tests
self.c = ContextObj()
- self.c.features = feature_flags.get_feature_flags(None, config['feature_flags'])
mroddy@mroddy-local-vm:~$ python somenums.py
range+for_loop time: 16.0733070374
xrange+sum time: 6.43176913261
mroddy@mroddy-local-vm:~$ python sumnums.py
Traceback (most recent call last):
File "sumnums.py", line 19, in <module>
x = sum(xrange(sys.maxint+1, sys.maxint+100000000))
OverflowError: Python int too large to convert to C long
last_segment_per_sessionId = FOREACH gpv_sessionized GENERATE
FLATTEN(group) AS sessionId,
MAX(pv_sessionized.time) AS max_time;