Skip to content

Instantly share code, notes, and snippets.

View aberezin's full-sized avatar

Alan Berezin aberezin

View GitHub Profile
@aberezin
aberezin / installPackages.R
Last active August 29, 2015 13:58
aberezin R packages installed
#These are the packages I use in R
update.packages(ask=FALSE)
install.packages('RPostgreSQL')
install.packages('RMySQL')
install.packages('RJDBC') #Need JDBC driver, for example Merlia.jar
install.packages('maptools')
install.packages('MBA')
install.packages('sp')
install.packages('ggplot2')
@aberezin
aberezin / rigCount.html
Created August 1, 2014 16:23
NVD3 line graph with problematic xaxis ticks
<!DOCTYPE html>
<meta charset="utf-8">
<link href="http://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css" rel="stylesheet" type="text/css">
<style>
body {
overflow-y:scroll;
}
@aberezin
aberezin / vim-cheat-sheet.md
Last active June 5, 2016 13:45
Vim Cheat Sheet

Vim Cheat Sheet

My collection of vim tips to make the best editor even better. This is by no means complete or a tutorial on how to use vim, but a set of commands I don't want to forget and need to write them down before they burn into memory. See the resources section below for a more complete introduction and a set of in-depth tutorials.

Files

:tabe SomePath " open a new tab on path :split SomePath (vsplit) " open window (vertical window) on path :r SomePath " read into current buffer

Navigation

:nn            " Jump to line nn
@aberezin
aberezin / cvimrc
Created November 28, 2017 18:52 — forked from yograf/cvimrc
let hintcharacters="asdfgjkl"
map H previousTab
map L nextTab
map b :buffer<Space>
map B :buffer<Space>
map u lastClosedTab
map O :tabnew<Space>
map T :tabnew&<Space>
" Canonical is at https://gist.github.com/aberezin/0ee9c5e6354996849d3b0bcb50c6e29c"
" This didnt work for me so lets just manually synch with the gist above
" let configpath = '/Users/aberezin/.cvimrc'
" set localconfig
" ccim_server in ~/bin needs to be run mannually for now. Maybe make a
" service
set noautofocus
set autoupdategist
@aberezin
aberezin / iterm
Created June 22, 2018 22:53 — forked from vyder/iterm
iterm.bash - Launch iTerm from command line
#!/usr/bin/env bash
#
# Open new iTerm window from the command line using v3 syntax for applescript as needed in iTerm2 Version 3+
# This script blocks until the cmd is executed in the new iTerm2 window. It then leaves the window open.
# TODO Add option to close iTerm2 after cmd execs
# See also https://www.iterm2.com/documentation-scripting.html
#
# Usage:
@aberezin
aberezin / psjson
Last active October 28, 2020 05:56
#! /usr/bin/env bash
# Use at own risk. License CC0 see https://creativecommons.org/publicdomain/mark/1.0/
# alanberezin.com
OPTIND=1 # Reset in case getopts has been used previously in the shell.
opt_stripclasspath=false
while getopts ":hc" opt; do
case "$1" in
-h | --help )
cat <<-EOF
@aberezin
aberezin / recursive-cat.sh
Created May 24, 2019 18:53
One-liner to force dropbox to synch every file
find . -type f -exec sh -c 'cat "$1" > /dev/null; printf "$1"' -- '{}' \;
@aberezin
aberezin / ini2json.py
Created January 1, 2020 18:03 — forked from Natim/ini2json.py
Convert an ini configuration file into a json file
# -*- coding: utf-8 -*-
import json
import sys
from ConfigParser import (ConfigParser, MissingSectionHeaderError,
ParsingError, DEFAULTSECT)
class StrictConfigParser(ConfigParser):
def _read(self, fp, fpname):
@aberezin
aberezin / Dockerfile
Created March 24, 2020 01:26
Alpine linux with rcinit and ssh
FROM alpine:edge
# use the CDN mirror from gilderlabs since its much faster
RUN mkdir -p /etc/apk && echo "http://alpine.gliderlabs.com/alpine/edge/main" > /etc/apk/repositories &&\
# Install openrc
apk update && apk add openrc &&\
# Tell openrc its running inside a container, till now that has meant LXC
sed -i 's/#rc_sys=""/rc_sys="lxc"/g' /etc/rc.conf &&\
# Tell openrc loopback and net are already there, since docker handles the networking
echo 'rc_provide="loopback net"' >> /etc/rc.conf &&\