Skip to content

Instantly share code, notes, and snippets.

View rdev5's full-sized avatar
💭
Note: This account has been moved to @mattborja

Matt Borja rdev5

💭
Note: This account has been moved to @mattborja
View GitHub Profile
/* TinyTone for ATtiny85 (thanks to http://www.technoblogy.com/show?KVO) */
// Notes
const int Note_C = 239;
const int Note_CS = 225;
const int Note_D = 213;
const int Note_DS = 201;
const int Note_E = 190;
const int Note_F = 179;
const int Note_FS = 169;
alias gs='git status '
alias gaa='git add --all :/'
alias gcam='git commit -a -m '
alias gl='git log'
alias gp='git push -u origin master'
@rdev5
rdev5 / probably_random.ino
Created February 9, 2016 07:01 — forked from endolith/LICENSE.txt
Arduino hardware true random number generator
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
byte sample = 0;
boolean sample_waiting = false;
byte current_bit = 0;
byte result = 0;
void setup() {
@rdev5
rdev5 / results.md
Created February 9, 2016 06:55 — forked from endolith/results.md
Randomness testing of Arduino TrueRandom

I ran

cat /dev/urandom >> devurandom.bin

which produced 31 MB of data in a few seconds. To get numbers from the Arduino, I ran:

stty -F /dev/ttyUSB0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
cat /dev/ttyUSB0 >> TrueRandom.bin

which took several days to produce 93 MB of data (rate of about 3.2 kbit/s)

@rdev5
rdev5 / laravel-koding-setup.sh
Last active January 20, 2016 14:39
Laravel installer for Koding.io based on steps outlined at https://laravel.com/docs/5.2#installing-laravel
#!/bin/bash
# author: matt borja
SWAP_SIZE=256
APP_NAME="$1"
INSTALL_PATH="$2"
UPDATE_PACKAGES="$3"
INSTALL_WITH_COMPOSER="$4"
if [ -z "$APP_NAME" ]; then
@rdev5
rdev5 / laravel-scaffolding.sh
Last active January 20, 2016 14:37
Scaffolding shortcuts for Laravel application outlined at https://laravel.com/docs/master/quickstart-intermediate
#!/bin/bash
# author: matt borja
cat "$0"
exit
# setup auth
php artisan migrate
php artisan make:auth
# cleanup "web" middleware
// See http://arduino.cc/en/Tutorial/CapacitanceMeter
#include <ShiftLCD.h>
#include <stdlib.h>
ShiftLCD lcd(4, 2, 3);
const int DISCHARGE_PIN = 5;
const int CHARGE_PIN = 6;
const int R_VALUE = 100;
void setup()
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
#!/usr/bin/env node
var sys = require('sys');
var exec = require('child_process').exec;
const RSYNC = '/usr/bin/rsync';
const SSH = '/usr/bin/ssh';
const BANDWIDTH_LIMIT = 512; // Kbps
// Backup destinations
var stores = {
<html>
<head>
<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
function authenticated() {
var ajax_setup = $.ajaxSetup();
return ajax_setup.headers !== undefined && ajax_setup.headers.Authorization !== undefined && ajax_setup.headers.Authorization !== null;
}