Skip to content

Instantly share code, notes, and snippets.

Avatar
type type type

Beau Gunderson beaugunderson

type type type
View GitHub Profile
@mbostock
mbostock / .block
Last active Feb 8, 2016
Polymaps + D3, Part 2
View .block
license: gpl-3.0
@mbostock
mbostock / .block
Last active Jan 18, 2021
Google Maps + D3
View .block
license: gpl-3.0
@beaugunderson
beaugunderson / .vimrc
Created Jul 31, 2011
Prompt to edit a corresponding .scss file when opening a .css file in vim
View .vimrc
function! EditScss()
" The current file
let file = expand("%")
" The current file's basename plus .scss
let scss = expand("%:r") . ".scss"
" If the file exists
if filereadable(scss)
" Prompt the user and store the user's choice (1-indexed) in a variable
@deoxxa
deoxxa / parallelworlds.json
Created Mar 7, 2013
SimCity (2013) Studies
View parallelworlds.json
// http://worlds.simcity.com/parallelworlds.json
//
// Intercepting this request and changing the "Desc" field does nothing to the
// game's UI. The name in the interface seems to come from looking up the "id"
// field against a list of names stored internally. Probably because of locale
// stuff.
//
// Note the hidden servers!
{
View gist:6481605
[{"index": 0, "id": "<redacted>", "habit": {"week": "2013-08-26", "goal_units": "timedelta", "daily_scores": [{"total_points": 128, "state": 13, "score": 1439, "goal": 720.0, "last_timestamp": "2013-08-26T23:59:00+5:00", "base_points": 25, "day": "monday"}, {"total_points": 125, "state": 13, "score": 1438, "goal": 720.0, "last_timestamp": "2013-08-27T23:59:00+5:00", "base_points": 25, "day": "tuesday"}, {"total_points": 125, "state": 13, "score": 1439, "goal": 720.0, "last_timestamp": "2013-08-28T23:59:00+5:00", "base_points": 25, "day": "wednesday"}, {"total_points": 125, "state": 13, "score": 1430, "goal": 720.0, "last_timestamp": "2013-08-29T23:59:00+5:00", "base_points": 25, "day": "thursday"}, {"total_points": 125, "state": 13, "score": 1440, "goal": 720.0, "last_timestamp": "2013-08-30T23:59:00+5:00", "base_points": 25, "day": "friday"}, {"total_points": 125, "state": 13, "score": 1434, "goal": 720.0, "last_timestamp": "2013-08-31T23:59:00+5:00", "base_points": 25, "day": "saturday"}, {"total_points": 1
@trevnorris
trevnorris / perf-flame-graph-notes.md
Last active Jul 21, 2021
Quick steps of how to create a flame graph using perf
View perf-flame-graph-notes.md

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@trevnorris
trevnorris / all-my-knowledge.md
Last active Dec 9, 2017
Here's a rundown of everything I use to do performance analysis in Node.
View all-my-knowledge.md

Introduction

Here is a collection of tips and tricks I've picked up about doing performance analysis on Node. Included is a build script that should get a base install of Ubuntu fully functional and ready for all the things we'll be going through.

The script pulls a lot of code from the latest master of each repository. So it's possible that something may fail, but to date I haven't had any issues.

First, go ahead and run the script. Then go take a nice long break. It'll

View app_auth.js
#!/usr/bin/env node
var inquirer = require("inquirer"),
request = require("request"),
qs = require('querystring'),
fs = require('fs');
var request_token_url = 'https://api.twitter.com/oauth/request_token',
access_token_url = 'https://api.twitter.com/oauth/access_token';
@airhadoken
airhadoken / twittercard.js
Last active Dec 13, 2020
Making twitter cards and also getting data back from them later, in NodeJS.
View twittercard.js
var T = require("twit");
var Q = require("q");
// key and secret for Twitter for iPhone.
// A whitelisted app is needed to access the cards API; you can't just create your own currently.
var TWITTER_CONSUMER_KEY = "IQKbtAYlXLripLGPWd0HUA";
var TWITTER_CONSUMER_SECRET = "GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU";
// These you will have to fill in yourself by authorizing Twitter for iPhone for your account.
// How to get the access tokens through OOB authorization is outside the scope of this snippet.
var TWITTER_ACCESS_TOKEN = "";
@SimplGy
SimplGy / renameToHash.sh
Last active Feb 21, 2021
Rename files with a hash based on their contents. eg: `abc.jpg` to `3101ace8db9f.jpg`. Useful for detecting duplicates.
View renameToHash.sh
#!/bin/bash
# TODO: skip tiny files (so small they couldn't be photos)
# TODO: make sure sym links and other file system oddities are handled
# TODO: look at paralellization for perf boost
#
# Constants
#
CHAR_COUNT=12
BLOCK_COUNT=6