Skip to content

Instantly share code, notes, and snippets.

View dogeared's full-sized avatar
🏠
Working from home

Micah Silverman dogeared

🏠
Working from home
View GitHub Profile
@dogeared
dogeared / fake_test.sh
Created May 11, 2017 14:56
Jealous of your friends' internet speed? Just fake it!
#! /bin/bash
# Based on https://www.unknowncheats.me/forum/php/98463-speedtest-real-fake-results-photoshop.html
## httpie (httpie.org - a modern curl replacement) and md5 are required
DOWN="999925"
UP="999794"
PING=1
SERVER=3729
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@dogeared
dogeared / PRAssigned.rb
Last active December 15, 2015 02:59
Show who's assigned to which pull NOTE: you may have to install the json gem if you don't already have it. sudo gem install json
#! /usr/bin/ruby
#
require 'rubygems'
require 'json'
require 'open-uri'
user = 'YOUR GITHUB USERNAME'
pass = 'YOUR GITHUB PASSWORD'
repo = 'workmarket/application'
module.exports = function(data) {
var _data = data
var filter = {
byType: function(query) {
// alter _data
return this
},
byName: function(query) {
// alter _data
"SELECT * FROM meetings WHERE meetingID = '1';"
"SELECT * FROM meetingAddress WHERE meetingID = '1';"
"SELECT * FROM districts WHERE districtID = '1';"
var _ = require('underscore')
var levers = [
{ id: '1', val: 'one'},
{ id: '2', val: 'two'},
{ id: '3', val: 'three'},
]
var ids = ['1', '3']
@dogeared
dogeared / gist:1268518
Created October 6, 2011 20:12
Java copyOfRagne example
import java.util.*;
public class t {
public static void main(String[] args) {
String[] s = {"1", "2", "3"};
String[] t = Arrays.copyOfRange(s, 1, 3);
System.out.println("Length of t: " + t.length);
System.out.println(t[0]);
System.out.println(t[1]);
downloadReport: {
'default': function(reportFile, requestData, callback) {
var file = fs.createWriteStream(requestData.filename);
var downloadUrl = url.parse(requestData.reportingDownloadUrl);
var local = http.createClient(443, downloadUrl.host, secure=true);
requestData.headers['host'] = downloadUrl.host;
var request = local.request('GET', downloadUrl.pathname + downloadUrl.search, requestData.headers);
request.on('response', function (response) {
@dogeared
dogeared / gist:816380
Created February 8, 2011 12:37
Replacement code in NodeService
public String post(Service serviceName, Map<String, String> params) throws IOException {
StringBuffer sb = new StringBuffer();
for (String key:params.keySet()) {
String value = params.get(key);
sb.append(key+"="+value+"&");
}
String urlParameters = sb.substring(0,sb.length()-1);
URL url;
@dogeared
dogeared / gist:793373
Created January 24, 2011 15:26
Node Read/Write Streams
sanitizeFile: function(reportFile, columnAdditions, rowDeletions, callback, retryCount) {
var rs = fs.createReadStream(reportFile, { encoding:'utf8' })
, outputFile = path.dirname(reportFile) + "/" + path.basename(reportFile) + ".sanitized"
, ws = fs.createWriteStream(outputFile);
rs.on('data', function(data) {
var flushed = ws.write(data);
if (!flushed) { rs.pause(); }
});