Skip to content

Instantly share code, notes, and snippets.

View tyrchen's full-sized avatar

Tyr Chen tyrchen

View GitHub Profile
@tyrchen
tyrchen / redis_session_backend.py
Created December 5, 2011 09:14 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(

Django-celery + Redis notes

Installation and Setup

  1. Install redis on OSX (10.7) Lion I used:

     $ brew install redis
    
  2. In the project and virtualenv I wanted to use django-celery in I installed the following.

@tyrchen
tyrchen / README.md
Created November 7, 2012 00:33 — forked from dariocravero/README.md
Save files in Meteor

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
ssh ubuntu@n.n.n.n "bash -s -x" -- <ixgbevf-upgrade.sh
#!/bin/bash
usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A
@tyrchen
tyrchen / README.md
Last active August 29, 2015 15:31 — forked from denji/README.md
Remove WebStorm; PhpStorm; PyCharm; RubyMine; AppCode; CLion, IntelliJ; 0xDBE10 settings and cli-links from Mac OSX

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
@tyrchen
tyrchen / rethinkdb.md
Last active September 2, 2015 22:25 — forked from mblair/rethinkdb.md
An Operator's Look at RethinkDB

An Operator's Look at RethinkDB

Matt Blair - @mattyblair - Flipboard

The Getting Started Experience

  • It's in Homebrew and just runs (relative to, say, HBase): awesome!
  • Having packages for popular Linux distros (I use Ubuntu personally and at work): awesome!
  • Serving the GPG key over HTTP: not so awesome :-/
  • apt-get -y install rethinkdb
  • It didn't start by default- great! I hate when services do this. I then looked at the start script to see how it knew (usually daemons use /etc/default/blah, but it has custom logic to see if there's anything in /etc/rethinkdb/instances.d, which is cool).
@tyrchen
tyrchen / introrx.md
Last active September 7, 2015 00:23 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@tyrchen
tyrchen / rxjs-react.js
Created September 29, 2015 23:33 — forked from nicolashery/rxjs-react.js
Fetching data asynchronously with RxJS and React
import React from 'react';
import _ from 'lodash';
import Rx from 'rx';
import superagent from 'superagent';
let api = {
host: 'http//localhost:3001',
getData(query, cb) {
superagent