Skip to content

Instantly share code, notes, and snippets.

Minwei Shen MinweiShen

Block or report user

Report or block MinweiShen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View days_of_month.js
return month === 1 ?
((year % 4 ===0 && year%100!==0) or year %400===0) ? 28 : 29) : /* February */
((month % 2) ^ (month < 7) ? 31 : 30); /* Other months */
import json,codecs
class WebCrawlerScrapyPipeline(object):
def __init__(self):
self.file ='item.json', 'wb', encoding='utf-8')
def process_item(self, item, spider):
line = json.dumps(dict(item)) + '\n'
# print line
View gist:ee7538dfff14d1359343
<?xml version="1.0"?>
<name>Remap KANA to F18</name>
<autogen>__KeyToKey__ KeyCode::JIS_KANA, KeyCode::F18</autogen>
View gist:939396ef075bdadd156d
# 定义查找窗口切换时显示在每个窗口图标的字符,类似于Vim的easymotion插件
alias showHintsLeftHand hint ASDFQWERT
#KANA is remap to F18
#EISUU is remap to F19
# 一些位置定义:全屏,左半屏,右半屏等等
MinweiShen /
Created Mar 24, 2015
Misra_Gries algorithm
def Misra_Gries(file,k):
result = {}
to_delete = []
with open(file,"r") as f:
for l in f.readlines():
chars = l.split()
for ch in chars:
to_delete = []
if ch in result:
result[ch] = result[ch] + 1
MinweiShen / sublime_setting
Last active Aug 29, 2015
Sublime Text 3 User setting
View sublime_setting
"color_scheme": "Packages/Color Scheme - Default/Espresso Libre.tmTheme",
"font_size": 13,
// show spaces
"draw_white_space": "all",
// the theme
MinweiShen / syscall_example
Created Jan 22, 2015
a simple example of using syscall()
View syscall_example
#include <stdio.h>
#include <fcntl.h>
/*arguments of syscall can be found on*/
int main(int argc, char* argv[]){
const char* fileName[7] = "me.txt";
//create a file that the owner can read/write. flags can be found easily by google
//open it as write only
int fd = syscall(SYS_open,fileName,O_WRONLY);
You can’t perform that action at this time.