Skip to content

Instantly share code, notes, and snippets.

View michaelsanford's full-sized avatar

Michael Sanford michaelsanford

View GitHub Profile
@michaelsanford
michaelsanford / Apple_DOS_6Oct1978_retyped
Created November 13, 2013 20:27
’APPLE DOS’ circa 1978 in 8-bit assembler (C) COPYRIGHT 1978 APPLE COMPUTER, INC From: http://www.computerhistory.org/atchm/apple-ii-dos-source-code/
.TITLE SHEP,’APPLE DOS’
* 6.3 10-6-78
* 8 BIT ASSEMBLER
.M6502
*
**************************************************************************************
* (C) COPYRIGHT 1978 APPLE COMPUTER, INC
**************************************************************************************
ORG1 EQU $1B00
ORG2 EQU $3600
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@michaelsanford
michaelsanford / bash_colours.sh
Last active November 21, 2019 23:38
Bash colour code quick reference
#!/usr/bin/env bash
####
# Invoke with
# $ bash_colours [limit]
###
if hash tput >/dev/null 2>&1; then
bound=${1:-255}
for (( i = 0; i < bound; i++ )); do
@michaelsanford
michaelsanford / gcap.sh
Last active August 29, 2015 14:03
Android screenshot (Glass, Wear, mobile)
#!/usr/bin/env bash
##
# Screencaps, pulls, and deletes the png from a device.
#
# gcap [w | a | device identifier]
#
# For debugging over Bluetooth (i.e., Android Wear), see
# https://developer.android.com/training/wearables/apps/bt-debugging.html
#
@michaelsanford
michaelsanford / nuke-mysql-conditional-comments
Last active August 29, 2015 14:18
Nuke mysql conditional comment markers in vim
Two vim editor commands to nuke mysql conditional comment markers in
MySQL dumps, but not the statement within them:
: %s/\/\*!\d\+\s//g
: %s/\*\///g
Or you can use sed:
sed -i 's/\/\*!\d\+\s//g' dump.sql
sed -i 's/\*\///g' dump.sql
@michaelsanford
michaelsanford / notify-on-dns-propagated.sh
Created May 25, 2016 20:51
Email when a DNS change has propagated to a certain nameserver.
#!/usr/bin/env bash
# The IP to which you just updated your DNS
NEW_IP="127.0.0.1"
# The domain for which you're awaiting propagation
DOMAIN="EXAMPLE.COM"
# Polling interval in seconds
WAIT=30
@michaelsanford
michaelsanford / clean-local-merged-branches.sh
Last active October 18, 2016 15:48
Interactively delete local branches which have been merged upstream. In my case, that's into `develop`.
#!/bin/bash
MERGED_INTO=${1:-"develop"}
statistics() {
echo
echo "Remaining local branches:"
git branch
echo
echo "These local branches are not merged into ${MERGED_INTO}:"
@michaelsanford
michaelsanford / pizza.js
Last active January 27, 2017 16:12
Will there be pizza? 👍🏽🍕
(() => {
"use strict";
/**
* Attendees to JS-Montreal often don't know if there will be pizza or not. This aims to make it more clear.
* Traditionally, pizza is available if the meetup starts at 6 PM, but not if it starts at 7.
*
* @see https://www.meetup.com/js-montreal/
*/
@michaelsanford
michaelsanford / ask.md
Last active July 12, 2022 19:25
StackOverflow Review Comments

Hi! Welcome to Stack Overflow! Please see the [Tour], [ask], and how to create a [mcve]. You should show some code of what you've tried.

Get-ChildItem -File *.png | Foreach { cwebp.exe -short -noalpha -lossless $_.Name -o ($_.BaseName + ".webp") }