Skip to content

Instantly share code, notes, and snippets.

@jinzhu
jinzhu / main.go
Created October 1, 2015 00:07
handle postgres json with gorm
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)
func main() {
@jinzhu
jinzhu / ArchLinux VPN
Created March 27, 2011 07:12
a script to quick setup vpn server in archlinux
#!/bin/bash
# wosmvp@gmail.com
# thanks sushiyant (me@sushiyant.org)
pacman -S iptables pptpd
echo "iptables -A INPUT -i ppp+ -j ACCEPT" >> /etc/rc.local
echo "iptables -A OUTPUT -o ppp+ -j ACCEPT" >> /etc/rc.local
echo "iptables -A INPUT -p tcp --dport 1723 -j ACCEPT" >> /etc/rc.local
echo "iptables -A INPUT -p 47 -j ACCEPT" >> /etc/rc.local
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
fb629b0... 11/23/13 15:49 private
7479510 11/15/13 13:21 public
c4da64e... 04/29/13 12:56 public
5285857 04/02/13 00:08 public
5279532 03/31/13 12:20 public
dfca60f... 01/23/13 17:44 public
cec5482... 12/26/12 15:51 public
+ 4010380 11/04/12 12:57 public Qor DSL examples
2904020 06/10/12 13:50 public nginx microcaching config example
+ 2099624 03/19/12 14:50 public Get hot vim scripts
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"strconv"
;;; tabbar+.el --- Tabbar extensions
;; Copyright (C) 2012
;; Author:
;; Keywords:
;; Version 0.2.2
;;; Commentary:

Manage your gmail account in emacs with mu4e

There're a lot of combinations to manage your email with emacs, but this works for me. I've a backup and I can manage my daily email.

The stack:

  • emacs
  • offlineimap
  • mu
  • mu4e
@jinzhu
jinzhu / gemfile.rb
Created November 4, 2012 04:57
Qor DSL examples
require 'qor_dsl'
module Gemfile
class Configuration
include Qor::Dsl
default_configs [ENV['BUNDLE_GEMFILE'], 'Gemfile']
node :gem
[:git, :path, :group].map do |name|
node name do
@jinzhu
jinzhu / gist:2904020
Created June 10, 2012 05:50 — forked from fennb/gist:1283573
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@jinzhu
jinzhu / github.rb
Created March 19, 2012 06:50
Get hot vim scripts
require 'rubygems'
require 'rest_client'
require 'json'
watcher_threshold = 50
user = "vim-scripts"
results = []
url = "http://github.com/api/v2/json/repos/search/vim"
# url = "http://github.com/api/v2/json/repos/show/#{user}"