Skip to content

Instantly share code, notes, and snippets.

View a-r-d's full-sized avatar
🍌

Aaron Decker a-r-d

🍌
View GitHub Profile
@a-r-d
a-r-d / StaticSwapper.as
Last active August 29, 2015 14:01
Swaps the static vars from one class to another. Had to create this to do some configuration copying on a library class. Anyway, it is an example of reflection in AS3.
package com.example
{
import flash.utils.Dictionary;
import flash.utils.describeType;
public class StaticSwapper
{
public function StaticSwapper()
{
@a-r-d
a-r-d / sclice_string.py
Created May 11, 2014 17:53
A little game for learning string slicing in python. Figure out the correct substring that should result from a given slice.
import random
score = 0
attempts = 0
test_words = [
"hello world",
"dolphin",
"waffles",
"pancakes",
"bannana"
@a-r-d
a-r-d / states.as
Created May 2, 2014 16:03
Array of states in AS3. Could also be JavaScript.
public static const states:Array = [
{symbol:"AK",name:"Alaska"},
{symbol:"AZ",name:"Arizona"},
{symbol:"AR",name:"Arkansas"},
{symbol:"CA",name:"California"},
{symbol:"CO",name:"Colorado"},
{symbol:"CT",name:"Connecticut"},
{symbol:"DE",name:"Delaware"},
{symbol:"DC",name:"Dist of Columbia"},
{symbol:"FL",name:"Florida"},
@a-r-d
a-r-d / get_some_page.js
Last active December 29, 2015 07:19
Getting around scrapping prevention based in javascript redirection / cookie setting using phantomjs on a headless linux server. Pesky javascript is no match for a simulated browser! I think this will also work great for avoiding cloudflare roadblocks.
var page = require('webpage').create();
console.log("opening page");
var url = 'https://scrappingtarget.com';
page.open(url, function (status) {
setTimeout( function(){
var fs = require('fs');
try {
var p = page.evaluate(function () {
return document.getElementsByTagName('html')[0].innerHTML
@a-r-d
a-r-d / brute.rb
Created November 9, 2013 21:19
Really slow brute forcer for encrypted wallet. If you forget it and know the beginning of the password you may be able to get it. However this can only try 10 passwords a second :( Adapted from a script posted on bitcointalk.
#!/usr/bin/ruby -w
=begin
How to use, windows:
go to C:/Program Files (x86)/Bitcoin/daemon/
and execute ".\bitcoin -help"
You will need to create bitcoin.conf file @:
C:\Users\usr\AppData\Roaming\Bitcoin
@a-r-d
a-r-d / my.cnf
Last active December 27, 2015 17:29
MySQL Innodb performance tips. This goes in /etc/mysql/my.cnf
# inclease your query cache size:
query_cache_limit = 2M
query_cache_size = 32M
# increase memory to recduce heavy disk I/O
innodb_buffer_pool_size = 420M
innodb_additional_mem_pool_size = 10M
# sacrifice small amount of integrity for speed:
innodb_flush_log_at_trx_commit = 1
@a-r-d
a-r-d / 5_to_1.py
Last active December 23, 2015 21:19
5 to 1 one odds or 4 to 1 odds?
import random
"""
From a theory of poker book:
You have me pick a number 1-5 and
if I get it, you give me $5. If I don't
I give you $1. Overall I will win because
I actually have 4:1 odds on a $5:$1 payout.
I have 5 choices but one wins and only four lose.
@a-r-d
a-r-d / showlogs.sql
Created August 14, 2013 15:38
Mysql Logging:
-- be root to do this.
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
use mysql;
show tables;
@a-r-d
a-r-d / readme.md
Last active May 13, 2018 01:14
LCD + Arduino + Python serial code. Small arduino program to read in lines off of the serial port from a python program and write it to the LCD. I have a method to do the scrolling, and a way to determine which lines you are sending so it goes on the right line. Eventually this will pull down my credit card info and figure out how much I have le…

LCD + Arduino + Raspberry PI

The LCD module is attached via 2 analog pins to the Arduino board.

The arduino board listens for serial data coming in that starts with a line number, it will then send it on its way to the correct line, while calculating what substring it needs to display on the LCD.

The raspberry pi is running the python script that is doing the sending. The raspberry pi has

@a-r-d
a-r-d / file_finder.py
Last active December 19, 2015 14:29
Why windows can't search the network drives at work is beyond me....
## brute force filename searcher:
import os
print "This script searched folder names and file names"
print "Specify path to search: "
the_path = raw_input("=>")
print "Sepcify search term: "
the_term = raw_input("=>")