Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Tianshu Wang TshuW

🎯
Focusing
  • Beijing
Block or report user

Report or block TshuW

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
@TshuW
TshuW / huxiu.js
Last active Oct 22, 2019
Redirect m.huxiu.com to www.huxiu.com by Tampermokey
View huxiu.js
// ==UserScript==
// @name Redirect Huxiu Mobile Link
// @namespace https://gist.github.com/TshuW/136f461b93dc258f6322b496fd656717
// @version 0.1
// @description Redirect m.huxiu.com to www.huxiu.com
// @author Tshu Wang
// @match m.huxiu.com/article/*
// @grant none
// ==/UserScript==
@TshuW
TshuW / zot_rm_unmaintained_files.py
Created Aug 27, 2019 — forked from specter119/zot_rm_unmaintained_files.py
remove files not maintained by zotero
View zot_rm_unmaintained_files.py
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import configparser
import re
import shutil
import sqlite3
import sys
@TshuW
TshuW / zot_rm_empty_folders.py
Created Aug 27, 2019 — forked from specter119/zot_rm_empty_folders.py
remove empty folders in `storage`
View zot_rm_empty_folders.py
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import configparser
import re
import shutil
import sys
View double_pinyin_flypy.custom.yaml
# double_pinyin_flypy.custom.yaml
# author: Tianshu Wang <volekingsg@gmail.com>
patch:
switches:
- name: ascii_mode
reset: 0
states: [ 中文, 西文 ]
- name: full_shape
states: [ 半角, 全角 ]
@TshuW
TshuW / SpaceFn.json
Last active Jul 9, 2019
Karabiner Elements config to simulation SpaceLauncher
View SpaceFn.json
{
"title": "SpaceFN",
"rules": [
{
"description": "SpaceFN: Space enables SpaceFN mode (see: https://geekhack.org/index.php?topic=51069.0)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar"
@TshuW
TshuW / .sVim
Last active Jan 20, 2019
sVim config
View .sVim
" Settings
set nosmoothscroll
let mapleader = ","
let newtaburl = "http://google.com"
let scrollduration = 5
@TshuW
TshuW / stdc++.h
Created Jan 22, 2018
Linux GCC 4.8.0 /bits/stdc++.h header definition.
View stdc++.h
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@TshuW
TshuW / save_safari_tabs.scpt
Last active Oct 22, 2019
Save all safari tabs in a single file and reopen them with a double click.
View save_safari_tabs.scpt
-- Detect if the Safari window exists
tell application "System Events"
if not (exists (front window of process "Safari")) then
return
end if
end tell
-- Assume the frontmost Finder window (or the Desktop)
-- is where we want to store the script.
try
@TshuW
TshuW / stlib.cpp
Created Dec 15, 2016
ACM/ICPC header
View stlib.cpp
#include <bits/stdc++.h>
#define IOS std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);
// #define __DEBUG__
#ifdef __DEBUG__
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif
#define filename ""
@TshuW
TshuW / Meisell-Lehmer.cpp
Created Oct 12, 2016
calculate the prime number lower and equal than n quickly.
View Meisell-Lehmer.cpp
#include<bits/stdc++>
/Meisell-Lehmer
const int MAX_N = 5e6 + 2;
bool np[MAX_N];
int prime[MAX_N], pi[MAX_N];
int getprime()
{
int cnt = 0;
np[0] = np[1] = true;
pi[0] = pi[1] = 0;
You can’t perform that action at this time.