Skip to content

Instantly share code, notes, and snippets.

View pjama's full-sized avatar
🎯
Focusing

Philip Jama pjama

🎯
Focusing
View GitHub Profile
--(1)--
1 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
@pjama
pjama / aes_cipher
Created April 18, 2013 17:44
AES encryption / decryption module. Based on SO response, http://stackoverflow.com/a/12525165
#!/usr/bin/python
from Crypto import Random
from Crypto.Cipher import AES
import base64
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
@pjama
pjama / colours
Created April 18, 2013 17:43
Useful colour / style constants for bash scripting.
#!/bin/bash
# COLOURS
export NONE='\033[0;00m'
export PINK='\033[1;35m'
export CYAN='\033[0;36m'
export BLUE='\033[1;34m'
export RED='\033[1;31m'
# USAGE:
@pjama
pjama / import_compressed_db_dump
Last active December 16, 2015 08:49
Script to load test database from dump file. Command line usage: `script.sh db_name`
#!/bin/bash
DATABASE=$1
TEST_DB_FILE="test_db.tar.gz"
mysql -uroot -e "drop database if exists $DATABASE;"
mysql -uroot -e "create database $DATABASE;"
mysql -uroot -e "show databases;"
if [ ! -f $TEST_DB_FILE ]; then