Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env sh
term=$1
key=$KEY
search_engine_id=$SEARCH_ENGINE_ID
curl -H 'Content-Type: application/json' \
'https://www.googleapis.com/customsearch/v1?q='$term'&key='$key'&cx='$search_engine_id
@immer
immer / requirements.txt
Last active January 20, 2018 09:47
Python "package" for cosine similarity of two words
altgraph==0.10.2
bdist-mpkg==0.5.0
bonjour-py==0.3
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
nltk==3.2.5
numpy==1.8.0rc1
py2app==0.7.3
pyobjc-core==2.5.1
@immer
immer / bulk-load.jq
Last active September 16, 2017 21:19
#!/usr/bin/env jq
# TODO don't send requests which will generate errors (duplicate create requests)
[{ create: { _index: "rspec", _type: "example", _id: . | @base64 } }, .][]
#!/usr/bin/env jq
# Extract interesting data from rspec's example.metadata
# Using the full_description and description as input,
# split each string and take the intersection of each set.
# Use the result to extract the component under test and body of description.
[[.full_description, .description][] | split(" ")]
| .[0] - .[1]
# Note Subscription#activate and Subscription#cancel would be defined by the state machine gem
# The corresponding routes would be
# /subscriptions/:id/cancel
# /subscriptions/:id/activate
class ActivateSubscriptionController
def update
@subscription = Subscription.find(params[:id])
@memo = []
expander = ->(term){
significant_terms(term).each do |sub_term|
next if memo.include?(sub_term)
@memo << sub_term
expander(sub_term)
end
}
#!/usr/bin/env ruby
# requires Human intercedence ...
answer? = lambda { |question| # code ommitted ... }
ux = lambda { |question| answer?(question) and exit 0 or false }
navigate = lambda { |question, ux| ux question }
loop { navigate ENV.fetch('QUESTION'), ux }
#!/bin/sh
brew_tap 'caskroom/cask'
brew_install_or_upgrade 'brew-cask'
brew cask install google-chrome
brew cask install hipchat
brew cask install slack
brew cask install skype
brew cask install alfred
#!/bin/sh
brew_tap 'caskroom/cask'
brew_install_or_upgrade 'brew-cask'
brew cask install google-chrome
brew cask install hipchat --force
brew cask install skype
brew cask install alfred
brew cask install java
#!/bin/sh
brew_tap 'caskroom/cask'
brew_install_or_upgrade 'brew-cask'
brew cask install google-chrome
brew cask install hipchat
brew cask install slack
brew cask install skype
brew cask install alfred