For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
require 'gollum/frontend/app' | |
require 'digest/sha1' | |
class App < Precious::App | |
User = Struct.new(:name, :email, :password_hash) | |
before { authenticate! } | |
helpers do | |
def authenticate! |
Interim Note-Changes | |
.DS_Store |
require 'gollum/frontend/app' | |
require 'digest/sha1' | |
class App < Precious::App | |
User = Struct.new(:name, :email, :password_hash, :can_write) | |
before { authenticate! } | |
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end | |
helpers do |
# Assumes that you tag versions with the version number (e.g., "1.1") and then the build number is | |
# that plus the number of commits since the tag (e.g., "1.1.17") | |
echo "Updating version/build number from git..." | |
plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
# increment the build number (ie 115 to 116) | |
versionnum=`git describe | awk '{split($0,a,"-"); print a[1]}'` | |
buildnum=`git describe | awk '{split($0,a,"-"); print a[1] "." a[2]}'` |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
# http://www.deadman.org/sshscreen.php | |
# Use this when on your remote machine, before you reattach a screen session | |
alias scratch='$HOME/bin/grabssh; screen -d -R' | |
# Use this in a screen session on your remote machine when you need agent forwarding | |
alias fixssh='source $HOME/bin/fixssh' |