Skip to content

Instantly share code, notes, and snippets.

Zeyi (Rice) Fan fanzeyi

Block or report user

Report or block fanzeyi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mdo
mdo / 00-intro.md
Last active Jun 3, 2020
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.
View 00-intro.md

Ikea Bekant standing desk with Gerton table top

@danielrw7
danielrw7 / replify
Last active Jun 10, 2019
replify - Create a REPL for any command
View replify
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
View did-you-know-re.py
from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()
@gnarmis
gnarmis / gist:0d08ad5603014efea52f
Last active Aug 29, 2015
Swift on the Command Line
View gist:0d08ad5603014efea52f
So, this is where swift lives, after you've installed XCode 6 Beta:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Also, there's a directory named swift which has various libraries:
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
To start playing in a terminal:
@felixrabe
felixrabe / string-utils.coffee
Last active Jun 25, 2018
CoffeeScript: String.startsWith() and String.endsWith()
View string-utils.coffee
# http://stackoverflow.com/a/646643
String::startsWith ?= (s) -> @slice(0, s.length) == s
String::endsWith ?= (s) -> s == '' or @slice(-s.length) == s
View .vimrc
" Zeray Rice's New Vimrc
" Created: Augest 24, 2013
" ===============
" Vundle
" ===============
set nocompatible
filetype off
@jirutka
jirutka / rules-both.iptables
Created Sep 18, 2012
Basic iptables template for ordinary servers (both IPv4 and IPv6)
View rules-both.iptables
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@chuangbo
chuangbo / cidr.py
Created Aug 13, 2012
Check if ip in cidr
View cidr.py
#-*- coding:utf-8 -*-
# Author: @chuangbo
# For: @likexian
import socket
import struct
class CIDR:
'''Check if ip in cidr
@CMGS
CMGS / websocket.py
Created May 2, 2012
websocket hybi3 support with gunicorn and gevent
View websocket.py
import collections
import errno
import re
from hashlib import md5, sha1
import base64
from base64 import b64encode, b64decode
import socket
import struct
import logging
@tonyseek
tonyseek / conrotine_task_manager.py
Created Apr 26, 2012
The demo of a corotine task manager.
View conrotine_task_manager.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from Queue import Queue
# ---------------------
# Corotine Task Manager
# ---------------------
You can’t perform that action at this time.