Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Church h3xx

View GitHub Profile
View reboot-surfboard.pl
#!/usr/bin/perl -w
use strict;
# Reboot a Surfboard modem because it'll give wired connections a little bit of
# bandwidth while hogging wifi users are forced to renegotiate a connection.
# >:-)
# Last updated 2016-06-20
use constant USER => '*****';
use constant PASS => '*****';
@h3xx
h3xx / gifsicle_remove2.sh
Created Jul 28, 2017 — forked from aug2uag/gifsicle_remove2.sh
remove every second frame of GIF with gifsicle
View gifsicle_remove2.sh
#!/bin/bash
# This script will take an animated GIF and delete every other frame
# Accepts two parameters: input file and output file
# Usage: ./<scriptfilename> input.gif output.gif
# Make a copy of the file
cp $1 $2
echo "copy completed"
# Get the number of frames
numframes=`gifsicle $1 -I | grep -P "\d+ images" --only-matching | grep "[0-9][0-9]*" --only-matching`
View REDDIT-modwarning.js
// ==UserScript==
// @name REDDIT-modwarning
// @namespace reddit
// @include http://www.reddit.com/r/*/comments/*
// @include https://www.reddit.com/r/*/comments/*
// @require https://code.jquery.com/jquery-2.2.4.min.js
// @version 0.02
// ==/UserScript==
(function () {
View bluesandbullets-anachronisms.txt
Blues and Bullets - Anachronisms & Historical Inaccuracies
Chapter 2:
(~1950-1957)
- Black guy comes into diner and sits down (diners were segregated until 1964)
(~1930-1937 - "20 years earlier")
- Ness drinks from bottle of liquor (Prohibition in full effect, the real Ness
didn't drink until after prohibition ended)
@h3xx
h3xx / qq.cpp
Last active Feb 7, 2016
Solver for Energy Balance
View qq.cpp
// GistID: c61ccc4fe17d876defa7
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
template <typename T>
View 42656.1.txt
## SEQUENCE REVERSER (ACHIEVEMENT)
@0
STO:MOV RIGHT DOWN
MOV RIGHT DOWN
MOV RIGHT DOWN
MOV RIGHT DOWN
MOV RIGHT DOWN
MOV RIGHT DOWN
MOV RIGHT ACC
@h3xx
h3xx / AuthUtility.php
Last active Aug 29, 2015
Bad Code for generating a "random" password
View AuthUtility.php
/**
* Generate a random alphanumeric password
* precondition: len must be <= 32
* param len: length of the random password
* param enforce_rules: enforce password security rules
* returns: the random password
**/
public static function generateRandomPassword($len=8, $enforce_rules = false)
{
$count = 0;
View hover_zoom-5.7_0_defang_google_analytics.patch
--- hover_zoom-5.7_0/js/background.js.orig 2015-03-16 00:57:39.641351085 -0500
+++ hover_zoom-5.7_0/js/background.js 2015-03-26 09:17:53.562204063 -0500
@@ -79,11 +79,12 @@
});
});
break;
- case 'trackEvent':
- if (options.enableStats && _gaq) {
- _gaq.push(['_trackEvent', message.event.category, message.event.action, message.event.label]);
- }
View permute.pl
#!/usr/bin/perl -w
use strict;
=head2 permute($arrayref)
Gives all permutations of a given set of elements. Stolen straight out of B. Heap's HeapPermute algorithm.
$ fxpr 'permute [0..1]'
[ 0 1 ]
[ 1 0 ]
@h3xx
h3xx / takescreenshot.sh
Created Mar 10, 2014
Take a screenshot in Linux
View takescreenshot.sh
#!/bin/sh
# uses imagemagick's import(1) utility to take a screenshot of the current
# window
HELP_MESSAGE() {
local EXIT_CODE="${1:-0}"
cat <<EOF
Usage: $(basename -- "$0") [OPTIONS] [FILE]...
You can’t perform that action at this time.