These are field notes gathered during installation of website search facility for the ElasticSearch website.
You may re-use it to put a similar system in place.
The following assumes:
#!/usr/bin/env ruby -w | |
## Using ruby's standard OptionParser to get subcommand's in command line arguments | |
## Note you cannot do: opt.rb help command | |
## other options are commander, main, GLI, trollop... | |
# run it as | |
# ruby opt.rb --help | |
# ruby opt.rb foo --help | |
# ruby opt.rb foo -q | |
# etc |
class CucumberExternalResqueWorker | |
DEFAULT_STARTUP_TIMEOUT = 1.minute | |
COUNTER_KEY = "cucumber:counter" | |
class << self | |
attr_accessor :pid, :startup_timeout | |
def start | |
# Call from a Cucumber support file so it is run on startup | |
return unless Rails.env.cucumber? |
puts "\033[1;31m=> Loading hacks: #{__FILE__}\033[0m" | |
module BeforeFilterHacks | |
def self.included(base) | |
base.class_eval { alias_method_chain :call, :hacks } | |
end | |
def call_with_hacks(controller, &block) | |
message= if method.kind_of?(Proc) | |
method.to_s |
These are field notes gathered during installation of website search facility for the ElasticSearch website.
You may re-use it to put a similar system in place.
The following assumes:
#!/usr/bin/env macruby | |
# encoding: utf-8 | |
CALENDARS = ['Michal Cichra', 'Calendar'] # Set names of calendars to show | |
before = 3 # days to show before today | |
after = 10 # days to show after today | |
today = 'dnes' |
Relevant Code::: | |
var Course = Backbone.Model.extend({ | |
url : function(){ | |
var base = 'courses' | |
if (this.isNew()) return base; | |
return base + (base.charAt(base.length-1) == '/'?'' : '/') + this.id; | |
} | |
}) |
cd ~ | |
# Install the required JDK | |
sudo apt-get install openjdk-6-jre-headless | |
# Download, extract and move ElasticSearch | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch |
read -s -r -d '' SCRIPT <<"EOF" | |
framework 'ScriptingBridge' | |
rating = ARGV.pop | |
itunes = SBApplication.applicationWithBundleIdentifier("com.apple.itunes") | |
track = itunes.currentTrack | |
track.rating = rating.to_f*20 | |
puts "#{track.artist} - #{track.name} rated #{rating} stars" | |
EOF |
framework "CoreWLAN" | |
iface = CWInterface.interface | |
iface.disassociate | |
wlans = iface.scanForNetworksWithParameters(nil, error: nil) | |
wlan = wlans.find {|w| w.ssid == "WLAN_724A"} | |
p [wlan.bssid, wlan.ssid, wlan.securityMode, wlan.wlanChannel.channelNumber] | |
keys = File.read("./dictionary.txt").lines.to_a.reverse |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |