Skip to content

Instantly share code, notes, and snippets.

@sahilseth
sahilseth / install_tldr.sh
Created October 20, 2015 15:01
how to install tldr
##
brew install llvm --with-clang --with-asan
then
brew install tldr
@sahilseth
sahilseth / OSX-Convert-MOV-GIF.md
Last active September 5, 2021 22:43 — forked from tskaggs/OSX-Convert-MOV-GIF.md
Creating GIFs from .MOV files in OSX using FFmpeg and ImageMagick

Convert MOV to GIF using FFmpeg and ImageMagick

I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!

Preparation

Install FFmpeg

brew install ffmpeg [all your options]
##* Example:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools
@sahilseth
sahilseth / reset_docker,sh
Created October 13, 2015 11:10
in case of issues with kitematic
#!/bin/bash
## https://github.com/kitematic/kitematic/blob/master/util/reset
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sudo rm -f /usr/local/bin/docker*
pkill VirtualBox
pkill VBox
rm -rf ~/Library/Application\ Support/Kitematic/
@sahilseth
sahilseth / python_pkgs.sh
Last active October 13, 2015 00:19
installing python packages in a custom location
## add this to bashrc:
export PYTHONPATH=$PYTHONPATH:~/lib/python2.7/site-packages/
module load Python
python setup.py install --prefix=$HOME
@sahilseth
sahilseth / dataframe_vars.R
Created October 7, 2015 16:08
add complex variable names to a data.frame
df = data.frame(id = 1:10, fname = paste0("name", 1:10))
nms = c(id = "the unique id which does this or that",
fname = "first name of a person")
attr(df, 'info') <- nms
## let is see how this looks
attr(df, "info")
@sahilseth
sahilseth / flowr_example.R
Last active October 6, 2015 22:44
flowr simple example
setwd("~/pub/slides/rmeetup_oct2015")
# get commands ------------------------------
hello='echo Hello World !'
sleep=c('sleep 5', 'sleep 5')
tmp=c('cat $RANDOM > tmp1',
'cat $RANDOM > tmp2')
@sahilseth
sahilseth / progress.R
Last active October 19, 2015 17:10
progress bar in rstats
mn=1;mx=10
pb <- txtProgressBar(mn, mx, style = 3)
tmp <- lapply(mn:mx, function(x){
pb$up(x)
Sys.sleep(0.5)
#message("I am doing something...")
})
@sahilseth
sahilseth / simple_make.def
Last active September 29, 2015 16:40
simple make
jobname sub_type prev_jobs dep_type queue memory_reserved walltime cpu_reserved platform jobid
create_db serial none none short 2000 1:00 1 local 1
rna2dna1 serial create_db serial short 2000 1:00 1 local 2
echorna1 serial rna2dna1 serial short 2000 1:00 1 local 3
rna2dna2 serial create_db serial short 2000 1:00 1 local 4
echorna2 serial rna2dna2 serial short 2000 1:00 1 local 5
rna2dna3 serial create_db serial short 2000 1:00 1 local 6
echorna3 serial rna2dna3 serial short 2000 1:00 1 local 7
@sahilseth
sahilseth / installr_1.sh
Last active September 23, 2015 05:13
Installing R for RStudio on a server
## make a dir to install
sudo mkdir -m 775 /apps
chown sahilseth /apps
## download to a tmp space
cd /tmp
wget http://cran.r-project.org/src/base/R-3/R-3.2.2.tar.gz
tar -zxvf R-3.2.2.tar.gz
cd R-3.2.2
./configure --prefix /apps/R/3.2.2/ --enable-R-shlib --enable-R-profiling \
@sahilseth
sahilseth / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console