Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Linux usage: ./extract_tampermonkey_script.py "/home/<USER>/.config/<BROWSER>/Default/Local Extension Settings/<EXTENSION_ID>"
# i.e.: ./extract_tampermonkey_script.py "/home/foo/.config/google-chrome-beta/Default/Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf"
# Mac usage: ./extract_tampermonkey_script.py "/Users/<USER>/Library/Application Support/Google/Chrome/Default/Local Extension Settings/<EXTENSION_ID>/"
# i.e.: ./extract_tampermonkey_script.py "/Users/foo/Library/Application Support/Google/Chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo/"
import leveldb
import sys
import re
@qwang-big
qwang-big / coin-flip.py
Created November 4, 2021 11:56 — forked from breeko/coin-flip.py
A simulation of a coin-flipping game
import random
def play(bankroll, wager_perc, prob_win, payout_perc, num_turns, seed):
""" Plays a coin flipping game and returns the final balance
Inputs:
start (number): starting bankroll
wager_perc (number): percent of bankroll you want to wager at each turn
prob_win (number): probability of a win (e.g. 0.5 is 50% win probability)
payout_perc (number): the payout multiple in case of win (payout = payout_perc * wager)
num_turns (number): the number of turns in the game
@qwang-big
qwang-big / unwxapkg.py
Created September 18, 2021 08:22 — forked from Integ/unwxapkg.py
A useful tool for unpack wxapkg file with python3 surport.
# coding: utf-8
# py2 origin author lrdcq
# usage python3 unwxapkg.py filename
__author__ = 'Integ: https://github.com./integ'
import sys, os
import struct
class WxapkgFile(object):
@qwang-big
qwang-big / unwxapkg.py
Created September 18, 2021 08:15 — forked from feix/unwxapkg.py
#!/usr/bin/env python2
# lrdcq
# usage python2 unwxapkg.py filename
import sys, os
import struct
class WxapkgFile(object):
nameLen = 0
@qwang-big
qwang-big / list.md
Created November 10, 2020 16:41 — forked from ih2502mk/list.md
Quantopian Lectures Saved
@qwang-big
qwang-big / python_name.txt
Created September 30, 2020 09:29
python的命名规范
python的命名规范
应该是简短的、小写的名字。如果下划线可以改善可读性可以加入。如mypackage。
模块
与包的规范同。如mymodule。
总是使用首字母大写单词串。如MyClass。内部类可以使用额外的前导下划线。
@qwang-big
qwang-big / checkbib.pl
Created May 19, 2020 13:26
check bib cite
while(<>){
if (/^\@article\{(\S+),/){
$h{$1}=1
}
}
while(<DATA>){
chomp;
print "$_\n" unless defined $h{$_}
}
__DATA__
@qwang-big
qwang-big / sec_axis.md
Created May 14, 2020 09:33
Dual Y Axes in ggplot
@qwang-big
qwang-big / speak.pl
Created April 6, 2020 07:41 — forked from michalfapso/speak.pl
Google Text-to-Speech script for processing longer texts
#!/usr/bin/perl
#--------------------------------------------------
# Usage:
# ./speak.pl en input.txt output.mp3
#
# Prerequisites:
# sudo apt-get install libwww-perl libhtml-tree-perl sox libsox-fmt-mp3
#
# Compiling sox:
@qwang-big
qwang-big / nested numbered lists.md
Created March 29, 2020 08:30
nested numbered lists
  1. Dog
    1. German Shepherd
    2. Belgian Shepherd
      1. Malinois
      2. Groenendael
      3. Tervuren
  2. Cat
    1. Siberian
  3. Siamese