Skip to content

Instantly share code, notes, and snippets.

View qunwang6's full-sized avatar
🏠
Working from home

qunwang6

🏠
Working from home
View GitHub Profile

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@qunwang6
qunwang6 / dedict.c
Last active August 29, 2015 14:24 — forked from josephg/0dedict.py
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "zlib.h"
#define CHUNK 16384
/*
40 Length of the zlib stream
@qunwang6
qunwang6 / level.lua
Last active August 29, 2015 14:26 — forked from masakichi/level.lua
战舰少女touchelf脚本
SCREEN_RESOLUTION="640x1136";
SCREEN_COLOR_BITS=32;
function isDone()
touchDown(4, 40, 876)
mSleep(200);
touchUp(4)
end
function checkLongWar()
@qunwang6
qunwang6 / STRD.lua
Created October 16, 2015 02:33 — forked from Revolution1/STRD.lua
lua的openwrt拨号脚本,用于四川电信校园网
#!/usr/bin/env lua
function md5sum(str)
local command="echo -n "..str.." | md5sum"
local f=io.popen(command)
local out=f:read('*all')
return out:sub(1,-5)
--f:close()
end
--print(md5sum("asdf")) -- 912ec803b2ce49e4a541068d495ab570
@qunwang6
qunwang6 / wwdc2014_sessions
Created January 21, 2016 09:53 — forked from 6david9/wwdc2014_sessions
wwdc2014 sessions download links
import os.path
import requests
from lxml import etree
file_path = 'https://developer.apple.com/videos/wwdc/2014/'
sd_path = os.path.expanduser("~/Desktop/wwdc2014_sd.txt")
hd_path = os.path.expanduser("~/Desktop/wwdc2014_hd.txt")
pdf_path = os.path.expanduser("~/Desktop/wwdc2014_pdf.txt")
@qunwang6
qunwang6 / update_gfwlist.sh
Created June 7, 2016 15:39 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@qunwang6
qunwang6 / mac_dict_app.py
Created August 10, 2016 07:00 — forked from gh640/mac_dict_app.py
Python: Mac の辞書アプリをターミナルから利用するためのスクリプト
#!/usr/bin/python2.7
# coding: utf-8
"""Mac に備え付けの辞書アプリをコマンドラインで利用する
Usage:
/usr/bin/python2.7 __file__ < [検索したい単語を格納したファイル.txt]
See:
- Accessing Dictionaries
@qunwang6
qunwang6 / hatena-get-bookmark-count.sh
Created August 10, 2016 08:23 — forked from gh640/hatena-get-bookmark-count.sh
特定のサイトやページのはてブ数を取得するターミナル関数
# サイト全体のはてブ数を取得する
# get the sum total of hatena bookmark count for a site
#
# usage:
# hatena_get_count_for_site http://example.com
#
function hatena_get_count_for_site {
# @see http://developer.hatena.ne.jp/ja/documents/bookmark/apis/getcount
if [ "$#" -ne 1 ]; then
@qunwang6
qunwang6 / pan.baidu.com.py
Created September 10, 2016 05:11 — forked from PeterDing/pan.baidu.com.py
百度云、百度网盘,递归下载自己的文件或分享的文件 -- keywords: pan.baidu.com, login, recursively, download -- # 移到仓库 https://github.com/PeterDing/iScript
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import os
import sys
import requests
import urllib
import json
import re
import time