Skip to content

Instantly share code, notes, and snippets.

View qiwihui's full-sized avatar
🦉
Focusing

qiwihui qiwihui

🦉
Focusing
View GitHub Profile
@qiwihui
qiwihui / gist:c0cfb20670294df7cd51
Created March 1, 2016 12:04 — forked from dhbradshaw/gist:e2bdeb502b0d0d2acced
Rename field using migrations in django 1.7
To change a field name in django 1.7+
1. Edit the field name in the model (but remember the old field name: you need it for step 3!)
2. Create an empty migration
$ python manage.py makemigrations --empty myApp
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'),
to the operations list.
@qiwihui
qiwihui / profile_middleware.py
Created March 29, 2016 02:46 — forked from kesor/profile_middleware.py
Django cProfile middleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
import cProfile
import pstats
import marshal
from cStringIO import StringIO
class ProfileMiddleware(object):
def __init__(self):
if not settings.DEBUG:
@qiwihui
qiwihui / index.html
Created August 10, 2017 06:34
vJmoKo
<header>
<div class="title">
<h1>over</h1>
<h1>five</h1>
</div>
</header>
@qiwihui
qiwihui / main.go
Created October 23, 2017 07:07
Extract table names from SQL statement
// Extract table names from SQL statement
package main
import (
"fmt"
"regexp"
)
// extractTableNames from sql statement
@qiwihui
qiwihui / hans.md
Last active October 26, 2017 02:29
在Mac上使用 hans+shadowsocks-libev 翻墙

简介

最近因为电信白名单,国外的服务器只能ping通,高端口基本无法使用,一种解决办法是将翻墙服务启动在80,443等可访问端口,另一种就是本文方法,将数据包封装在ping包中。

使用 hans 这个项目结合 shadowsocks-libev 翻墙。

安装

服务器端

@qiwihui
qiwihui / ss-ipv6.md
Created October 26, 2017 08:30
使用shadowsocks-libev访问IPV6资源
  1. 确认服务器支持IPV6
# ping6 ipv6.google.com
PING ipv6.google.com(nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e)) 56 data bytes
64 bytes from nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e): icmp_seq=1 ttl=53 time=1.61 ms
64 bytes from nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e): icmp_seq=2 ttl=53 time=1.58 ms
64 bytes from nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e): icmp_seq=3 ttl=53 time=1.66 ms
64 bytes from nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e): icmp_seq=4 ttl=53 time=1.51 ms
64 bytes from nrt12s14-in-x0e.1e100.net (2404:6800:4004:81b::200e): icmp_seq=5 ttl=53 time=1.64 ms
@qiwihui
qiwihui / django_docs.md
Created December 14, 2017 06:17 — forked from codingjoe/django_docs.md
Build Django docs like a pro!

Build Django docs like a pro!

Sphinx config

docs/conf.py

import importlib
import inspect
import os
import sys
@qiwihui
qiwihui / osx-for-hackers.sh
Last active December 18, 2017 06:19 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@qiwihui
qiwihui / RSS2InoReader.js
Last active September 28, 2018 02:30
订阅 知乎专栏,简书和Medium
javascript: (
function () {
var u = 'https://www.inoreader.com/?add_feed=';
var l = location;
c = l.pathname.split('/')[1];
if (l.host == 'medium.com') {
u += l.protocol + '//' + l.host + '/feed/' + c;
} else if (l.host == 'zhuanlan.zhihu.com') {
u += l.protocol + '//' + l.host + '/' + c;
} else if (l.host == 'www.jianshu.com') {
@qiwihui
qiwihui / delete_exmail.py
Last active February 1, 2018 08:38
批量删除腾讯企业邮箱邮件
#!/usr/local/bin/python
# coding: utf-8
import imaplib
import time
import re
# 拆分删除列表,一次性标记删除1000个
# 参考:
# 1: http://www.lolizeppelin.com/2016/12/14/python-imap-delete/