Skip to content

Instantly share code, notes, and snippets.

@LYY
LYY / gist:13d1a7657227743f7ce4
Last active August 29, 2015 14:27
tango2 error on osx
[tango] 2015/08/23 00:53:38 [Error] recovery.go:28 Handler crashed with error: error on writing template: n(3965) != buffer.Len(238039)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s 401
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/panic.go 387
/Users/[user]/program/goprj/mylab/src/gopkg.in/flosch/pongo2.v3/template.go 132
/Users/[user]/program/goprj/mylab/src/github.com/tango-contrib/tpongo2/tpongo2.go 123
/Users/[user]/program/goprj/mylab/src/github.com/tango-contrib/tpongo2/tpongo2.go 113
/Users/[user]/program/goprj/mylab/src/github.com/LYY/gotestlab/tangolab/main.go 35
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s 402
/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go 419
/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go 296
package utils
import (
"database/sql"
"fmt"
"github.com/adjust/goenv"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
"github.com/jrallison/go-workers"
"strings"
@LYY
LYY / gist:7b93368f224a5171b6fd
Created May 11, 2015 07:04
LiteIDE 27.2.1 crash log
Process: LiteIDE [3537]
Path: /Applications/LiteIDE.app/Contents/MacOS/LiteIDE
Identifier: com.visualfc.liteide
Version: liteidex (liteide x version)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: LiteIDE [3537]
User ID: 501
Date/Time: 2015-05-11 15:01:42.947 +0800
@LYY
LYY / 用api抓微博评论
Created August 26, 2014 02:46
用api抓微博评论
require 'weibo_2'
require 'csv'
mids = ["aaa", "bbb", "ccc"]
ids = []
token = "token"
WeiboOAuth2::Config.api_key = "key"
WeiboOAuth2::Config.api_secret = "secret"
WeiboOAuth2::Config.redirect_uri = "http://r.com"
[ -f coevent/src/coevent.h ] || (git submodule init && git submodule update)
[ -f coevent/merry/merry.h ] || (cd coevent && git submodule init && git submodule update)
[ -d objs ] || mkdir objs;
[ -d objs/merry ] || mkdir objs/merry;
[ -f luajit/src/libluajit.a ] || (cd luajit && make)
cd objs/merry && gcc -fPIC -c ../../coevent/merry/common/*.c -g -ggdb -I/Users/tency/Documents/projects/alilua/alilua/luajit/src/;
../../coevent/merry/common/strings.c:170:12: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if(val < 0) {
~~~ ^ ~
1 warning generated.
[ -f coevent/src/coevent.h ] || (git submodule init && git submodule update)
Submodule 'coevent' (https://github.com/oneoo/alilua-coevent-module) registered for path 'coevent'
Submodule 'luajit' (https://github.com/agentzh/luajit2.git) registered for path 'luajit'
Cloning into 'coevent'...
Submodule path 'coevent': checked out 'a9065984f443d674598e955173577f864e675575'
Cloning into 'luajit'...
Submodule path 'luajit': checked out 'f948fe0c2797bb75ed2147ef86795b082712c96b'
[ -f coevent/merry/merry.h ] || (cd coevent && git submodule init && git submodule update)
Submodule 'merry' (https://github.com/oneoo/merry.git) registered for path 'merry'
Cloning into 'merry'...
@LYY
LYY / article.rb
Created October 23, 2013 07:10
Imoprt datas to elasticsearch use Tire, with 10 processes
# -*- encoding : utf-8 -*-
module Tire
module ArticleFunc
module_function
def build_new_index
new_index = Article.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')
reindex Article, new_index
end
@LYY
LYY / gist:6103118
Created July 29, 2013 09:06
Use parallel-ssh to change hosts' default gateway
#!/bin/bash
hostip=`hostname -i`
if [ $# -ge 1 ]; then
hostfile=$1
else
hostfile=hosts.txt
fi
parallel-ssh -h $hostfile "sed -E 's/gateway [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+/gateway $hostip/g' /etc/network/interfaces > /etc/network/tmpif"
parallel-ssh -h $hostfile "chmod g-r,o-r /etc/network/tmpif"
parallel-ssh -h $hostfile "cp /etc/network/interfaces /etc/network/interfaces.bak"