Skip to content

Instantly share code, notes, and snippets.

@tekacs
tekacs / crypto.rb
Created Jun 10, 2016
Demonstration of using Ruby's OpenSSL module to do symmetric crypto 'correctly'
View crypto.rb
#!/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?
View keybase.md

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:

View AmpTest.cpp
// 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 Sep 23, 2014
Keybase Proof
View keybase.md

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:

View gist:4992089
#!/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
View gist:4992064
$ 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 Apr 20, 2011
This does something essentially equivalent to showoff.io if you have a publicly facing server...
View show
# 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"
}