Skip to content

Instantly share code, notes, and snippets.

@nicksnell
nicksnell / .eslintrc.js
Created October 23, 2017 15:50
ESLint setup
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
extends: 'standard',
plugins: [
'html'
],
@nicksnell
nicksnell / bbc_radio
Last active August 29, 2015 14:15 — forked from ajtucker/bbc_radio
Command line tool to get the radio station urls...
#!/usr/bin/python
import sys
from urllib2 import urlopen
from ConfigParser import ConfigParser
from StringIO import StringIO
stations = {
'radio1': '57286085',
'radio2': '57286086',
@nicksnell
nicksnell / test.php
Created February 3, 2015 11:32
Password hashing with pbkdf2 hmac, expected output is: 2258da2b7b0bf789df92dd56bec9eeda3b42d5e9cfe7ea311ed01c84f7cd2734
<?php
$hash = hash_pbkdf2('sha256', 'example', 'some salt', 100000);
echo $hash;
?>
@nicksnell
nicksnell / osx-stop-host-renaming.sh
Created November 24, 2014 09:54
Stop annoying OSX renaning of computer hostname :|
sudo /usr/libexec/PlistBuddy -c "Add :ProgramArguments: string --no-namechange" /System/Library/LaunchDaemons/com.apple.discoveryd.plist
@nicksnell
nicksnell / osx-setup.md
Last active December 4, 2015 23:37
Script for setting up Homebrew and a bunch of apps

OSX Setup

  1. Software update
  2. Setup XCode
  3. Install Oh-my-ZSH

curl -L http://install.ohmyz.sh | sh

  1. Generate SSH keys
  2. Install Dotfiles
@nicksnell
nicksnell / webfaction-mongo-restart.sh
Created September 3, 2014 21:16
restart script for mongo on webfaction
#!/bin/bash
$HOME/webapps/mongo_db/bin/stop
sleep 4
$HOME/webapps/mongo_db/bin/start
@nicksnell
nicksnell / webfaction-mongo-stop.sh
Created September 3, 2014 21:15
stop script for mongo on webfaction
#!/bin/sh
PREFIX=$HOME/webapps/mongo_db
kill -2 `cat $PREFIX/data/mongod.lock`
@nicksnell
nicksnell / webfaction-mongo-start.sh
Created September 2, 2014 22:00
start script for mongo on webfaction
#!/bin/sh
PREFIX=$HOME/webapps/mongo_db
$PREFIX/mongodb-linux-x86_64-2.6.3/bin/mongod --auth --dbpath $PREFIX/data/ --port <some port> --fork --logpath=$HOME/logs/user/mongod.log
@nicksnell
nicksnell / tiler.py
Created July 25, 2014 17:26
Create a mosaic of tiles
from PIL import Image, ImageOps
import requests
class Tiler(object):
def __init__(self, images, rows=4, tile_size=(135, 135)):
self.images = images
self.rows = rows
self.tile_size = tile_size
@nicksnell
nicksnell / djangocms_clean_placeholders.py
Created February 26, 2014 12:23
Utility to clear our unused Django CMS placeholder data from database - USE AT OWN RISK.
"""Utility to clear our unused Django CMS placeholder data from database"""
# Nick Snell <[email protected]>
# WARNING; IS A DISTRUCTIVE OPERATION (Obviously.)
from django.template import TemplateDoesNotExist
from cms.models.pagemodel import Page
from cms.utils.plugins import get_placeholders