Lecture 1: Introduction to Research — [📝Lecture Notebooks] [
Lecture 2: Introduction to Python — [📝Lecture Notebooks] [
Lecture 3: Introduction to NumPy — [📝Lecture Notebooks] [
Lecture 4: Introduction to pandas — [📝Lecture Notebooks] [
Lecture 5: Plotting Data — [📝Lecture Notebooks] [[
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# lrdcq | |
# usage python2 unwxapkg.py filename | |
import sys, os | |
import struct | |
class WxapkgFile(object): | |
nameLen = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python的命名规范 | |
包 | |
应该是简短的、小写的名字。如果下划线可以改善可读性可以加入。如mypackage。 | |
模块 | |
与包的规范同。如mymodule。 | |
类 | |
总是使用首字母大写单词串。如MyClass。内部类可以使用额外的前导下划线。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(<>){ | |
if (/^\@article\{(\S+),/){ | |
$h{$1}=1 | |
} | |
} | |
while(<DATA>){ | |
chomp; | |
print "$_\n" unless defined $h{$_} | |
} | |
__DATA__ |
http://rstudio-pubs-static.s3.amazonaws.com/329613_f53e84d1a18840d5a1df55efb90739d9.html
#rstats dual-y-axes #ggplot
d=mtcars
x='wt'
y='mpg'
z='disp'
a=range(d[[y]])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
- Dog
- German Shepherd
- Belgian Shepherd
- Malinois
- Groenendael
- Tervuren
- Cat
- Siberian
- Siamese
NewerOlder