Skip to content

Instantly share code, notes, and snippets.

View crccheck's full-sized avatar

Chris Chang crccheck

View GitHub Profile
@crccheck
crccheck / web.py
Last active July 19, 2016 21:03
Single file Django project
#!/usr/bin/env python
"""
Usage: ./web.py [command]
Arguments:
command The manage.py command to run (default: runserver)
"""
import os
import sys
@crccheck
crccheck / runtests.py
Created June 10, 2015 03:03
Run Django tests using Nose
#!/usr/bin/env python
"""
HACK to support the Django + nose without django-nose.
Built based on documentation from:
* https://docs.djangoproject.com/en/1.8/topics/testing/advanced/#using-the-django-test-runner-to-test-reusable-applications
* http://nose.readthedocs.org/en/latest/usage.html#basic-usage
"""
import sys
@crccheck
crccheck / README.md
Last active August 29, 2015 14:20
Isomorphic Ajax.js hell

Picking a testable ajax library for react (using jest)

Here are some examples of doing a GET request against a resource and getting JSON back.

jQuery

Works. Works great. It just brings along a lot of baggage you won't need in a ReactJS app. Removing jQuery will remove over 200KB (unminified/gzipped).

Fetch

@crccheck
crccheck / Makefile
Last active August 29, 2015 14:19
Prometheus+Docker bootstrap
#### PROMETHEUS ##################################
.PHONY: prom
# add-host hack:
# https://github.com/docker/docker/issues/1143#issuecomment-70052272
prom: prom_exp prom_node
-@docker rm -f $@_1 > /dev/null
docker run -d --name $@_1 \
-v ${PWD}/prom/prometheus.conf:/prometheus.conf:ro \
-v ${PWD}/prom/data:/prometheus \
@crccheck
crccheck / README.md
Last active August 29, 2015 14:17
ElasticSearch Cheat Sheet
@crccheck
crccheck / geoize.py
Created December 10, 2014 04:00
geocode and geojson
#!/usr/bin/env python3
"""
Usage: ./2geojson.py [<yaml_file> | <address>]
Requirements:
pip3 install PyYAML geopy
"""
import json
# Invoke cheat
function inv {
# if no parameters, then assume we want to list tasks
if [ -z $1 ]; then
invoke --list
else
# invoke expects --help to be first, so move it if it isn't
local numargs=$#
for ((i=2; i <= numargs ; i++))
do
@crccheck
crccheck / db_cheatsheet.md
Last active December 12, 2023 16:26
Database Cheetsheet
Task Postgres MySQL sqlite
help \? .help
list databases psql -l, \l show databases; .databases
list tables/views/seq \d
list roles \du
list tables \dt .tables
describe table \d <table> .schema
expanded output \x \G
list schemas \dn
@crccheck
crccheck / package managers.md
Last active August 29, 2015 14:01
Rosetta stone for web package managers (not extensive)
command pip bundler npm bower
Init touch requirements.txt bundle init npm init bower init
List installed packages pip freeze or pip list bundle list npm ls -g --depth 0 bower list
Search for a package npm search <name> bower search
Install a package pip install <name> npm install <name> --save-dev bower install <name>
Install everything pip install -r requirements.txt bundle install npm install
List outdated packages pip list --outdated bundle outdated npm outdated
Update everything pip install --upgrade bundle update `npm update --s
@crccheck
crccheck / .jshintrc
Created April 18, 2014 21:27
js hint config for qunit
{
"browser": true,
"strict": false,
"globals": {
"QUnit": false,
"module": false,
"test": false,
"asyncTest": false,
"expect": false,
"start": false,