Skip to content

Instantly share code, notes, and snippets.

View shandou's full-sized avatar

Shan Dou shandou

  • Vancouver, Canada
View GitHub Profile
@shandou
shandou / pearson_r_t_test.py
Last active May 30, 2018 05:25
hypothesis test for population Pearson's r
import scipy.stats
n = 25 # Number of samples n
df = n - 2 # Degrees of freedom
alpha = 0.05 # Significant level
# Non-direction tests for computing t-critical value
t_critical = scipy.stats.t.ppf(1 - alpha / 2, df)
@shandou
shandou / pearson_r_CI.py
Created May 30, 2018 05:58
pearson_r_confidence_interval
import scipy.stats
import numpy as np
alpha = 0.05 / 2 # Two-tail test
z_critical = scipy.stats.norm.ppf(1 - alpha)
@shandou
shandou / pearson_r_CI2
Last active May 30, 2018 06:23
pearson_r_CI2
import numpy as np
r = - 0.654 # Pearson's r from sampled data
z_prime = 0.5 * np.log((1 + r) / (1 - r))
n = 34 # Sample size
se = 1 / np.sqrt(n - 3) # Sample standard error
CI_lower = z_prime - z_critical * se
CI_upper = z_prime + z_critical * se
@shandou
shandou / jupyter_shortcuts.md
Created July 2, 2018 15:30 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@shandou
shandou / gist:543397cf81d72484604e4ae2bd3961c9
Last active July 9, 2018 03:55 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@shandou
shandou / .vimrc
Created July 10, 2018 15:21 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@shandou
shandou / mac-setup-redis.md
Last active August 23, 2019 22:42 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@shandou
shandou / mac-setup-redis.md
Created May 21, 2019 21:28 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@shandou
shandou / Redis.sh
Created June 2, 2019 03:47 — forked from nrollr/Redis.sh
Install Redis via Homebrew
#!/bin/bash
brew install redis # Install Redis using Homebrew
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl
# homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping # Check if the Redis server is running
@shandou
shandou / wix_codesnippet.html
Last active February 23, 2020 13:44
For more information about CND-available PrismJS features:1. Basic documentation and plugin utilities: https://prismjs.com/index.html2. CDN css and js: https://cdnjs.com/libraries/prism
<!-- CSS style sheets for Prism.js -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism.min.css"
rel="stylesheet"
/>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/plugins/line-numbers/prism-line-numbers.min.css"
rel="stylesheet"
/>
<!-- Code snippet content -->