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
| # Change file names -> change spaces to under-scores | |
| find . -name \*.ipynb -type f -exec bash -c 'mv "$@" $(echo "$@" | tr " " "_")' -- {} \; |
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
| \RequirePackage{amsmath,amsfonts,amsthm,amssymb} | |
| \RequirePackage{mathtools} | |
| \RequirePackage{graphicx} | |
| % http://tex.stackexchange.com/questions/229355/algorithm-algorithmic-algorithmicx-algorithm2e-algpseudocode-confused | |
| %\RequirePackage{algorithmicx, algpseudocode} | |
| \RequirePackage[ruled,vlined]{algorithm2e} | |
| \RequirePackage[T1]{fontenc} | |
| \RequirePackage[utf8]{inputenc} | |
| \RequirePackage{mathpazo} % add possibly `sc` and `osf` options | |
| \RequirePackage{eulervm} |
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
| library(ggplot2) | |
| # First get the Iris histogram | |
| histo_list <- lapply(names(iris)[1:4], | |
| function (colname) qplot(iris[[colname]], geom = "histogram", xlab = colname)) | |
| # Add two sets of random normal samples | |
| n <- 100 | |
| histo_list[[5]] <- qplot(rnorm(n), geom='histogram', xlab='rand-norm-1') | |
| histo_list[[6]] <- qplot(rnorm(n), geom='histogram', xlab='rand-norm-2') |
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
| #include <thread> | |
| #include <iostream> | |
| #include <vector> | |
| #include <string> | |
| #include <algorithm> | |
| #include <cassert> | |
| using namespace std; | |
| void foncI(int m) { |
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
| from time import sleep | |
| from random import randint | |
| import json | |
| import requests | |
| import pandas as pd | |
| def fb_graph_api_crawl(params, **kws): | |
| print('initial call') | |
| res = requests.get('https://graph.facebook.com/v2.8/search', params).json() | |
| _js_list = [res['data']] |
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
| #!/bin/bash | |
| echo "Install xhyve driver" | |
| brew install docker-machine-driver-xhyve | |
| function quit_with { >&2 echo "ERROR: $@, quit"; exit 1; } | |
| function sudo_inst { | |
| local _prefix=$(brew --prefix docker-machine-driver-xhyve) | |
| echo "Run the following commands since xhyve requires sudo access" |
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
| #!/bin/bash | |
| lxc profile device set default eth0 parent enp2s0 | |
| lxc profile device set default eth0 nictype macvlan | |
| # https://insights.ubuntu.com/2016/04/07/lxd-networking-lxdbr0-explained/ | |
| cat <<EOF | sudo tee /etc/network/interfaces.d/containerbr.cfg | |
| auto containerbr | |
| iface containerbr inet dhcp | |
| bridge_ports eth0 |
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
| """ Compute receptive field size | |
| http://vision.stanford.edu/teaching/cs231b_spring1415/slides/alexnet_tugce_kyunghee.pdf | |
| """ | |
| def receptive_field_size(layers): | |
| """ Find the receptive field size of a single 'neuron' | |
| after a series of 'conv' and 'pool' operations | |
| """ | |
| if not layers: return 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
| install.packages(c("sp", "rgeos", "rgdal", "dplyr", "maptools", "leaflet", "scales")) | |
| library(sp) | |
| library(rgeos) | |
| library(rgdal) | |
| library(maptools) | |
| library(dplyr) | |
| library(leaflet) | |
| library(scales) |
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.pkgs <- function (...) { | |
| df.pkgs.loaded <- data.frame(installed.packages()) | |
| pkgs.loaded <- levels(df.pkgs.loaded$Package) | |
| pkgs.required <- list(...) | |
| pkgs.todo <- setdiff(pkgs.required, pkgs.loaded) | |
| for (pkg in pkgs.todo) { | |
| install.packages(pkg, repos = c("https://cloud.r-project.org")) | |
| } | |
| for (pkg in pkgs.required) { |