Skip to content

Instantly share code, notes, and snippets.

View kiruto's full-sized avatar

Yuriel Arlencloyn kiruto

View GitHub Profile
@kiruto
kiruto / isChinaIP.py
Created January 9, 2017 04:23 — forked from xixitalk/isChinaIP.py
算法:判断是否是中国IP
#/usr/bin/python
#coding: utf-8
# file: http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
global_ip_dict = [[[] for col in range(256)] for row in range(256)]
#input:apnic|CN|ipv4|112.0.0.0|4194304|20081215|allocated
#output:addr1,addr2,addr3,addr4,ip_num
def analyseLine(ip_line):
ip_str_list = ip_line.split('|')
@kiruto
kiruto / index.md
Created December 21, 2016 07:13 — forked from mathisonian/index.md
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
# You can swap out the engine for MySQL easily by changing this value
# to ``django.db.backends.mysql`` or to PostgreSQL with
# ``django.db.backends.postgresql_psycopg2``