Skip to content

Instantly share code, notes, and snippets.

@MrDOS
MrDOS / csv-good.csv
Last active February 3, 2017 16:38
CSV Export is Awful in Excel for Mac 2016
Col 1 Col 2
Let's call this "1" I don't believe you
2 This field contains a newline
3, alright Sacré bleu!
@MrDOS
MrDOS / repoke.js
Created January 30, 2017 15:44
Because clicking that “Poke Button” link yourself is just too damn hard.
var repoke = function() {
var pokes = 0;
Array.prototype.forEach.call(
document.getElementsByTagName("img"),
function(el) {
if (el.className !== '_3-8_ img')
return;
var parent = el.parentNode;
if (parent.innerHTML.indexOf("Poke Back") == -1)
@MrDOS
MrDOS / embiggen-kijiji.user.js
Created January 26, 2017 13:20
Make Kijiji use higher-resolution listing images.
// ==UserScript==
// @name Embiggen Kijiji
// @description Make Kijiji use higher-resolution listing images.
// @namespace ca.seenet.userscripts
// @author Samuel Coleman
// @version 2017-01-18
// @match http://www.kijiji.ca/*
// @grant none
// ==/UserScript==
@MrDOS
MrDOS / 0001-Make-terminal-windows-borderless.patch
Created June 2, 2016 17:30
Borderless window patch for iTerm 2.
From 4c4d79c68bb8da4a9f00134ed5adab78d2288ba7 Mon Sep 17 00:00:00 2001
From: Samuel Coleman <samuel@seenet.ca>
Date: Thu, 2 Jun 2016 13:23:01 -0400
Subject: [PATCH 1/1] Make terminal windows borderless.
This removes the title bar from terminal windows. It has the
unfortunate side effect of also making it impossible to resize/move the
windows with the mouse. It is most usable when accompanied by a tiling
window management application like [Spectacle][1].
@MrDOS
MrDOS / postinst
Created March 9, 2016 16:09
qemu-user-static_2.1+dfsg-12+deb8u5a postinst
#!/bin/sh
set -e
# check if we're running inside an (lxc) container
# (we may copy or move this to the postinst script too, to skip installing it)
grep -zqs ^container= /proc/1/environ && exit 0
# == binfmt registration/deregistration ==
if [ -x /usr/sbin/update-binfmts ]; then
fmts="aarch64 alpha arm armeb cris i386 m68k microblaze mips mipsel ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64"
@MrDOS
MrDOS / StaticFieldCacheExample.cls
Created June 5, 2015 17:42
An example of how to cache a value in a static field.
public class StaticFieldCacheExample
{
/* Define a static field to hold the value. */
private static String cachedValue = null;
public static String getCachedValue()
{
/* If the value has been previously calculated, return it immediately
* instead of performing an expensive calculation. */
if (StaticFieldCacheExample.cachedValue != null)
[global]
# Windows networking workgroup and machine name.
workgroup = SEESIDE
netbios name = nancy
# Equivalent to the machine description on a Windows desktop.
server string = %h server
@MrDOS
MrDOS / convert_stat_ids_to_names.py
Created January 5, 2015 05:59
Convert block and item IDs in Minecraft player stat files to names for 1.7 to 1.8 migrations.
#!/usr/bin/env python
from __future__ import print_function
"""Converts keys in Minecraft player stats files from ids (1.7) to names (1.8).
Workaround for SPIGOT-167.
Requires a table providing ID to name lookup. Mine is available at
@MrDOS
MrDOS / mc_ids.py
Created January 5, 2015 05:54
Minecraft block/item IDs
"""Provides a lookup table for Minecraft block and item IDs to names.
Exposes one dictionary, MC_IDS. Keys are IDs, values are names.
"""
__author__ = "Samuel Coleman"
__copyright__ = "Mojang AB, probably"
__credits__ = ["http://minecraft.gamepedia.com/Data_values"]
__license__ = "WTFPL"
@MrDOS
MrDOS / Eliminator.java
Created December 20, 2014 18:35
The Eliminator reads in two files, the first containing the set of “potential duplicates”, the second containing the “baseline” set, and outputs only those lines which exist in the first file but not the second.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
public class Eliminator
{