Skip to content

Instantly share code, notes, and snippets.

View theho's full-sized avatar

James Ho theho

View GitHub Profile
@lanius
lanius / link_walking.py
Created April 22, 2011 12:18
Riak's "Links and Link Walking" for Python.
@kageurufu
kageurufu / models.py
Last active June 6, 2021 07:37
PostgreSQL JSON Data Type support for SQLAlchemy, with Nested MutableDicts for data change notifications To use, simply include somewhere in your project, and import JSON Also, monkey-patches pg.ARRAY to be Mutable @zzzeek wanna tell me whats terrible about this?
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer, Column
from postgresql_json import JSON
Base = declarative_base()
class Document(Base):
id = Column(Integer(), primary_key=True)
data = Column(JSON)
#do whatever other work
@davebarkerxyz
davebarkerxyz / tmux_myapp
Last active August 27, 2018 10:12
Scripting tmux to set up my development environment The script opens 3 windows: 1 - a vim session for backend work; 2 - a vim session for frontend work; 3 - split into 2x2, with two bash shells, one postgresql shell and my Python/Flask application running in the fourth pane;
#!/bin/bash
DEV_PATH="~/dev/myapp"
SESSION="myapp"
tmux -2 new-session -d -s $SESSION
# First window (backend dev)
tmux rename-window "Backend"
tmux send-keys "cd $DEV_PATH; vim" C-m
# Frontend window for vim
@dapangmao
dapangmao / s.bash
Last active September 1, 2020 16:28
How to set up a spark cluster on digitalocean
sudo openvpn --config *.opvn
apt-get update
apt-get install vim
wget http://d3kbcqa49mib13.cloudfront.net/spark-1.3.0-bin-hadoop2.4.tgz | tar zxf
hadoop fs -mkdir /spark
hadoop fs -put spark-1.3.0-bin-hadoop2.4.tgz /spark
hadoop fs -du -h /spark
cp spark-env.sh.template spark-env.sh
@cmoore4
cmoore4 / docker-compose.yml
Created October 26, 2015 15:40
Docker-Compose Auto-Scale with Nginx Upstreams
nginx:
image: myclient/nginx
environment:
- HOSTHOST=UBUNTU
- PROXY_PORT=8069
links:
- myservice:myservice
ports:
- "80:80"
- "443:443"
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@johnstcn
johnstcn / ethminer_ubuntu_nvidia.md
Last active October 1, 2022 16:34
NVIDIA/CUDA ethminer setup under Ubuntu Server 16.04

Headless Ethminer (nVidia) Setup Guide

Cian Johnston, July 2017

WARNING: THESE WORDS ARE OLD AND MAY NOT WORK FOR YOU IN THESE NEW AND INTERESTING TIMES.

A couple of weeks ago, I decided I should put my gaming rig to work crypto mining. I did not expect to make any significant profit on this, it was more of a fun project to set up. However, there were a large number of tutorials and guides already out there, and many were more than a year out of date.

This guide assumes the reader already has a crypto wallet set up, is comfortable with Linux and the command line, and knows how to use Google if they run into problems.

The end result is an Ubuntu 16.04 LTS headless server running CUDA ethminer via systemd.

@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active July 15, 2024 19:38
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the