View last_game.rb
# Usage: ruby last_game.rb <summoner_name> <na/euw/...>
require "net/http"
require "json"
require "date"
# TODO: Insert your own key here!
API_KEY = "<YOUR-RIOT-API-KEY-HERE>"
@summoner_name = ARGV[0]
View basecamp_3_notification-badge_for_fluid.js
// This script is usefull if you use [Fluid App](http://fluidapp.com/)
// with Basecamp 3. After initializing the App, go to Window -> User Scripts
// and add this script. Use `https://3.basecamp.com*` as pattern.
window.fluid.dockBadge = '';
setInterval(updateDockBadge, 1000);
function updateDockBadge() {
var newBadge = BC.unreads.all.length;
View delete_old_backups.sh
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+%Y-%m-%d_'`*; exit"
# make sure to escape % for cron:
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+\%Y-\%m-\%d_'`*; exit"
View postgres_ftp_backup.sh
# shell command:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+%Y-%m-%d_%H-%M'`/db_backup.sql.gz --ftp-create-dirs -T -
# if you want to execute it through cron, be sure to escape all %!
# for crontab:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+\%Y-\%m-\%d_\%H-\%M'`/db_backup.sql.gz --ftp-create-dirs -T -
View Arrow-in-Hero.markdown
View nav.php
<?
// add your navigation items accordingly
$nav_links = [
'Unternehmen' => 'unternehmen.php',
'Leistungen' => 'leistungen.php',
'Objekte' => 'objekte.php'];
?>
<!-- ... -->
View gist:10317378
### Keybase proof
I hereby claim:
* I am cschell on github.
* I am cschell (https://keybase.io/cschell) on keybase.
* I have a public key whose fingerprint is D5A4 78EF 6166 5BAC A6D5 E6AC 4BED 524B 758B D750
To claim this, I am signing this object:
View git-file-size-diff
#!/bin/sh
. git sh-setup
args=$(git rev-parse --sq "$@")
eval "git diff-tree -r $args" | {
total=0
while read A B C D M P
do
case $M in
M) bytes=$(( $(git cat-file -s $D) - $(git cat-file -s $C) )) ;;
A) bytes=$(git cat-file -s $D) ;;
View acitve_record_null_relation.rb
module ActiveRecord
class Base
def self.none
NullRelation.new(self, @table)
end
end
# = Active Record Null Relation
class NullRelation < Relation
def exec_queries
View theunzipper.rb
#!/usr/bin/env ruby
if ARGV.count < 2
puts "error: you must supply a destination dir and a target dir"
exit 1
else
destination_dir = ARGV[0]
target_dir = ARGV[1]
end