Skip to content

Instantly share code, notes, and snippets.

View solos's full-sized avatar
🎶
Listening music

solos

🎶
Listening music
View GitHub Profile
@solos
solos / pylons_jsonify.py
Created May 13, 2012 02:21 — forked from EnigmaCurry/pylons_jsonify.py
Pylons jsonify decorator
# A fixed @jsonify decorator for Pylons that allows for
# class implemented __json__ serializers
from decorator import decorator
from pylons.decorators.util import get_pylons
import warnings
import json
import logging
log = logging.getLogger(__name__)
@solos
solos / gist:2851025
Created June 1, 2012 10:26
google收录的敏感词
@solos
solos / china.json
Created August 9, 2012 02:43 — forked from biovisualize/index.html
Zoom/pan map
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@solos
solos / redisdns.py
Created August 11, 2012 12:55 — forked from wheresalice/redisdns.py
Python DNS server with Redis backend
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket
@solos
solos / .Xresources-hybrid
Created September 5, 2012 01:42 — forked from w0ng/.Xresources-hybrid
Terminal colourscheme for use in hybrid.vim
! colours for hybrid.vim (copied from Tomorrow-Night)
#define t_background #1d1f21
#define t_current_line #282a2e
#define t_selection #373b41
#define t_foreground #c5c8c6
#define t_comment #969896
#define t_red #cc6666
#define t_orange #de935f
#define t_yellow #f0c674
#define t_green #b5bd68
@solos
solos / gist:3931339
Created October 22, 2012 12:46
Awesome Python libs
@solos
solos / cfz.py
Created November 13, 2012 12:07
for cfz two thing
from time import time
def check_fit(letter_pool, word):
for i in word:
if i in letter_pool:
letter_pool[i] -= 1
if letter_pool[i] < 0:
return 0
else:
return 0
return 1
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
@solos
solos / config.py
Last active December 11, 2015 01:38
hosts keeper
#!/usr/bin/env python
NAMESERVERS = ['8.8.8.8']
DOMAINS = [
"webcache.googleusercontent.com",
"0.docs.google.com",
"0.drive.google.com",
"1.docs.google.com",
"1.drive.google.com",

Based on installing Ubuntu 10.04 (lucid) and cloning the live environment (calling local environment dev.jsbin.com)

Add core packages:

sudo apt-get install libpcre3-dev build-essential libssl-dev
sudo apt-get install git-core
sudo su -
mkdir pkgs && cd pkgs
wget http://nginx.org/download/nginx-1.0.0.tar.gz