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
@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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ page.title }}</title>
<meta name="viewport" content="width=device-width">
<!-- syntax highlighting CSS -->
<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700' rel='stylesheet' type='text/css'>
@ys
ys / padded.rb
Created December 13, 2013 15:12
#!/usr/bin/env ruby
def padded_tweet(message)
if message.size >= 140
message[0..139]
elsif %w{. ! ? …}.include? message[-1]
message.ljust(140, message[-1])
else
message.ljust(140, '!')
end
@ys
ys / padded.rb
Created December 13, 2013 15:11
#!/usr/bin/env ruby
def padded_tweet(message)
if message.size >= 140
return message[0..139]
end
if %w{. ! ? …}.include? message[-1]
return message.ljust(140, message[-1])
end
return message.ljust(140, '!')
@ys
ys / padded.rb
Created December 13, 2013 15:10
#!/usr/bin/env ruby
def padded_tweet(message)
if message.size >= 140
return message[0..139]
end
dup = message.dup
if %w{. ! ? …}.include? message[-1]
return dup.ljust(140, message[-1])
end
class Follow < ActiveRecord::Base
belongs_to :follower, class_name: 'User'
belongs_to :followee, class_name: 'User'
end
@ys
ys / .gitignore
Last active December 26, 2015 06:39
.bundle
@ys
ys / puma.rb
Created October 17, 2013 15:25
threads 0, Integer(ENV['MAX_THREADS'] || 10)
on_restart do
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
FB::RedisPool.shutdown
end
workers Integer(ENV['WEB_CONCURRENCY'] || 3)
@ys
ys / todos
Last active December 25, 2015 18:59
My todo lists handler
function todo {
vim ~/Dropbox/todos/$1.txt
}
function list-todo {
for i in ~/Dropbox/todos/*; do echo $(basename $i | cut -f 1 -d '.') ":" $(wc -l < $i); done
}
alias t='todo'
alias lt='list-todo'
{ '@tadas_t' => ' 124553,
'@chrisbelpaire' => ' 124744,
'@floris' => ' 124798,
'@chucky4711' => ' 124960,
'@mr_foto' => ' 125077,
'@deogracia_974' => ' 125132,
'@christophePhilemotte' => ' 125267,
'@beanieboi' => ' 125469 }