Skip to content

Instantly share code, notes, and snippets.

View aberezin's full-sized avatar

Alan Berezin aberezin

View GitHub Profile
@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 / 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 / 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:
" 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 / 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>
@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 / 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 / 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')