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
# /etc/init/ruby-example-upstart.conf | |
description "Ruby example upstart conf" | |
# change to the user you want to run this ruby script as | |
setuid deploy | |
setgid deploy | |
# This starts upon bootup and stops on shutdown | |
# check runlevel of running system with `runlevel` 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/bin/env ruby -Ilib | |
require 'pp' | |
require 'oauth2' | |
require 'legato' | |
module OAuth2Helpers | |
def build_client(id, secret) | |
opts = { | |
:authorize_url => 'https://accounts.google.com/o/oauth2/auth', |
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/bin/env ruby | |
$: << 'test' << 'lib' | |
Dir.glob(ARGV).each {|f| load f unless f =~ /^-/} | |
# Usage: ruby_test test/unit/**/*.rb |
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 os; path=sublime.packages_path(); (os.makedirs(path) if not os.path.exists(path) else None); window.run_command('exec', {'cmd': ['git', 'clone', 'https://github.com/titoBouzout/SideBarEnhancements', 'SideBarEnhancements'], 'working_dir': path}) | |
import os; path=sublime.packages_path(); window.run_command('exec', {'cmd': ['git', 'checkout', '37429739a0452a2dc36343fb7875ba7fcbeb88a9'], 'working_dir': os.path.join(path, 'SideBarEnhancements')}) |
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
letter | frequency | |
---|---|---|
A | .08167 | |
B | .01492 | |
C | .02782 | |
D | .04253 | |
E | .12702 | |
F | .02288 | |
G | .02015 | |
H | .06094 | |
I | .06966 |
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 wait_for_notify(&block) | |
io = pg_connection.socket_io | |
while @listening do | |
Celluloid::IO.wait_readable(io) # blocks execution, but unblocks this actor | |
pg_connection.consume_input # fetch any input on this connection | |
# read the NOTIFY messages off the socket | |
while notification = pg_connection.notifies do | |
block.call( |
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
SELECT created_on, note_count, sum(note_count) OVER (ORDER BY created_on ASC) | |
FROM ( | |
SELECT date_trunc('day', created_at) AS created_on, count(1) AS note_count | |
FROM notes | |
GROUP BY created_on | |
ORDER BY created_on DESC | |
) AS note_counting; | |
-- WHERE created_on >= '2013-01-01' |
NewerOlder