Skip to content

Instantly share code, notes, and snippets.

View olih's full-sized avatar

Olivier Huin olih

View GitHub Profile
olih /
Created December 8, 2016 15:32
Scala cheatsheet


Convert Seq To Map

val map = => a.key -> a).toMap
olih /
Created November 25, 2016 10:49
Redis cheetsheet based on Official documentation

Redis Commands:

  • APPEND key value Append a value to a key
  • AUTH password Authenticate to the server
  • BGREWRITEAOF Asynchronously rewrite the append-only file
  • BGSAVE Asynchronously save the dataset to disk
  • BITCOUNT key start end Count set bits in a string
  • BITFIELD key GET type offset SET type offset value INCRBY type offset increment OVERFLOW WRAP|SAT|FAIL Perform arbitrary bitfield integer operations on strings
  • BITOP operation destkey key key ... Perform bitwise operations between strings
  • BITPOS key bit start end Find first bit set or clear in a string
olih /
Last active November 30, 2016 10:28
R programming cheatsheet


On linux

sudo yum install -y epel-release
sudo yum install R

On Mac OS

SSL cheetsheet

Encode file with password

alias enc='openssl enc -e -aes128 -base64 -pass "env:PASS"'

Decode file with password

alias dec='openssl enc -d -aes128 -base64 -pass "env:PASS"'
olih /
Last active December 21, 2023 10:10
Awk and Sed cheetsheet

awk & sed cheetsheet

Extract lines between start and end

between() { sed -n "/^$1/,/^$2/p" | sed '1d;$d'; }


awk '/^START=A$/,/^END$/ { print }’ data
olih /
Last active May 15, 2024 22:26
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

olih /
Last active August 29, 2015 14:28
# .
aws_access_key_id=`curl${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
aws_secret_access_key=`curl${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
aws_session_token=`curl${instance_profile} | grep Token | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
olih /
Last active August 29, 2015 14:23
A few basic tools to install by default
sudo yum install -y epel-release
sudo yum install -y nano
sudo yum install -y git
#Install Amazon Client
curl -O
sudo python
#Install pip
sudo easy_install pip
olih /
Created June 23, 2015 10:57
Curl with custom CA certificates

Using curl with custom CA certificates

This document describes how to use curl with both custom and official CA SSL certificates.


You would need first to install curl , see Using a package manager such as yum, brew, ... for your platform should be the easiest though.

Example for Mac OS: