Skip to content

Instantly share code, notes, and snippets.

View jasonneylon's full-sized avatar

Jason Neylon jasonneylon

View GitHub Profile
@shahzaibalikhan
shahzaibalikhan / awkings.md
Last active May 15, 2020 12:54
Using AWK to dissect ELB logs

Take slice of logs by time

zgrep 'T18:' -r $PWD >> /tmp/logs

Print logs (time, request_url, elb status, target_status)

awk '{print $2 "\t" $14 "\t" $9 "\t" $10}' /tmp/logs

Filter logs by 5XX status of ELB

@voter101
voter101 / Gulpfile.js
Last active November 29, 2021 01:17
Gulpfile for Rails application with replaced Sprockets with Gulp
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
@pmeenan
pmeenan / user-timing-rum.js
Last active January 18, 2024 23:46
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
@thibautsacreste
thibautsacreste / rack_show_session.rb
Last active March 12, 2021 13:43
Ruby: decode rack session cookie
require 'base64'
require 'cgi'
def show_session(cookie)
Marshal.load(Base64.decode64(CGI.unescape(cookie.split("\n").join).split('--').first))
end
@dholstius
dholstius / download-bfs.R
Created June 21, 2012 00:44
Extended historical queries with the cosm R package
require('cosm')
if (!exists('key')) key <- readline('API key: ')
feed <- getFeed(58537, key)
print(feed$description)
t0 <- Sys.time()
duration <- 60 * 60 * 24 * 7 # one week
z <- getDatapoints(feed, key, datastreams='2h', end=t0, start=t0-duration)
@mbostock
mbostock / .block
Last active March 13, 2024 01:33
Bar Chart with Negative Values
license: gpl-3.0
redirect: https://observablehq.com/@d3/diverging-bar-chart
@whs
whs / imageloader.js
Created April 3, 2011 03:57
libimageloader loads image from photo upload services
/**
* @license The imageloader.js library is licensed under GNU Lesser General Public License v3 or later
*/
(function(){
/**
* TwitPic Image Loader
* Example: ldr = new TwitPicLoader("http://twitpic.com/asdf123");
* @param {string} URL of the TwitPic page. Eg. http://twitpic.com/asdf123
* @constructor
*/