Skip to content

Instantly share code, notes, and snippets.

View robin's full-sized avatar
🏔️

Lu Yibin robin

🏔️
View GitHub Profile
@robin
robin / openssl-maker.sh
Created June 18, 2017 04:21 — forked from letiemble/openssl-maker.sh
A bash script to generate "all-in-one" OpenSSL static libraries for OS X and iOS. The script produces fat static libraries (i386, x86_64 for OS X) and (i386, x86_64, armv7, armv7s, arm64 for iOS) suitable for integration in both OS X and iOS project.
#!/bin/bash
###############################################################################
## ##
## Build and package OpenSSL static libraries for OSX/iOS ##
## ##
## This script is in the public domain. ##
## Creator : Laurent Etiemble ##
## ##
###############################################################################
@robin
robin / gist:10948618
Created April 17, 2014 02:21
sync_gateway crash log
2014/04/17 01:51:38 go-couchbase: call to ViewCustom("sync_gateway", "channels") in github.com/couchbaselabs/sync_gateway/base.couchbaseBucket.ViewCustom took 207.766195ms
01:51:38.458035 changes_view: Query took 210.170151ms to return 1910 rows, options = db.Body{"stale":false, "startkey":[]interface {}{"339fdb60b42701883337839ce8001c7c", 0x1}, "endkey":[]interface {}{"339fdb60b42701883337839ce8001c7c", 0x62da}}
2014/04/17 01:51:38 go-couchbase: call to ViewCustom("sync_gateway", "channels") in github.com/couchbaselabs/sync_gateway/base.couchbaseBucket.ViewCustom took 209.766802ms
01:51:38.795895 changes_view: Query took 212.639579ms to return 1863 rows, options = db.Body{"stale":false, "startkey":[]interface {}{"aa7634fc7a46e663aad755ed94001420", 0x22e4}, "endkey":[]interface {}{"aa7634fc7a46e663aad755ed94001420", 0x5ef3}}
panic: [object Object] [recovered]
panic: [object Object] [recovered]
panic: [object Object] [recovered]
panic: [object Object] [recovered]
panic: [object Object] [recovered]
panic:
@robin
robin / gist:3031763
Created July 2, 2012 07:54
keyremap4macbook map pageup/pagedown to volume up/down
<item>
<name>Volumn</name>
<appendix>PageUp to Volume Up</appendix>
<appendix>PageDown to Volume Down</appendix>
<identifier>remap.keytoconsumer_volumn</identifier>
<autogen>--KeyToConsumer-- KeyCode::PAGEUP, ConsumerKeyCode::VOLUME_UP</autogen>
<autogen>--KeyToConsumer-- KeyCode::PAGEDOWN, ConsumerKeyCode::VOLUME_DOWN</autogen>
</item>
@robin
robin / default
Created February 16, 2012 08:16 — forked from mauricio/default
# as we’re going to use Unicorn as the application server
# we’re not going to use common sockets
# but Unix sockets for faster communication
upstream shop {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/tmp/shop.socket fail_timeout=0;
@robin
robin / proxy.js
Created August 17, 2011 16:23 — forked from steadicat/proxy.js
A reverse-proxy for CouchDB written in Node.js
#!/usr/local/bin/node
var sys = require('sys');
var http = require('http');
var url = require('url');
var PREFIX = '/db/';
var TARGET = 'http://example.cloudant.com';
var PORT = 8001;
parse_git_branch() {
RSLT=''
GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //'`
if [ "$GIT_BRANCH" ]
then
GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'`
CLR='2'
if [ "$GIT_STATUS" ]
then
CLR='2'
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
<style type="text/css">
.thumbImage
{
max-width:150px;
max-height:150px;
}
*html.thumbImage
{
width:expression(this.width>150&&this.width>this.height?150:auto);
require 'fileutils'
# [chinesename].englishname.garbage.ext => abc - [chinesename].ext
def rename1(path)
files = Dir["#{path}/*"].each {|file|
filename = file.split('/')[-1]
next if filename !~ /^\[/
if filename =~ /(\[.+\]\.?)(.*)(\.[a-z]+)/
chinesename = $1
ext = $3
#import <SystemConfiguration/SCNetworkReachability.h>
#define ReachableViaWiFiNetwork          2
#define ReachableDirectWWAN               (1 << 18)
// fast wi-fi connection
+(BOOL)hasActiveWiFiConnection
{
     SCNetworkReachabilityFlags     flags;
     SCNetworkReachabilityRef     reachabilityRef;
     BOOL                              gotFlags;