Skip to content

Instantly share code, notes, and snippets.

View mildmojo's full-sized avatar
💃
Not much. You?

Tim mildmojo

💃
Not much. You?
View GitHub Profile
@mildmojo
mildmojo / highlight-forced-tweets.css
Created January 20, 2017 20:17
Highlight tweets from a user you don't follow
/*
Highlights in red, shrinks text, converts text to grey, and adds "NOT FOLLOWING" before username.
The user ID used here is for @POTUS, which will one day become @POTUS45.
Designed to help highlight tweets forced into your timeline by Twitter. Narrow execution.
*/
@-moz-document domain('twitter.com') {
.tweet[data-user-id="822215679726100480"][data-you-follow=false] {
background-color: #FDD;
color: grey;
@mildmojo
mildmojo / teensyduino_xinput.diff
Created August 10, 2016 01:00
Diff on Arduino 1.6.9 + TeensyDuino 1.29 adding XInput support per http://www.zlittell.com/2015/07/fightstick/
diff -ruw a2/arduino-1.6.9/hardware/teensy/avr/boards.txt arduino-1.6.9/hardware/teensy/avr/boards.txt
--- a2/arduino-1.6.9/hardware/teensy/avr/boards.txt Tue Aug 9 20:50:12 2016
+++ arduino-1.6.9/hardware/teensy/avr/boards.txt Mon Aug 8 05:20:42 2016
@@ -65,6 +65,9 @@
teensy31.menu.usb.flightsimjoystick=Flight Sim Controls + Joystick
teensy31.menu.usb.flightsimjoystick.build.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy31.menu.usb.flightsimjoystick.fake_serial=teensy_gateway
+teensy31.menu.usb.xinput=[MSF] Shoryuken! (XINPUT DEVICE)
+teensy31.menu.usb.xinput.build.usbtype=USB_XINPUT
+teensy31.menu.usb.xinput.fake_serial=teensy_gateway
@mildmojo
mildmojo / setup_teardown_helper.js
Last active November 3, 2015 18:16
Jasmine-node helpers: per-describe `setup` and `teardown` functions
/*
setup_teardown_helper.js
Setup and teardown helper functions for jasmine-node (jasmine 1.3).
IMNSHO, every damn test runner should provide the following hooks:
startup (global; runs once before any setups or specs begin)
setup (describe-local; runs once before any specs in a `describe`)
beforeEach (describe-local; runs once before each spec in a `describe`)
afterEach (describe-local; runs once after each spec in a `describe`)
@mildmojo
mildmojo / gulpfile.js
Created May 29, 2015 16:35
Make gulp look more like rake
/*
gulpfile.js
Gulp lacks a native way to provide task documentation or break tasks
into multiple files. This gulpfile reads './tasks/*.js' and can list
all available tasks with `gulp` or `gulp tasks`. If you set a .desc
property on your task functions, those descriptions will show up in
`gulp tasks` output. Tasks without descriptions will be omitted
from this output (but still visible with `gulp -T`).
@mildmojo
mildmojo / heartbeat.js
Last active October 21, 2015 21:52
Heartbeat.js - find event loop blocking code by looking for blown timeouts
// Heartbeat log script for node.js. Use this to sniff out code that blocks
// your event loop; heartbeats will take longer if the event loop is
// blocked.
// Just require('./heartbeat.js'); ==OR== require('./heartbeat.js')(3000);
module.exports = go;
var DEFAULT_HEARTBEAT_MS = 2000;
var startedAt, loop;
go();
@mildmojo
mildmojo / LexitronCreateAxes.cs
Last active August 29, 2015 14:08
Bolt-on Lexitron arcade cabinet compatibility for Unity
/* LexitronCreateAxes.cs
*
* 1. Place this script in your project's Assets/Editor/ directory.
* 2. Open Edit -> Project Settings -> Input and verify that there are four "Lexitron" axes.
* 3. Delete this script.
*
* All of this code shamelessly swiped from:
* http://www.plyoung.com/blog/manipulating-input-manager-in-script.html
* http://answers.unity3d.com/questions/26994/running-a-script-when-unity-starts.html
*/
@mildmojo
mildmojo / tls_creds.js
Last active July 6, 2017 03:22
Some basic NodeJS TLS security options
var tls = require('tls');
var constants = require('constants');
// Disable client session renegotiation, no known use case per:
// https://www.ssllabs.com/downloads/SSL_TLS_Deployment_Best_Practices_1.3.pdf
// By virtue of require() caching, this will affect all code using `tls`.
tls.CLIENT_RENEG_LIMIT = 0;
// Based on whitelist proposed at: https://bugs.ruby-lang.org/issues/9424
// And SSL/TLS Best Practices: https://www.ssllabs.com/downloads/SSL_TLS_Deployment_Best_Practices_1.3.pdf
@mildmojo
mildmojo / rotate_desktop.sh
Created June 18, 2014 06:47
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@mildmojo
mildmojo / permission_to_leave.js
Created November 2, 2013 00:22
Saves your bacon when you're using jsbin.com with OS X and try to Cmd+Left to go to the beginning of the line.
// ==UserScript==
// @name Permission to Leave
// @namespace permission.to.leave
// @description Prompts before leaving the page. Good for OS X users who press Cmd+Left while editing text to go to the start of the line, only to find the browser goes back a page instead.
// @version 1.0
// @grant none
// @include http://edit.script.and
// @include https://add.target.sites.here
// @include https://twitter.com
// ==/UserScript==
@mildmojo
mildmojo / haters.rb
Last active December 20, 2015 08:29
Script for pulling out all the Twitter haters blogged at http://gamerfury.tumblr.com (all sorts o' trigger warnings on that one).
#!/usr/bin/env ruby
#
# haters.rb
#
# Finds all the Twitter users posted to http://gamerfury.tumblr.com and prints
# them, newline-delimited, to STDOUT. Require this file in your own script to
# access ScumbagHaterFinder directly.
#
# Tested with Ruby 2.0.0.