Skip to content

Instantly share code, notes, and snippets.

View nicokosi's full-sized avatar

Nicolas Kosinski nicokosi

View GitHub Profile
@nicokosi
nicokosi / git-cheat-sheet.sh
Last active February 19, 2024 06:11
My own git cheat sheet
### BRANCHES
git checkout -b <branch name> # Create a branch
git branch -r # List remote branches
git checkout <branch name> # Switch to branch (deprecated)
git switch <branch name> # Switch to branch
git checkout <commit ID> # Locally retrieve an old revision
git fetch # retrieve remote changes (commits) without changing local repo ; can be used to fix sync issue
git branch -D branchName # delete local branch
git branch -m <newname> # rename current local branch
git push origin --delete <branchName> # delete remote branch
-- http://learnyouahaskell.com
-- Starting out
-----------------------------------------------------------------------------------
-- baby's first functions http://learnyouahaskell.com/starting-out#babys-first-functions
doubleMe x = x + x
doubleUs x y = doubleMe x + doubleMe y
doubleSmallNumber x = if x > 100
then x
@nicokosi
nicokosi / proglang.sml
Last active February 9, 2017 19:30
Notes about Coursera "Programming Languages": https://www.coursera.org/course/proglang - part 1 (ML)
Programming languages
(* Emacs tips :
open file: ctr-c ctr-f
copy: M-w, paste: ctr+y
save file: ctr+x ctr+s,
next/previous buffer: ctr+x left/right:
start REPL: ctr+c ctr+s sml, stop REPL: ctr+c ctr+d
stop command interpreter: ctr-g
split window vertically: C-x 2
@nicokosi
nicokosi / proglang.rkt
Last active June 4, 2017 09:29
Notes about Coursera "Programming Languages": https://www.coursera.org/course/proglang - part 2 (Racket)
( Introduction to Racket:
Racket:
- functional focus
- with imperative features
- dynamically-types
- minimalist syntax
- advanced features: modules, macros, etc...
(note: we will not use pattern matching, but it exists)
@nicokosi
nicokosi / proglang.rb
Last active August 29, 2015 14:09
Notes about Coursera "Programming Languages": https://www.coursera.org/course/proglang - part 3 (Ruby)
Part 3
Introduction to Ruby {
Our focus {
Pure Object-Oriented
no primitives (even numbers)
Class-based
Every object has a class that determines behavior (like Java)
// array
var myArray = [1, 2, 3];
// set
var mySet = { "foo": true, "bar": true, "baz": true };
set.foo // true
set.notExists // false
var object = { id: 126878, name: "ZALTRAP 25 mg/ml sol diluer p perf", sid: "vidal://product/126878", title: "ZALTRAP 25 mg/ml sol diluer p perf" };
@nicokosi
nicokosi / docker-nightclazz-découverte.md
Last active August 29, 2015 14:14
Notes durant le Docker nightclazz découverte de Zenika, le 05/02/2015

Docker nightclazz découverte

05/02/2015 par Mario Loriedo & Vincent Demeester

C'est une intro, prochaine session dans 1 mois

Intro

  • outil pour partager env de dev et env de prod (sysadmin) #devops: "build, ship and run" via conteneurs => + rapide, automatisation
@nicokosi
nicokosi / linux-perf-tools.sh
Last active December 8, 2016 12:19
Some examples of Linux performance command lines as demonstrated by Brendan Gregg in video "Linux Performance Tools":http://techblog.netflix.com/2015/08/netflix-at-velocity-2015-linux.html
# CPU & mem usage per process (sampling)
top # list processes
top -h # list threads
top -c # show full command line
htop
# CPU usage per CPU:
mpstat -P ALL 1
# Processes (uptime, hierarchy, CPU usage, etc...):
import System.CPUTime
fibo :: Int -> Int
fibo n
| n <= 1 = n
| otherwise = fibo(n - 1) + fibo(n - 2)
getCPUTimeDouble :: IO Double
getCPUTimeDouble = do t <- System.CPUTime.getCPUTime; return ((fromInteger t) * 1e-12)
@nicokosi
nicokosi / neo4j-gistgraph-for-fake-telco.adoc
Last active December 21, 2015 07:56
A Neo4J gistgraph (http://neo4j.com/graphgist) for a fake telco use case. Can be submitted on http://portal.graphgist.org/submit_graphgist.

Fake Telco

Let’s say that a ake telco needs to answer various questions such as:

  • contracts that are not used by any clients

  • etc…​

Setup graph: