Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mveytsman
mveytsman / binary_search_tree.rs
Created June 21, 2014 03:36
binary search tree in rust
enum BinaryTree {
Node(int, Box<BinaryTree>, Box<BinaryTree>),
Leaf
}
fn insert(tree:Box<BinaryTree>, value:int) -> Box<BinaryTree> {
return box match (*tree) {
Leaf => Node(value, box Leaf, box Leaf),
Node(i, left, right) => if value < i {
Node(i, insert(left, value), right)
@mveytsman
mveytsman / phonebook.rb
Created June 20, 2014 17:57
Hacker School Phonebook
#!/usr/bin/env ruby
require 'thor'
class PhoneBookCLI < Thor
no_commands do
def wrap_errors(&block)
begin
instance_eval &block
rescue Exception => e
say "#{e.message}", :red
exit
#!/bin/bash
### Setup a wifi Access Point on Ubuntu 12.04 (or its derivatives).
### make sure that this script is executed from root
if [ $(whoami) != 'root' ]
then
echo "
This script should be executed as root or with sudo:
sudo $0
"
@mveytsman
mveytsman / keybase.md
Created March 6, 2014 02:38
I'm on keybase!

Keybase proof

I hereby claim:

  • I am mveytsman on github.
  • I am mveytsman (https://keybase.io/mveytsman) on keybase.
  • I have a public key whose fingerprint is 9C97 0545 A994 453D 4044 75C4 D773 5456 46C9 1E49

To claim this, I am signing this object:

@mveytsman
mveytsman / forge_cert.rb
Created July 24, 2012 03:53
Generate a SSL certificate signed by a custom CA with the same subject (common name, organization name, etc..) as the target cert.
## Usage: forge_cert.rb CA.pem CA.key target.pem
##
## Generate an SSL certificate signed by a custom CA with the same
## subject (common name, organization name, etc..) as the target cert.
## This is useful when you need to man-in-the-middle an ssl connection
## and want to use custom certificates with an existing tool or roll
## your own.
##
## Certificate is written to standard out in PEM format.
@mveytsman
mveytsman / generate_ca.rb
Created July 24, 2012 03:39
This script generates an SSL CA certificate that can be used to sign other certificates
## Usage: generate_ca.rb NAME
##
## This script generates an SSL CA certificate that can be used to sign
## other certificates. The certificate is saved to NAME.pem, and the
## key is saved to NAME.key
require 'openssl'
if ARGV.length != 1
puts "Usage: generate_ca.rb NAME"