Skip to content

Instantly share code, notes, and snippets.

@izahn
izahn / ob-stata.el
Last active August 29, 2015 14:02
Preliminary Stata support for org-babel in emacs
;;; ob-stata.el --- org-babel functions for stata code evaluation
;; Copyright (C) 2014 Ista Zahn
;; Author: Ista Zahn, based on ob-julia.el by G. Jay Kerns, and ob-R.el
;; by Eric Schulte and Dan Davison
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
@izahn
izahn / haven_package_frustrations.R
Created September 15, 2015 18:26
Haven package frustrations
library(haven)
library(dplyr)
library(foreign)
## Read Stata dataset with foreign
xf <- read.dta("http://izahn.crabdance.com/owncloud/index.php/s/PlXcLrNFyKoIDk3/download")
## Read Stata dataset with haven
xh <- read_dta("http://izahn.crabdance.com/owncloud/index.php/s/PlXcLrNFyKoIDk3/download")
str(xf) ## structure of foreign result is comprehensable
@izahn
izahn / cvimrc
Last active December 22, 2015 19:49
" Settings
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set numerichints
set typelinkhints
let barposition = "bottom"
@izahn
izahn / helm_config.el
Created May 20, 2016 19:48
Helm config
;;; Completion hints for files and buffers buffers
(require 'helm-config)
(helm-mode 1)
;;rebind tab to do persistent action
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
;; make TAB works in terminal
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
;list actions using C-z
(define-key helm-map (kbd "C-z") 'helm-select-action)
@izahn
izahn / R screen scraping example.R
Created June 14, 2013 21:06
This R script contains a simple screen scraping example, downloading the text of the articles in the CNN website rss feed.
## This R script contains a simple screen scraping example,
## downloading the text of the articles in the CNN website
## rss feed.
library(RCurl)
library(XML)
options(stringsAsFactors = FALSE)
## get rss document
@izahn
izahn / tst.r
Last active June 16, 2017 02:36
print(getwd())
setwd("/home/ubuntu")
install.packages("aws.s3", repos = "https://cran.rstudio.com", lib = .libPaths()[1])
library("aws.s3")
print(bucketlist())
write.csv(bucketlist(), "check.csv")
@izahn
izahn / PKGBUILD
Created May 3, 2016 20:34
emacspeak 44 package build for Archlinux
# Maintainer: Steve Holmes <steve.holmes88@gmail.com>
# Contributers: Chris Brannon <cmbrannon79@gmail.com>
pkgname=emacspeak
pkgver=44.0
pkgrel=1
pkgdesc="Emacs extension that provides spoken output"
arch=('i686' 'x86_64')
url="https://github.com/tvraman/emacspeak"
license=('GPL' 'LGPL' 'APACHE')
depends=('emacs' 'tcl' 'tclx' 'espeak')
@izahn
izahn / fst_rds_benchmark.R
Created July 18, 2019 18:53
A quick comparison between fst and rds IO characteristics
library(fst)
n <- 1000000
d1 <- as.data.frame(c(replicate(50, sample(letters[1:10], n, replace = TRUE), simplify = FALSE),
replicate(50, runif(n), simplify = FALSE)))
tmpf <- tempfile()
rw_time <- function(compression, file, write.fun, read.fun) {
data.frame(compression = compression,
writeTime = system.time(write.fun(d1, file, compress = compression))[[3]],
@izahn
izahn / R351_env.yml
Last active April 28, 2020 21:37
conda R
abind=1.4-5
assertthat=0.2.0
backports=1.1.2
base=3.5.1
base64enc=0.1-3
BH=1.66.0-1
bindr=0.1.1
bindrcpp=0.2.2
bit=1.1-14
bit64=0.9-7
@izahn
izahn / README.org
Last active January 1, 2021 00:08
Yet another attempt at a sane emacs config

Requirements for a sane emacs config for social scientists

Requirements

Emacs is many things to many people, being perhaps the most configurable text editor ever created. However, there are some common tools that social scientists often make use of that are not accessible in emacs by default. It is therefore desirable to create a base configuration that enables the features that social scientists are likely to find useful. The table below lists some of these requirements, and describes how they can be made available in emacs.