Skip to content

Instantly share code, notes, and snippets.

View mtodd's full-sized avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
@gotascii
gotascii / Cakefile
Created September 14, 2011 13:35
Node in Max/MSP
# Compile the coffee in bare joined mode.
{exec, spawn} = require 'child_process'
fs = require 'fs'
util = require 'util'
print = (data) ->
console.log data.trimRight()
task 'build', 'Compile Coffeescript to Javascript', ->
@tvandervossen
tvandervossen / gist:1231476
Created September 21, 2011 07:33
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@vmg
vmg / sparc.c
Created November 15, 2011 23:03
Sparks in C
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
int main
(int argc
,char *ac []){int i, count = argc - 1;
double * dvalues=malloc(01- 01+count*
sizeof(double)+1); double mi=DBL_MAX,ran=.0,ma =DBL_MIN,mo;for(i= 00; argc>1
&&i<count;i=i+8-7) {double val = atof(ac[i+1]) ;if(23&&val<mi)mi= val;if(val
@raggi
raggi / mysql2_column_cache.rb
Created March 16, 2012 00:48
Mysql2 Column Cache for Rails 3.0.12
# = MONKEY PATCH: Memoize Mysql2 Columns
#
# Reduces SHOW FIELDS selects in production to essentially 0 calls.
#
# == Reason:
#
# * We have some pages that are (with rails 3.0.12) generating nearly 1200 SHOW
# FIELDS sql statements.
# * These come from ActiveRecord::Associations during complex join semantics.
# * Esentially, through some relations, Arel::Table instances don't have
@cander
cander / basic.sh
Created May 25, 2012 04:47
Bourne Basic - a BASIC interpreter implemented (painfully) in pure Bourne shell
#!/bin/sh
#
#
# From: allbery@ncoast.UUCP (allbery@ncoast.UUCP)
# Subject: bournebasic
# Newsgroups: comp.sources.misc
# Date: 1987-08-18 18:54:12 PST
#
# Here's a useful BASIC interpreter written in Bourne shell.
# There's no manual but this demo shows the most salient features:
@davidcelis
davidcelis / zelda-battery.sh
Created December 18, 2012 00:28
Output a Zelda-style heart meter for your MacBook's battery level. On the command line. Based on an idea from @stephencelis, executed by myself. For a tmux version, see https://gist.github.com/4324139
#!/usr/bin/env zsh
#
# Works best with blinking text; the last heart will blink
# when you have less than 25% of your battery life remaining.
BATTERY="$(pmset -g ps | awk 'NR==2' | perl -pe 's/.*?(\d+)%.*/\1/')"
if [[ $BATTERY -lt 25 ]]; then
echo "\e[5;31m♥\e[0;31m♡♡\e[0m"
elif [[ $BATTERY -lt 50 ]]; then
require 'connection_pool'
require 'redis'
require 'metriks'
class RedisClientWrapper
def initialize(options)
@options = options.delete(:pool)
@pool = ConnectionPool.new(@options) do
::Redis.new(options)
end
@harrisj
harrisj / tweet_signatures.md
Last active November 24, 2020 11:03
Tweet Signatures: a simple solution for thwarting forged tweets

A Simple Solution for Faked Tweets

Recently, a somewhat large selection of my timeline was shocked by the discovery that it's simple to make a fake-looking tweet on the web. Some feared it would be only a matter of time before some news organization is suckered by a fake tweet that seems to come from a real source.

Luckily, the solution already exists, and it's something you already use constantly: GNU PrivacyGuard signatures Here is an approach for verifying a tweet is authentic and hasn't been tampered with that is so simple even @KimKardashian could figure it out. To get started, we just need to do a little setup first:

  1. Of course, you have already installed GnuPG for your own use, generated a keypair and uploaded it to a keyserver so that other people can look it up. Its email address must be publicly listed in your twitter profile.
  2. Then, you must collect the public keys of the people you fo
@skalnik
skalnik / bicycles.md
Last active December 19, 2015 11:49
Rapha Rising

To celebrate the 100th edition of the Tour de France, and the mountains that have made it legendary, Rapha and Strava are proud to announce Rapha Rising: La Centième.

In the week which starts on Bastille Day (14th-21st July), Rapha is challenging participating riders to climb the combined height, from sea level, of the Peyresourde, Ventoux and Col de Sarenne, all of which feature in this year’s race. The Peyresourde is one of the giants of the Pyrenees, which featured in the Tour's first excursion into the bear-infested mountains in 1910, while Mont Ventoux, the Giant of Provence, first appeared in the Tour in 1951, a year before Alpe d'Huez. Together, they've been the sites of some of the Tour's most famous battles. The Col de Sarenne, however, has never been scaled in the Tour. It’s a little known col, 1,999m high, that the pros will climb this year, having first climbed the Alpe. Descending on a road resurfaced especially for them, th

@toolmantim
toolmantim / Makefile
Last active December 5, 2022 23:14
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch