Skip to content

Instantly share code, notes, and snippets.

View Khalian's full-sized avatar

Arunav Sanyal Khalian

  • Vancouver, BC, Canada
View GitHub Profile
sealed trait Addable[T] {
def add(a: T, b: T): T
}
object AddableInstances {
implicit val intAddable = new Addable[Int] {
override def add(a: Int, b: Int): Int = a + b
}
}
@Khalian
Khalian / install.sh
Created August 8, 2018 00:19
Arunav's pimped up installation of rad stuff
# This is to be used in environments without proper yum usage.
# Mosh
sudo yum -y install autoconf automake gcc gcc-c++ make boost-devel
sudo yum -y install zlib-devel ncurses-devel protobuf-devel openssl-devel
wget https://mosh.org/mosh-1.3.0.tar.gz
tar xf mosh-1.3.0.tar.gz -C /tmp/
cd /tmp/mosh-1.3.0
./configure
make -j7
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
tnoremap <Esc> <C-\><C-n>
tnoremap jj <C-\><C-n>
au TermOpen * set number
@Khalian
Khalian / install_neovim_to_amazonlinux.sh
Created September 11, 2017 07:24 — forked from kawaz/install_neovim_to_amazonlinux.sh
install neovim to amazonlinux
#!/usr/bin/env bash
sudo yum groups install -y Development\ tools
sudo yum install -y cmake
sudo yum install -y python34-{devel,pip}
sudo pip-3.4 install neovim --upgrade
(
cd "$(mktemp -d)"
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
# Mac specific stuff
alias rmDerivedData="rm -rf ~/Library/Developer/Xcode/DerivedData"
alias cdDerivedData="cd ~/Library/Developer/Xcode/DerivedData"
# FZF specific stuff
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
alias tb="nc termbin.com 9999"
# Git specific stuff
#!/bin/sh
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@Khalian
Khalian / remcharafter
Created August 6, 2017 07:51
Remove all characters after a given character.
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: remcharafter character"
exit 1
fi
cut -f1 -d"$1"
@Khalian
Khalian / tinyurl.sh
Created July 2, 2017 02:44
Create Tiny url in cli.
#!/bin/sh
wget -q -O - \
-U "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8" \
--header="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1" \
--header="Accept-Language: en" \
--header="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" \
--referer="http://tinyurl.com/" \
--header="Content-Type: application/x-www-form-urlencoded" \
--post-data="url=$*" \
http://tinyurl.com/create.php \