Skip to content

Instantly share code, notes, and snippets.

View aholmes's full-sized avatar

Aaron Holmes aholmes

View GitHub Profile
@aholmes
aholmes / random-number-minmax-bash.sh
Created January 10, 2015 20:35
Random number with MIN and MAX in Bash
#!/bin/bash
MIN=$1
MAX=$2
NUM=$(( ( RANDOM % ( MAX - MIN + 1 ) + MIN ) ))
var myDirective = function()
{
return {
template: '<div data-ng-include="template.url"></div>',
link: function(scope)
{
scope.template = { url: '' };
}
};
}
@aholmes
aholmes / size.py
Created August 4, 2014 22:17
Get the height and width of an uncompressed SWF.
#!/usr/bin/python
import array
f = open('uncompressed_test_adx30.swf', 'r')
input = f.read(8)
chars = [ord(ch) for ch in input]
nbits = chars[0] >> 3
var container = $('.markdown-body'),
classes = {};
container.find('h2').each(function(i)
{
var className = $(this).text().replace(/[^-a-zA-Z0-9_ ]+/g, '').trim(),
currentClass, next;
classes[className] = {};
#define DURP <stdio.h>
#define DQRP static
#define DIRP int
#define DFRP main()
#define DVRP(X,Y) printf(X,Y)
#define DYRP(X) return X
#define DGRP {
#define DJRP }
#define DORP 0
#define DNRP 1
var queued = [], scrollTimeout, waitForQueueTimeout;
function queueMore() {
Array.prototype.filter.call(document.querySelectorAll('a.UFILikeLink[title*="Like this"]'), function(a) {
if (queued.indexOf(a) === -1) {
queued.push(a);
}
});
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
</head>
@aholmes
aholmes / bst-timing.php
Created January 22, 2014 22:39
Reimplementation of "The Mysterious Program." https://stripe-ctf.com/
<?php
$words = file('/usr/share/dict/words');
function generateBTree($input) {
$tree = [];
$p = $tree;
foreach($input as &$word) {
$word = trim($word);
<?php
class Result {
public $id;
public $foo = 'bar';
function __construct() {
$this->id = rand(0,9999);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.IO;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using Newtonsoft.Json;