Skip to content

Instantly share code, notes, and snippets.

View shankarnakai's full-sized avatar
🤓
System programming, Rust, low latency, Databases

Shankar Nakai Gonçalves dos Santos shankarnakai

🤓
System programming, Rust, low latency, Databases
View GitHub Profile
@weefbellington
weefbellington / mergesort.hs
Last active July 12, 2018 02:37
mergesort implementation for learning Haskell
import Debug.Trace
main :: IO()
main = do
let sorted = mergeSort [6, 5, 3, 1, 8, 7, 2, 4]
print sorted
mergeSort :: (Ord a, Show a) => [a] -> [a]
-- mergeSort lst | trace ("sorting: " ++ show lst) False = undefined
mergeSort [] = []
@vasanthk
vasanthk / System Design.md
Last active September 29, 2025 11:28
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@coderofsalvation
coderofsalvation / higherorder.bash
Last active July 23, 2019 15:17
minimal functional programming in bash with associative array, prevent pyramid of doom
#!/bin/bash
# higher order functions for bash
array(){
declare -A "$@"
}
# foreach
# example:
# array foo
@soroushjp
soroushjp / deepcopy.go
Last active June 14, 2025 11:49
Golang: deepcopy map[string]interface{}. Could be used for any other Go type with minor modifications.
// Package deepcopy provides a function for deep copying map[string]interface{}
// values. Inspired by the StackOverflow answer at:
// http://stackoverflow.com/a/28579297/1366283
//
// Uses the golang.org/pkg/encoding/gob package to do this and therefore has the
// same caveats.
// See: https://blog.golang.org/gobs-of-data
// See: https://golang.org/pkg/encoding/gob/
package deepcopy
@mrlesmithjr
mrlesmithjr / ansible-macos-homebrew-packages.yml
Last active January 21, 2025 16:34
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
; Path of Exile macros
; go to hideout
#IfWinActive, Path of Exile
^h:: Send {Enter}+{Home}^c/hideout{Enter}{Enter}^v{Escape}
; logout
#IfWinActive, Path of Exile
$^l:: Send {Enter}+{Home}^c/exit{Enter}{Enter}^v{Escape}
@flyingluscas
flyingluscas / InstallPopcornTime.md
Last active April 19, 2023 01:51
Installing Popcorn Time on Ubuntu 16.x

1. Downloading

32 bits version

$ wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-32.tar.xz -O popcorntime.tar.xz

64 bits version

@ronoaldo
ronoaldo / swf2mp4.sh
Created August 8, 2017 20:28
Converte SWF para MP4
#!/bin/bash
echo "swf2mp4.sh - flash player to mp4 conversion script"
echo " * Requires gnash, mplayer2 and ffmpeg CLI tools"
echo " * Source https://stackoverflow.com/a/39304421 (Aleksey Kontsevich)"
SWFFILE=$1
MP4FILE=${SWFFILE%.*}.mp4
TMPFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).bin
@birdayz
birdayz / reflect.json
Created September 23, 2018 23:04
Javalin GraalVM reflection config
[
{
"name": "[Lorg.eclipse.jetty.servlet.ServletMapping;",
"allDeclaredFields": true,
"allPublicFields": true,
"allDeclaredMethods": true,
"allPublicMethods": true
},
{
"name": "org.slf4j.impl.StaticLoggerBinder",
@luismts
luismts / GitCommitBestPractices.md
Last active September 26, 2025 16:08
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.