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 | |
# pingpongninja_expected_results -- simulate a series of games on pingpongninja | |
# | |
# algorithm extracted from | |
# https://github.com/jdennes/pingpongapp/blob/master/pingpong/rankings.py | |
def new_ranks(rank1, rank2, points1, points2) | |
decay_factor = 10 | |
game_ranking_points = (rank1 + rank2) / 2 | |
ranking_change1 = game_ranking_points + (points1 - points2) * 100 / [points1, points2].max | |
ranking_change2 = game_ranking_points + (points2 - points1) * 100 / [points1, points2].max |
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
function git () { | |
case "$PWD"; in | |
/path/to/work/repos/*) | |
command git -c user.email=you@work.com "$@" | |
;; | |
*) | |
command git "$@" | |
;; | |
esac | |
} |
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
function encrypt(text){ | |
var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq') | |
var crypted = cipher.update(text,'utf8','hex') | |
crypted += cipher.final('hex'); | |
return crypted; | |
} | |
function decrypt(text){ | |
var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq') | |
var dec = decipher.update(text,'hex','utf8') |