This file contains 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
set.seed(225) | |
rnorm(5) | |
rnorm(5) | |
rnorm(5) | |
rand_state <- .GlobalEnv$.Random.seed | |
saveRDS(list(rand_state = rand_state), "rand_state.rds") | |
rnorm(5) # [1] 0.55203151 0.08414507 1.92445918 -0.65374544 1.42059484 | |
.GlobalEnv$.Random.seed <- readRDS("rand_state.rds")$rand_state | |
rnorm(5) # [1] 0.55203151 0.08414507 1.92445918 -0.65374544 1.42059484 |
This file contains 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
color_brewer <- function(ids = NULL, rev = TRUE) { | |
# RColorBrewer::brewer.pal(n = 7, name = "Set1") | |
colour <- c( | |
"#377EB8", | |
"#E41A1C", | |
"#4DAF4A", | |
"#F7D94C", | |
"#984EA3", | |
"#A65628", | |
"#FF7F00", |
This file contains 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 | |
# Sometimes you need to move your existing git repository | |
# to a new remote repository (/new remote origin). | |
# Here are a simple and quick steps that does exactly this. | |
# | |
# Let's assume we call "old repo" the repository you wish | |
# to move, and "new repo" the one you wish to move to. | |
# | |
### Step 1. Make sure you have a local copy of all "old repo" | |
### branches and tags. |
This file contains 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 smtplib | |
from email.mime.text import MIMEText | |
from email.header import decode_header | |
from email.header import Header | |
import pandas as pd | |
import random | |
import time | |
# タイトル |
This file contains 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
doInstall <- TRUE | |
toInstall <- c("ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
ANES <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/ANES.csv") | |
ANES <- ANES[ANES$year == 2008, -c(1, 11, 17)] # Limit to just 2008 respondents, | |
head(ANES) # remove some non-helpful variables | |
# Fit several models with the same DV: |
This file contains 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 argparse | |
from PyPDF2 import PdfFileWriter, PdfFileReader | |
import os | |
def main(main_path, blank_path): | |
output = PdfFileWriter() | |
main_file = PdfFileReader(open(main_path, "rb")) | |
blank_file = PdfFileReader(open(blank_path, "rb")) |
This file contains 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 <stdio.h> | |
#include <iostream> | |
#include <cstdlib> | |
#include <dirent.h> | |
#include <algorithm> | |
#include <stdlib.h> | |
#include <vector> | |
using namespace std; |
This file contains 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
// Original Code http://goo.gl/P0sED6 | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <Eigen/Dense> | |
using namespace std; | |
using namespace Eigen; |
This file contains 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 <iostream> | |
#include <fstream> | |
#include <string> | |
#include <random> | |
// Eigen | |
#include <Eigen/Dense> | |
using namespace std; | |
using namespace Eigen; |
This file contains 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
\ProvidesPackage{beamerthemeI6pd2} % this style was created by Thomas Deselaers an Philippe Dreuw | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\RequirePackage{tangocolors} | |
\selectcolormodel{cmyk} | |
\mode<presentation> | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\setbeamercolor{headline}{fg=tabutter,bg=ta2chameleon} |
NewerOlder