Skip to content

Instantly share code, notes, and snippets.

@zennro
zennro / login.rb
Last active August 29, 2015 14:27 — forked from amscotti/login.rb
Sample of Sinatra authentication
require 'rubygems'
require 'bcrypt'
require 'haml'
require 'sinatra'
enable :sessions
userTable = {}
helpers do
@zennro
zennro / sinatra_sass_coffee.rb
Last active August 29, 2015 14:27 — forked from jharjono/sinatra_sass_coffee.rb
a setup of Sinatra using Slim for HTML, Sass for CSS, and CoffeeScript for JavaScript
#!/usr/bin/env ruby
# Libraries:::::::::::::::::::::::::::::::::::::::::::::::::::::::
require 'rubygems'
require 'sinatra/base'
require 'slim'
require 'sass'
require 'coffee-script'
# Application:::::::::::::::::::::::::::::::::::::::::::::::::::
@zennro
zennro / apt-ftparchive.conf
Last active April 24, 2018 20:59 — forked from aarroyoc/apt-ftparchive.conf
Debian/Ubuntu repo using apt-ftparchive
Dir {
ArchiveDir "./debian";
CacheDir "./cache";
};
Default {
Packages::Compress ". gzip bzip2";
Sources::Compress ". gzip bzip2";
Contents::Compress ". gzip bzip2";
};
TreeDefault {
@zennro
zennro / tmux.conf
Last active August 29, 2015 14:25 — forked from spicycode/tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@zennro
zennro / 0_pw_hash.rb
Last active August 29, 2015 14:17 — forked from pschyska/0_pw_hash.rb
# lib/puppet/parser/functions/pw_hash.rb
module Puppet::Parser::Functions
newfunction(:pw_hash, type: :rvalue) do |args|
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2
# SHA512 ($6), default number of rounds (5000)
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e.
# args[0].crypt("$6$rounds=50000$#{args[1]}")
args[0].crypt("$6$#{args[1]}")
end
@zennro
zennro / dork.rb
Last active August 29, 2015 14:16 — forked from fbettag/dork.rb
#!/usr/bin/ruby
# encoding: utf-8
# Copyright (c) 2011, Franz Bettag <franz@bett.ag>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#!/bin/bash
#force run with bash
if [ -z "$BASH_VERSION" ]
then
exec bash "$0" "$@"
return
fi
#create local scope
@zennro
zennro / sshd.go
Last active August 29, 2015 14:14 — forked from jpillora/sshd.go
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@zennro
zennro / sshd.go
Last active August 29, 2015 14:13 — forked from jpillora/sshd.go
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
] wc -l domains.txt
783 domains.txt
] time go run domain_lookup_parallel.go
real 0m5.743s
user 0m0.359s
sys 0m0.355s
] time go run domain_lookup_sequential.go