Skip to content

Instantly share code, notes, and snippets.

View andymason's full-sized avatar
🙂

Andrew Mason andymason

🙂
View GitHub Profile
// This is a port of the NTSC encode/decode shader pair in MAME and MESS, modified to use only
// one pass rather than an encode pass and a decode pass. It accurately emulates the sort of
// signal decimation one would see when viewing a composite signal, though it could benefit from a
// pre-pass to re-size the input content to more accurately reflect the actual size that would
// be incoming from a composite signal source.
//
// To encode the composite signal, I convert the RGB value to YIQ, then subsequently evaluate
// the standard NTSC composite equation. Four composite samples per RGB pixel are generated from
// the incoming linearly-interpolated texels.
//
This file has been truncated, but you can view the full file.
(function e(b, g, d) {
function c(n, k) {
if (!g[n]) {
if (!b[n]) {
var j = typeof require == "function" && require;
if (!k && j) {
return j(n, !0)
}
if (a) {
return a(n, !0)
@andymason
andymason / local.conf
Created November 13, 2017 15:26 — forked from luizmello/local.conf
local.conf for better font rendering on linux
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>serif</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
</match>
@andymason
andymason / Landsat 8 gdal processing
Last active June 19, 2017 13:08
Added projection wrap correction
#! /bin/bash
# Convert Landsat 8 GeoTIFF images into RGB pan-sharpened JPEGs.
#
# Requirements:
# * gdal http://www.mapbox.com/tilemill/docs/guides/gdal/
# * convert (image-magick)
#
# Reference info:
# http://www.mapbox.com/blog/putting-landsat-8-bands-to-work/
@andymason
andymason / GiantBomb HLS Video player.js
Last active March 9, 2017 12:21
Lower CPU usage than Flash player with the benefits of bitrate stream switching.
// How to use:
// 1. Save the bookmarklet
// 2. Go to a Giantbomb video page and click the Bookmarklet
// Bonus. Works on CBSi player so Gamespot video's work too
// ## Bookmarklet
javascript:(function(){var%20videoStream;var%20videoEl;var%20el;var%20vidWrapper=document.querySelector('.av-video-player');if(!vidWrapper||!vidWrapper.dataset.video){console.log('No%20video%20player%20element%20or%20dataset');}var%20videoData=JSON.parse(vidWrapper.dataset.video);videoStream=videoData.videoStreams.adaptive_stream;console.log(videoStream);videoEl=document.createElement('video');videoEl.controls=true;videoEl.style='width:100%;height:100%;position:relative;z-index:999;';vidWrapper.parentNode.replaceChild(videoEl,vidWrapper);el=document.createElement('script');el.addEventListener('load',function(){if(Hls.isSupported()){var%20hls=new%20Hls();hls.loadSource(videoStream);hls.attachMedia(videoEl);hls.on(Hls.Events.MANIFEST_PARSED,function(){videoEl.play();});}},false);el.src='https://cdn.rawgit.com/dailymotion/hls.js/mast
@andymason
andymason / gist:3285675
Created August 7, 2012 14:14
Google Doodle hurdle game
// https://www.google.com/doodles/hurdles-2012
(function () {
var h = void 0,
i = !0,
j = null,
l = !1,
m, n = this,
aa = function (a, b) {
var c = a.split("."),
d = n;
@andymason
andymason / tumblr_image_download.js
Created March 10, 2016 15:54
Grab large image SRC URLs using dev tools.
var imgs = Array.prototype.map.call(document.images, function(img){ return img.src; }).filter(function(src) { return src && /tumblr_/.test(src); });
var bigImgs = imgs.map(function( img ) { return img.replace(/_\d{3,4}/, '_1280',i); });
copy(bigImgs.join('\n'));
@andymason
andymason / https_localhost_composer_preview.md
Last active March 1, 2016 12:10
How to preview localhost content in Composer

Using localhost in composer was an extremely useful way to develop locally while seeing what interactives look like within guardian pages. Unfortunately composer only accepts HTTPS links now, which is a good thing but makes local dev'ing a bit more difficult.

Now to test from localhost you'll need to serve content over a secure connection which means self-signed certs. Here's a quick and dirty way to do that

1# Create a folder to store the keys

  mkdir ~/ssl

2# Generate SSL keys. Enter a password for now, we'll get rid of it next then just skip over all the other questions

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="matrix.js"></script>
<style type="text/css">
rect {
fill: steelblue;
fill-opacity: .8;
var w = 960,
h = 550;
// Matrix Layout
// ------------
var Matrix = function() {
var width = 1,
height = 1,
cols = 4;