Skip to content

Instantly share code, notes, and snippets.

@tekacs
tekacs / crypto.rb
Created June 10, 2016 11:25
Demonstration of using Ruby's OpenSSL module to do symmetric crypto 'correctly'
#!/usr/bin/env ruby
# tekacs 2k16
require 'digest'
require 'openssl'
def encrypt(algo, body, key)
cipher = OpenSSL::Cipher.new(algo).encrypt
cipher.key = key
iv = cipher.iv = cipher.random_iv
cipher.auth_data = "" if cipher.authenticated?

Keybase proof

I hereby claim:

  • I am tekacs on github.
  • I am tekacs (https://keybase.io/tekacs) on keybase.
  • I have a public key whose fingerprint is 9A70 D2C9 A86C 2167 D57D BBCD 5310 C1FF 7CA2 367B

To claim this, I am signing this object:

// AmpTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/enum.hpp>
#include <boost/preprocessor/enum_params.hpp>
#include <boost/range/counting_range.hpp>
#include <boost/range/adaptor/reversed.hpp>
@tekacs
tekacs / keybase.md
Created September 23, 2014 20:05
Keybase Proof

Keybase proof

I hereby claim:

  • I am tekacs on github.
  • I am tekacs (https://keybase.io/tekacs) on keybase.
  • I have a public key whose fingerprint is FFCE B488 B2EA 82CE BA7C AB25 277A E1A6 714E B6C9

To claim this, I am signing this object:

#!/bin/bash
cat $0; echo
for i in analytics api datm doc master web wiki
do
echo $i
find $i -not -path "*gen-*" -not -path "*foundation*" -not -path "*libs*" \
\( -name "*.py" -or -name "*.js" -or -name "*.html" \) \
| xargs cat \
| wc -l
$ for i in analytics api datm doc master web wiki; do echo $i; find $i -not -path "*gen*" -and -not -path "*foundation*" -and -not -path "*libs*" \( -name "*.py" -or -name "*.js" -or -name "*.html" \) | xargs cat | wc -l; done;
analytics
0
api
469
datm
1115
doc
0
master
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}