Skip to content

Instantly share code, notes, and snippets.

View leigh-johnson's full-sized avatar
💜

Leigh Johnson leigh-johnson

💜
View GitHub Profile
@leigh-johnson
leigh-johnson / README.md
Last active October 10, 2017 04:23 — forked from jefffriesen/README.md
US Zip Codes

This is a d3.js visualization of US zip codes.

Original zip code dataset from Geocommons.

5MB shapefile with properties such as zipcode, state, name, population, area, more.

http://geocommons.com/overlays/54893 (Thank you Bill Greer)

This converts it nicely:

@leigh-johnson
leigh-johnson / https.js
Last active May 23, 2017 17:35
Quick and dirty HTTPS servers (Python 3+ and NodeJS 6.9.1+)
const https = require('https');
const fs = require('fs');
// Do you need to create a self-signed certificate?
// $ brew install openssl
// $ openssl req -new -x509 -keyout localhost.key -out localhost.crt -days 365 -nodes
// Do you need a certificate signed by a trusted authority?
// Check out https://letsencrypt.org/getting-started/
@leigh-johnson
leigh-johnson / gist:7b62ecb6515a9e62da142a3686fab3c4
Created May 17, 2017 02:50
Awk snippet: get the filename of each file from a space-separated list of full paths
awk 'BEGIN {FS="/"; RS=" ";}{print $NF;}')
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'

Keybase proof

I hereby claim:

  • I am leigh-johnson on github.
  • I am grepleigh (https://keybase.io/grepleigh) on keybase.
  • I have a public key whose fingerprint is 1D05 53C3 A693 196D 4557 077C E357 E84A 7566 C03F

To claim this, I am signing this object:

@leigh-johnson
leigh-johnson / main.js
Created March 29, 2017 23:52
country code to currency symbol map
export default
{ "AED": "د.إ"
, "AFN": "؋"
, "ALL": "L"
, "ANG": "ƒ"
, "AOA": "Kz"
, "ARS": "$"
, "AUD": "$"
, "AWG": "ƒ"
, "AZN": "₼"
from itertools import product
import requests
import time
def capitalizations(str):
'''Return a list of the different ways of capitalizing the letters in
string str.
>>> capitalizations('dog')
['DOG', 'DOg', 'DoG', 'Dog', 'dOG', 'dOg', 'doG', 'dog']
18289 8489
832238743 748090424 115924792 157274641 362221385 401041993 640750 191479287 193228427 472408717 650884680 996475446 389896935 814422776 758430198 992968250 408691357 211947855 262745683 120860294 747517710 973634758 575677512 358304595 881038215 218251575 520684982 401253881 368944078 341572273 567872304 878330446 220823388 793887647 457241339 268823367 876841713 245625346 700280008 794037258 139675955 126044700 667207337 878713729 595491587 471296567 700050716 432635388 865033760 549667364 861366717 952162594 633560949 630919140 359266934 207867018 729953067 746978957 713726648 741082695 271107135 897710571 987134721 317160400 276964734 599572026 257930587 169247719 469618300 370556683 797735349 768019608 764851768 232619696 285915442 212925096 463726450 233213129 881173110 728158099 709909129 589177134 452076839 857071794 278687452 43288210 378664272 44302701 619014221 194706550 248365329 34564332 663491503 735565044 963375178 275414552 936677458 638864564 770500182 603157272 16272674 270834623
@leigh-johnson
leigh-johnson / zenity-cofigured-multiboot-drive.sh
Created December 18, 2016 01:40
Script that installs a zenity-based tool for adding ISOs to a multiboot usb
#! /bin/bash
exec >& >(tee -a /tmp/debog-install-depot-multisystem.txt)
# │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
# │ install-depot-multisystem.sh │
# │ écrit par François Fabre │
# │ MultiSystem LiveUSB │
# │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
#Mr Fabre François @frafa
@leigh-johnson
leigh-johnson / state-definition.js
Created December 6, 2016 03:57
Example of resolving a dataset before a controller is initialized
// UserStateDefinition.js
{
name: 'users'
url: '/users'
template: 'users.html'
controller: 'UsersController',
resolve: {
usersDataset: ['UserService', function(service){ // any injectable dependency may be used here!
return service.get(); // UserService.get() returns a promise
}]