Skip to content

Instantly share code, notes, and snippets.

View ys's full-sized avatar
💭
Doing stuff with computers

Yannick Schutz ys

💭
Doing stuff with computers
View GitHub Profile
source 'https://rubygems.org'
gem 'puma'
gem 'rack'
@ys
ys / gist:698a89de7345dbb8d95b
Created December 16, 2014 11:40
Use Gemfile ruby for chruby...
more Gemfile | grep ^ruby | awk '{gsub("\"","");gsub("\x27",""); print $2}'
#! /usr/bin/env ruby
issue= ARGV.shift
current_branch = `git rev-parse --abbrev-ref HEAD`
origin_url = `git config --get remote.origin.url`
repo = origin_url.split(':')[1].split('.')[0]
command = "hub pull-request"
command = command + " -i #{issue}" if issue
command = command + " -b #{repo}:master -h #{repo}:#{current_branch}"
system command
on alfred_script(q)
set theText to q
tell application "OmniFocus"
parse tasks into default document with transport text theText
end tell
end alfred_script

Keybase proof

I hereby claim:

  • I am ys on github.
  • I am yannick (https://keybase.io/yannick) on keybase.
  • I have a public key whose fingerprint is D6C7 F71B ABC0 3E2A 1F6F C2FE BCA4 A202 5A48 1A75

To claim this, I am signing this object:

curl -vvv -X POST -H 'Authorization: Token TOKEN' -H 'Accept: application/vnd.github.cannonball-preview+json' -H 'Content-Type: application/json' -d '{"ref":"master", "payload":{"heroku_app":"app"}}' https://api.github.com/repos/ys/repo/deployments
curl -vvv -X GET -H 'Authorization: Token TOKEN' -H 'Accept: application/vnd.github.cannonball-preview+json' https://api.github.com/repos/ys/repo/deployments
@ys
ys / schema.sql
Created March 11, 2014 15:48
Schema for will/datascope using free data tier heroku postgres database. The trigger will keep the last 10000 elements
CREATE TABLE stats (id serial primary key, created_at timestamptz default (now()), data json);
create index ON stats (created_at);
-- Function that will delete old rows to keep the size of the set to 10_000 rows
CREATE OR REPLACE FUNCTION prune_stats_table()
RETURNS trigger AS
$BODY$
BEGIN
DELETE FROM stats WHERE id < (SELECT id FROM stats ORDER BY id DESC LIMIT 1 OFFSET 9999);
return null;
#! /usr/bin/env ruby
origin_url = `git config --get remote.origin.url`
repo = origin_url.split(':')[1].split('.')[0]
`open https://github.com/#{repo}`
@ys
ys / functions.sh
Last active August 29, 2015 13:55
Having multiple Heroku accounts? Switch between multiple netrc files!
//USAGE: _hk <alternate netrc file extension> <hk parameters>
function _hk {
altfile=$1
shift;
mv ~/.netrc ~/.netrc.bckp
mv ~/.netrc.$altfile ~/.netrc
hk $@
mv ~/.netrc ~/.netrc.$altfile
mv ~/.netrc.bckp ~/.netrc
}
@ys
ys / torrent
Created January 28, 2014 11:41
#! /usr/bin/env ruby
require 'transmission_api'
require 'pp'
class TorrentCli
def initialize(conf_file = "#{ENV['HOME']}/.torrent.conf")
@conf_file = conf_file
unless File.exist?(conf_file)
$stderr.puts "Config file does not exists. Default is : ~/.torrent.conf"
exit 1