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
require 'digest/sha1' | |
@ctf_username = "user-8lmmcgvw" | |
def addToLedger | |
user_in_ledger = false | |
File.open("LEDGER.txt").each_line do |line| | |
if line.match(/^#{@ctf_username}:/) | |
user_in_ledger = true | |
end |
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
require "pinboard" | |
require 'net/https' | |
require "uri" | |
require "json" | |
username = "pinboard_username" | |
password = "pinboard_password" | |
delicious_user = "delicious_username" | |
pinboard = Pinboard::Client.new(:username => username, :password => password) |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$script = <<SCRIPT | |
set -e | |
set -x | |
cd | |
sudo apt-get update -y | |
sudo apt-get install \ |
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 authenticate(req, res, next) { | |
var auth = require('basic-auth'); | |
var user = auth(req); | |
if (user === undefined || user['name'] !== 'user' || user['pass'] !== 'pass') { | |
res.statusCode = 401; | |
res.setHeader('WWW-Authenticate', 'Basic realm="Bitte anmelden!"'); | |
res.end('Unauthorized'); | |
} else { | |
next(); | |
} |
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
var express = require('express') | |
, path = require('path') | |
, helmet = require('helmet') | |
, csrf = require('csurf') | |
, cookieParser = require('cookie-parser') | |
, bodyParser = require('body-parser') | |
, cookieSession = require('cookie-session') | |
, methodOverride = require('method-override') | |
, compress = require('compression') | |
, mincer = require('mincer') |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$script = <<SCRIPT | |
export HOST_USER=$1 | |
apt-get update -y && apt-get -y install git | |
# Install Dokku | |
wget -qO- https://raw.github.com/progrium/dokku/v0.2.3/bootstrap.sh | DOKKU_TAG=v0.2.3 bash |
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
desc "TODO" | |
task :compare_yml, [:locale1, :locale2] => :environment do |t, args| | |
LOCALE_1 = "config/locales/#{args[:locale1]}.yml" | |
LOCALE_2 = "config/locales/#{args[:locale2]}.yml" | |
require 'yaml' | |
def flatten_keys(hash, prefix="") | |
keys = [] | |
hash.keys.each do |key| |
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
#! /bin/bash | |
# directory to save backups in, must be rwx by postgres user | |
BASE_DIR="/var/backups/postgres" | |
YMD=$(date "+%Y-%m-%d") | |
DIR="$BASE_DIR/$YMD" | |
mkdir -p $DIR | |
cd $DIR | |
# make database backup |
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
if ENV['CANONICAL_HOST'] | |
constraints(:host => Regexp.new("^(?!#{Regexp.escape(ENV['CANONICAL_HOST'])})")) do | |
match "/(*path)" => redirect { |params, req| "http://#{ENV['CANONICAL_HOST']}/#{params[:path]}" }, via: [:get, :post] | |
end | |
end |