Skip to content

Instantly share code, notes, and snippets.

@jmerrifield
jmerrifield / README.md
Created June 24, 2015 18:52
Be careful DRYing up test code

A test for a module performing trivial transformation on data from an external service:

it('returns the first element in the response', function () {
  var serviceResponse = [{a: 1}]
  serviceStub.returns(serviceResponse)
  
  expect(subject()).to.equal(serviceResponse[0])
})
@max-mapper
max-mapper / exif-extract.rb
Created June 20, 2011 21:06
grab exif data from jpgs and emit geojson coordinates using ruby
require 'json'
require 'base64'
require 'exifr'
def to_decimal(dms)
dms[0].to_f + dms[1].to_f / 60 + dms[2].to_f / 3600
end
def to_geojson(exif)
lat_exif = exif.gps_latitude
@mheadd
mheadd / septa.md
Created June 23, 2011 16:52
SEPTA Bus / Train API info
@rmcgibbo
rmcgibbo / install.sh
Last active October 9, 2015 03:48
Install Python / numpy / scipy / ipython / matplotlib / umfpack / pytables from source
#!/bin/bash
# =================================================================
# Install a full scientific python stack from source, for Ubuntu, with
# python 2.7.3 (tested on a totally fresh Ubuntu12.04-amd64). Requires
# sudo for apt-getting dependencies like libatlas, Tk, etc
# =================================================================
# packages pulled from PyPI are currently
# scipy 0.10.1
@maguec
maguec / gist:5177489
Created March 16, 2013 17:50
Notes on installation of graphite
sudo apt-get install python-cairo python-memcache python-sqlite memcached python-django-tagging python-django libapache2-mod-python apache2 libapache2-mod-wsgi git-core python-pyparsing python-tz libdbd-mysql-perl libmysqlclient-dev libmysqlclient18 mysql-client-5.5 mysql-client-core-5.5 mysql-common python-mysqldb
mkdir -p /var/tmp/software
cd /var/tmp/software
git clone https://github.com/graphite-project/graphite-web.git
git clone https://github.com/graphite-project/carbon.git
git clone https://github.com/graphite-project/whisper.git
for i in whisper carbon graphite-web; do
@felixge
felixge / image_resize.js
Created May 20, 2011 18:07
On demand image resizing with node.js in
// Usage: http://localhost:8080/image.jpg/100x50
var http = require('http');
var spawn = require('child_process').spawn;
http.createServer(function(req, res) {
var params = req.url.split('/');
var convert = spawn('convert', [params[1], '-resize', params[2], '-']);
res.writeHead(200, {'Content-Type': 'image/jpeg'});
convert.stdout.pipe(res);
@jmcnevin
jmcnevin / deploy.rb
Created March 24, 2011 19:04
Rails 3, Devise, Resque, Capistrano, and static resque-web assets
# I'm currently using Devise along with Resque's resque-web UI. I have resque-web running
# as an embedded rack application inside of my main Rails app with the following line in my
# my routes.rb file:
#
# mount Resque::Server.new, :at => "/resque"
#
# This makes resque-web expect its static assets to be found in your site's /public/resque
# folder, where they won't be.
#
# The answer is to copy or symlink to those assets which are found in the gem's own public
@brobertsaz
brobertsaz / serversetup.md
Last active July 6, 2020 08:56
Ubuntu 12.04 Ruby, Rails, Nginx, Unicorn

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@sbennett33
sbennett33 / howto.md
Last active September 30, 2021 19:17
Newsboat + mpv + youtube-dl

Install Tools

Install Newsboat:

$> brew install newsboat

Install mpv:

$> brew install mpv
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host