Skip to content

Instantly share code, notes, and snippets.

View sophistifunk's full-sized avatar

Josh McDonald sophistifunk

  • Expantra
  • Brisbane, Australia
View GitHub Profile
<application
xmlns="http://ns.adobe.com/air/application/20.0"
xmlns:cv="https://gist.githubusercontent.com/sophistifunk/85142f51cb7f4d607074/raw/27adac43b9f2c528af89e3bd672c85bbbf5a4f9b/customvalue.xsd">
<id>com.application.id</id>
<filename>Test</filename>
<name>Test App</name>
<versionNumber>0.0.1</versionNumber>
<cv:customValue>value</cv:customValue>
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customValue" type="xs:string" />
</xs:schema>
### snipped OS noise and work-related hosts :)
# Cocksuckers that mess with your copy + paste, and other such obscenities
0.0.0.0 www.tynt.com
0.0.0.0 tynt.com
# Evil jerks with never-ending "top X" lists / "more from around the web" / etc
0.0.0.0 zergnet.com
0.0.0.0 www.zergnet.com
0.0.0.0 taboola.com
#! /usr/local/bin/node
// ---[ Dependencies ]------------------------------------------------------------------------------
var dgram = require("dgram");
var mdns = require("mdns");
// ---[ Config ]------------------------------------------------------------------------------------
var mdnsTimeout = 20000; // ms
package main
// Originally ripped from here: http://www.ostree.org/code-snippet/91/csv-comma-separated-values-example-in-golang and modified.
import (
"encoding/csv"
"fmt"
"os"
"unicode/utf8"
"strings"
package com.expantra.buzhash;
/**
* Created by josh on 16/04/2014.
* Not thread-safe, not nothin not nohow :)
*/
public class BuzHash {
// via sublime text column mode, and cat /dev/random | hexdump
static private final int[] randomInts = {
@sophistifunk
sophistifunk / SaveFile.java
Created April 22, 2014 14:08
Simple, poorly factored proof of concept for de-duping data store algorithm.
package com.expantra;
import com.expantra.buzhash.BuzHash;
import javax.xml.bind.DatatypeConverter;
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import static java.lang.System.out;
// Calc whole pixel widths using Bresenham's line algorithm (useful thing, innit?)
function distributeWidthAsColumns(width, numColumns) {
var columnWidths = [];
var columnWidthIdeal = width / numColumns;
var totalWholePixels = 0;
var errorTotal = 0;
var pixelWidth = Math.floor(columnWidthIdeal);
var errorPerColumn = columnWidthIdeal - pixelWidth;
@sophistifunk
sophistifunk / regex
Created September 25, 2012 12:55 — forked from anonymous/regex
regex
String inputLine = "append \"bow wow wow yippee-o yippee-ay\" dir1/dir2/file.txt";
Pattern regex = Pattern.compile("^(\\w+)\\s+\"(.*?)\"\\s+([\\w.\\/]+)$");
Matcher m = regex.matcher(inputLine);
String cmd = m.group(1); // append
String data = m.group(2); // snooplish
String path = m.group(3); // What's left
@sophistifunk
sophistifunk / hosts
Created September 5, 2012 02:21
Hosts file additions to block tracking, ads, and evil
#general tracking sites, ad servers, and general evil pulled from chrome tracking graph plugin
127.0.0.1 buysellads.com
127.0.0.1 newrelic.com
127.0.0.1 polldaddy.com
127.0.0.1 quantserve.com
127.0.0.1 googlesyndication.com
127.0.0.1 google-analytics.com
127.0.0.1 chartbeat.com
127.0.0.1 netshelter.net
127.0.0.1 skimresources.com