This file contains 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
import cmd | |
from urlparse import urlparse | |
import sys | |
import re | |
import subprocess | |
def write_to_clipboard(output): | |
process = subprocess.Popen( | |
'pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE) | |
process.communicate(output.encode('utf-8')) |
This file contains 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
one_hour_ago := time.Now().AddDate(0, 0, -1).Add(time.Hour * 23) |
This file contains 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
curl 'http://localhost:9200/_all/fluentd/_search?size=1&pretty=true' -XPOST -d '{ | |
"query": { | |
"query_string": { | |
"fields": ["uri"] | |
"query": "entagara-" | |
} | |
} | |
}' |
This file contains 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 works: | |
discount = 50.0 | |
if (!doc["discount"].empty) { | |
discount = doc["discount"].value; | |
} else { | |
discount = 50.0; | |
} | |
// This works: | |
discount = doc["discount"].empty ? 50.0 : doc["discount"].value; |
This file contains 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
for (Reservation reservation : descInstances.getReservations()) { | |
for (Instance instance : reservation.getInstances()) { |
This file contains 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
def has_nested_key?(key, hash) | |
hash = hash.to_hash | |
if has_indeterminate_key?(key, hash) | |
return true | |
end | |
hash.values.each do |v| | |
if v.is_a?(Hash) && has_nested_key?(key, v) | |
return true | |
end |
This file contains 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
publish: | |
@if [ -e "$$HOME/.pypirc" ]; then \ | |
echo "Uploading to Pypi"; \ | |
python setup.py register ; \ | |
python setup.py sdist upload ; \ |
This file contains 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
import re | |
import os | |
from setuptools import setup, find_packages | |
def parse_requirements(): | |
"""Rudimentary parser for the `requirements.txt` file | |
We just want to separate regular packages from links to pass them to the | |
`install_requires` and `dependency_links` params of the `setup()` |
This file contains 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
vagrant plugin install vagrant-chef-zero | |
INFO global: Vagrant version: 1.1.2 | |
INFO manager: Registered plugin: box command | |
INFO manager: Registered plugin: destroy command | |
INFO manager: Registered plugin: halt command | |
INFO manager: Registered plugin: init command | |
INFO manager: Registered plugin: package command | |
INFO manager: Registered plugin: plugin command | |
INFO manager: Registered plugin: provision command | |
INFO manager: Registered plugin: reload command |
This file contains 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
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/testtask.rb:104:in `block (3 levels) in define' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils.rb:82:in `ruby' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `ruby' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/testtask.rb:100:in `block (2 levels) in define' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:58:in `verbose' | |
/usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/rake-10.0.4/lib/rake/testtask.rb:98:in `block in define' |