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 / 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 / naivebayes.r
Created July 13, 2019 09:33 — forked from dansondergaard/naivebayes.r
R implementation of the Naive Bayes classifier example from [Wikipedia](http://en.wikipedia.org/wiki/Naive_Bayes_classifier#Examples).
# naivebayes.txt
#
# sex height weight footsize
# male 6 180 12
# male 5.92 190 11
# male 5.58 170 12
# male 5.92 165 10
# female 5 100 6
# female 5.5 150 8
# female 5.42 130 7
@qwang-big
qwang-big / 3D_CNN.py
Created April 18, 2019 08:15 — forked from imshashwataggarwal/3D_CNN.py
3D MNIST Image Classification
from __future__ import division, print_function, absolute_import
from keras.models import Sequential, model_from_json
from keras.layers import Dense, Dropout, Flatten, Conv3D, MaxPool3D, BatchNormalization, Input
from keras.optimizers import RMSprop
from keras.preprocessing.image import ImageDataGenerator
from keras.utils.np_utils import to_categorical
from keras.callbacks import ReduceLROnPlateau, TensorBoard
import h5py
@qwang-big
qwang-big / RandomMACAddr.md
Last active April 11, 2019 09:03 — forked from pklaus/README.md
Generating Random MAC Addresses with Python

TODO

  • Create a CLI-Interface with the following options:
    • Unicast or Multicast? Default: Unicast
    • Locally Administered or Globally Unique? Default: Locally Administered
    • Prescribe specific OUI (overwrites the above two)
    • Number of MACs to generate (they should not collide and be piped out separated by newlines)

Resources

@qwang-big
qwang-big / GitHub curl.sh
Created April 4, 2019 14:58
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"