Skip to content

Instantly share code, notes, and snippets.

View jianingy's full-sized avatar
💭
Restoring

Jianing Yang jianingy

💭
Restoring
View GitHub Profile
@jianingy
jianingy / gist:5317451
Created April 5, 2013 08:02
A method for starting multiple twisted instance
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filename : almarctl.py
# created at : 2013-04-04 21:27:12
# author : Jianing Yang <jianingy.yang AT gmail DOT com>
__author__ = 'Jianing Yang <jianingy.yang AT gmail DOT com>'
from os import environ
@jianingy
jianingy / screenshot.sh
Last active December 15, 2015 20:29
do a screenshot using scrot and upload it to imgur.com. Of course, the image link will be in clipboard.
#!/bin/bash
# filename : screenshot.sh
# created at : 2013-04-05 20:01:35
# author : Jianing Yang <jianingy.yang AT gmail DOT com>
# client id from imgur.com
client=0350033e1d023ba
# temporary file for storing screenshot
img=$(mktemp --suffix .png)
@jianingy
jianingy / virtual-hosts.conf
Created April 17, 2013 08:26
dyanmic virtualhost for nginx
server {
listen 80 default;
listen [::]:80 default;
server_name _;
charset utf-8;
access_log off;
root /var/www/$http_host/wwwroot/;
location / {
index index.html index.htm index.php;
@jianingy
jianingy / gist:5457295
Created April 25, 2013 03:25
almar search tool
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import unittest
import psycopg2
#SERVICE_BASE = 'http://localhost:9999/op'
SERVICE_BASE = 'http://dnsdev2.cm3:55555/op'
@jianingy
jianingy / xmonad.hs
Last active January 4, 2019 05:59
Xmonad Configuration
import XMonad
import XMonad hiding (Tall)
import XMonad.Actions.CycleWS
import XMonad.Actions.FloatKeys
import XMonad.Actions.GridSelect
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
@jianingy
jianingy / pyparse-sample.py
Created June 15, 2013 14:10
a sample for parsing a nginx-like conf
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filename : ustack.py
# created at : 2013-06-15 21:05:10
# author : Jianing Yang <jianingy.yang AT gmail DOT com>
__author__ = 'Jianing Yang <jianingy.yang AT gmail DOT com>'
from pyparsing import *

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
from ubuntu:12.04
run apt-get install -y openssh-server sudo
run useradd -s /bin/bash -m jianingy
run gpasswd -a jianingy sudo
run sed -i '/%sudo/s/ALL$/NOPASSWD:ALL/g' /etc/sudoers
run dpkg-divert --local --rename --add /sbin/initctl
run ln -s /bin/true /sbin/initctl
run service ssh start
run mkdir -p /var/run/sshd
add authorized_keys /home/jianingy/.ssh/authorized_keys
@jianingy
jianingy / rip-example.txt
Last active December 28, 2015 04:49
quagga rip example
!
key chain primary
key 1
key-string secret
hostname a1.example.com
interface tap-obfs1
ip rip authentication mode md5
ip rip authentication key-chain primary
@jianingy
jianingy / ospf-example.txt
Created November 13, 2013 07:56
quagga ospf example conf
! Zebra configuration saved from vty
! 2013/10/31 11:24:22
!
hostname a1.example.com
log syslog
log facility local7
!
!
!