Skip to content

Instantly share code, notes, and snippets.

View notsobad's full-sized avatar

notsobad notsobad

View GitHub Profile
#set coding
#defencoding GBK
#encoding UTF-8 GBK
#see the startup message
termcapinfo xterm-color|xterm|xterms|xs|rxvt ti@:te@
startup_message off
term xterm
##use ` as the Global Key
### escape ``
###set a biger buffer
@notsobad
notsobad / .bash_notsobad.sh
Created March 9, 2012 05:51
My bash profile, and shell utils
#!/bin/sh
# By notsobad
# variables
C_DEFAULT="\[\033[m\]"
C_WHITE="\[\033[1m\]"
C_BLACK="\[\033[30m\]"
C_RED="\[\033[31m\]"
C_GREEN="\[\033[32m\]"
@notsobad
notsobad / .vimrc
Last active March 6, 2018 12:37
My working vim profile
" My working vim profile
set nocompatible
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
syntax on
set hlsearch
color koehler
@notsobad
notsobad / util.js
Created March 9, 2012 08:24
My js utils
var arrays_equal = function(a,b) { return a && b ? !(a<b || b<a) : false; }
//var log = (window.console && console.log) || function(){};
var log=function(){ window.console && console.log && console.log.apply(console, arguments) }
var n_day_ago= function(n){
var d = new Date();
d.setDate(d.getDate() - n);
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setMilliseconds(0);
@notsobad
notsobad / gist:2965283
Created June 21, 2012 11:43
Mongo wraper
#!/usr/bin/env python
#encoding: utf-8
"""
By notsobad
"""
import sys
import time
import socket
import pymongo
@notsobad
notsobad / gist:3174626
Created July 25, 2012 05:48
海信智能电视中使用的网络服务
http://data.house.sina.com.cn/ip/app_addr.php?ip=
http://php.weather.sina.com.cn/xml.php?city=&password=DJOYnieT8234jlsK&day=
http://vip.stock.finance.sina.com.cn/quotes_service/view/HisenseSuggest.php?type=1,2&key=
http://vip.stock.finance.sina.com.cn/quotes_service/view/HisenseABQuotes.php?id=
http://image2.sinajs.cn/newchart/min/n/%s.gif
http://image2.sinajs.cn/newchart/daily/n/%s.gif
http://image2.sinajs.cn/newchart/weekly/n/%s.gif
http://image2.sinajs.cn/newchart/monthly/n/%s.gif
http://tvlist.dnethome.net:8088/cgi-bin/epg_index.fcgi?action=smarttv_ad&id=12
http://tvlist.dnethome.net:8088/cgi-bin/epg_index.fcgi?action=smarttv_ad&id=12
;alert('ktt');
@notsobad
notsobad / .screenrc
Created May 28, 2013 08:20
My .screenrc file
chdir
bindkey "\033[D" prev # change window with ctrl-left
bindkey "\033[C" next # change window with ctrl-right
hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
term xterm
@notsobad
notsobad / api_sev.py
Last active February 5, 2022 15:29
Tornado basic auth example
# -*- coding= utf-8 -*-
import datetime
import os
import json
import tornado.ioloop
import tornado.web
import tornado
import tornado.httpclient
import traceback
import urllib2

如何设计一个API服务

By @notsobad

认证

api key

url中附加一个key

/api/posts/?key=aasd2323423asdfasdf