Skip to content

Instantly share code, notes, and snippets.

@x684867
x684867 / gist:5072775
Created March 2, 2013 19:29
This is a quick and dirty little program I use to determine how a machine and its operating system handle integer types. It's really nice when you are working with embedded systems. If you appreciate what I've done by making this a public domain script, then please contribute to one of the awesome open source projects on the internet or contribu…
#include <stdio.h>
#include <stdlib.h>
void main(void){
printf("word_sizes.c\n");
printf("(c) 2013 Sam Caldwell. Public Domain.\n\n");
printf("This is a quick and dirty little program I use to determine how a machine and its operating system handle integer types.\n\n");
printf("It's really nice when you are working with embedded systems. If you appreciate what I've done by making this a public domain script, ");
printf("then please contribute to one of the awesome open source projects on the internet or contribute your own code to the community and ");
@x684867
x684867 / gist:5381478
Created April 14, 2013 04:37
Brain storming a p2p cryptographic currency idea.
***INITIALIZATION***
1. We assume this starts with some "God" CA that has a publicly trusted certificate. This is the root of the entire system.
2. God CA signs "Alice" certificate, authorizing Alice to act as a market player. Alice is assigned 100u of currency.
3. God CA signs "Bob" certificate, authorizing Bob to act as a market player. Bob is assigned 100u of currency.
4. God CA signs "Charlie" certificate, authorizing Charlie to act as a market player. Charlie is assigned 100u of currency.
***1st MARKET ACTIONS***
1. "Alice" signs "Anna" and gifts "anna" 25u. To sign anna, alice requires signatures of two witnesses.
a. Alice asks Bob and pays Bob a fee of 50% of the transaction (12.5u).
b. Alice asks Charlie and pays Charlie a fee of 50% of the transaction (12.5u).
@x684867
x684867 / Redistricting algorithm
Created April 14, 2013 21:40
Legislative redistricting idea. What if legislative redistricting were performed by computer algorithm based on constitutional parameters (e.g. population per area, etc.)? Would this make a better democracy?
(A) Assumptions:
(1) Certain data sources exist which are objective: popuplation, jurisdictional land area.
(2) An objectively drawn, impartial legislative boundary should cover either some specified population or land area with the smallest surface area (measured by the length of its boundary).
(3) The algorithm has a starting number of representatives in the body being evaluated.
(4) In the case of the Senate, for example, borders should be drawn according to land area, distributing representation equally per acre of land in the state across a smaller elected body. This is consistent with the original concept of the Senate.
(5) For the House of Representatives, borders should be drawn according to population, allocating representation equally across the pool of citizens to a larger elected body.
(B) Land-Area-based Algorithm:
@x684867
x684867 / gist:6148590
Created August 4, 2013 00:52
This is the script devised to setup Ubuntu 12.04 (x64) for use with the tableBuilder.rb script.
#!/bin/bash
# -------------------------------------------------------
# Setup document for rainbow table generator
# (c) 2013 Sam Caldwell. All Rights Reserved
#
# This is the script devised to setup Ubuntu 12.04 (x64)
# for use with the tableBuilder.rb script.
# -------------------------------------------------------
case "$1" in
@x684867
x684867 / gist:6150752
Created August 4, 2013 15:44
Prepping the table structure for tableBuilder.rb
mkdir -p {0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}/{0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f}
@x684867
x684867 / tableBuilder.rb
Created August 4, 2013 16:36
tableBuilder.rb
#!/usr/bin/env ruby
#
# Universal Hash Table calculator
# (c) 2013 Sam Caldwell. All Rights Reserved.
#
# ------------------------------------------------------------------------------
# *** LIMITED INTERNAL-USE LICENSE ***
# Script intended and authorized solely for research and education purposes
# to identify the weaknesses of current cryptographic practices in place on
# many systems so that the system operators can appreciate the use of best
@x684867
x684867 / keyspaceGen.rb
Created August 5, 2013 22:47
Version three of the hash table builder...renamed keyspaceGen.rb
#!/usr/bin/env ruby
#
# Universal Hash Table calculator (keyspaceGen.rb) (version 1.3)
# (c) 2013 Sam Caldwell. All Rights Reserved.
#
# ------------------------------------------------------------------------------
# *** LIMITED EDUCATION-USE LICENSE ***
# Script intended and authorized solely for research and education purposes
# to identify the weaknesses of current cryptographic practices in place on
# many systems so that the system operators can appreciate the use of best
@x684867
x684867 / keyspace-slicer
Last active December 20, 2015 16:19
wrapper script for keyspaceGen.rb ...cause doing it the Linux way is yielding much better results. Imagine if I wrote keyspaceGen in C?
#!/bin/bash
#
# keyspace-slicer
# (c) 2013 Sam Caldwell. Public Domain
#
# Wrapper script for keyspaceGen.rb
#
for n in $(seq 32 1 127); do
./keyspaceGen.rb /opt/ 32 127 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 $n > /dev/null &
@x684867
x684867 / getYesNo
Created October 6, 2013 06:51
Bash Script for getting a quick "yes/no" response from a user.
getYesNo(){
Y=""
while [ -z "$Y" ]; do
read -n 1 -p $1 Y
Y="$(echo $Y | tr -s A-Z a-z | tr -dc YN)"
done
echo "$Y"
}
@x684867
x684867 / vimrc
Last active December 24, 2015 19:59
My Personal .vimrc (...just because I am tired of having to type this thing!)
set tabstop=4
syntax on
set nobackup
set nowb
set noswapfile
set ai
set si
set laststatus=2
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ \ Col:\ %c