Skip to content

Instantly share code, notes, and snippets.

View olih's full-sized avatar

Olivier Huin olih

View GitHub Profile
@olih
olih / jq-cheetsheet.md
Last active May 3, 2024 17:42
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
olih / curl-ca.md
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.

Prerequisite

You would need first to install curl , see http://curl.haxx.se/docs/install.html. Using a package manager such as yum, brew, ... for your platform should be the easiest though.

Example for Mac OS:

@olih
olih / awk-sed-cheetsheet.md
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'; }

Also:

awk '/^START=A$/,/^END$/ { print }’ data

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
olih / redis.md
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
olih / scala-cheatsheet.md
Created December 8, 2016 15:32
Scala cheatsheet

Scala

Convert Seq To Map

val map = seq.map(a => a.key -> a).toMap
@olih
olih / r-cheetsheet.md
Last active November 30, 2016 10:28
R programming cheatsheet

Installation

On linux

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

On Mac OS

@olih
olih / 4xx.md
Last active December 23, 2015 08:29
Http 4xx Error Status summary
method path header query,entity status description
- - - Any 400 Bad Request The request could not be understood by the server due to malformed syntax
- - Any Any 403 Forbidden The server understood the request, but is refusing to fulfill it
- Any - - 404 Not Found The server has not found anything matching the Request-URI
Any - - - 405 Method Not Allowed The method specified (GET, PUT...) in the Request-Line is not allowed for the resource
- - Any - 412 Precondition Failed The precondition given in one or more of the request-header fields evaluated to false
- - Any - 431 Request Header Fields Too Large (RFC 6585) The server is unwilling to process the the header fields are too large.
- - - Any 413 Request Entity Too Large The server is refusing to process a request because the request entity is too large
- - - Any 414 Reques
@olih
olih / password.coffee
Created August 14, 2013 11:09
Generate a random password for admin purposes
#
#Creator: 2013, Olivier Huin (https://github.com/olih)
#License: Eclipse Public License - v 1.0
#Contributors:
#
# Generates a random password
#This code is a quick hack and should not be used for production
#as it is not optimized and the random numbers could be predicted.
G=10000000000