Skip to content

Instantly share code, notes, and snippets.

View joews's full-sized avatar

Joe Whitfield-Seed joews

View GitHub Profile
@joews
joews / README.md
Last active January 11, 2024 14:22
Animated d3 word cloud
@joews
joews / README.md
Created April 14, 2014 18:19
Shink Raspberry Pi root partition (Arch) with OSX

Shink Raspberry Pi root partition (Arch) with OSX

A reminder of how to shrink the root partition of a fresh Arch Linux installation on a Raspberry Pi.

I wanted to make more room on a 4GB SD card for a Linux From Scratch build, so I resized the root partition down to 700mb and created a new 3GB logical partition next to it.

I didn't have another Linux machine available, so I used OSX Mavericks to write the original Arch image to the SD card and do the initial filesystem resize. Everything else was done on the Pi itself.

@joews
joews / gensim_tutorials.py
Created February 11, 2014 20:46
Gensim tutorials
from gensim import corpora, models, similarities
import logging
# Working through @RadimRehurek's Gensim tutorials: http://radimrehurek.com/gensim/index.html
#logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
# Tutorial 1: Acquire and normalise texts, build and serialise dictionary and corpus
# http://radimrehurek.com/gensim/tut1.html
@joews
joews / dir.sh
Created July 16, 2014 15:54
Get directory of bash script
dir=$(cd $(dirname $0) && pwd)
@joews
joews / express-http2.js
Created June 4, 2016 22:42
Minimal express.js app with HTTP/2
const spdy = require("spdy");
const keys = require("spdy-keys");
const express = require("express");
const app = express();
app.get("*", (req, res) => {
res.send("aloha");
})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// http://stackoverflow.com/q/29747951/2806996
var transducers = require('transducers.js');
var csp = require('js-csp')
// Make transducer
var xAdd10 = transducers.map(function (x) {
return x + 10;
});
// Make a channel, using the transducer
@joews
joews / fa-content.js
Created February 2, 2015 17:34
Get content string for a Font Awesome class (stylesheet known)
function getContent(faClass) {
var styleSheet = document.styleSheets[1];
var selector = '.' + faClass;
var rules = [].filter.call(styleSheet.rules, function(rule) {
return rule.selectorText && (rule.selectorText.split('::')[0] === selector)
});
if(rules.length > 0) {
return rules[0].style.content
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
//
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<canvas id="canvas"></canvas>