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 [] = []
import java.security.MessageDigest
import java.util
import javax.crypto.Cipher
import javax.crypto.spec.SecretKeySpec
import org.apache.commons.codec.binary.Base64
/**
* Sample:
* {{{
* scala> val key = "My very own, very private key here!"
@justmoon
justmoon / custom-error.js
Last active November 19, 2024 02:40 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@srsudar
srsudar / background.html
Created July 27, 2014 18:00
Pasting from the system clipboard using a Chrome extension.
<!DOCTYPE html>
<html>
<head>
<script src="background.js"></script>
</head>
<body>
<textarea id="sandbox"></textarea>
</body>
@andreberg
andreberg / PoE-Macros.ahk
Last active June 21, 2022 18:16
[Path of Exile Autohotkey Macros] Shows how to bind some (really outdated!) commands to hotkeys. #pathofexile #poe #ahk #autohotkey #macros
#IfWinActive, Path of Exile ahk_class Direct3DWindowClass
#SingleInstance force
; Menu tooltip
Menu, tray, Tip, Path of Exile Macros
; NOTE: Adjust this path so it is correct.
; If you are using my PoE-Item-Info script you can find
; the tray icons inside its data directory.
Menu, tray, Icon, PoE Item Info\data\poe-web.ico
@mflatt
mflatt / functional.rkt
Created January 16, 2014 17:13
Programs by Jay and Matthew at Lambda Lounge Utah, 14 Jan 2014: * "functional.rkt" is from Jay's introduction to functional programming * "web.rkt" and "page.rkt" are from Matthew's explanation of Racket macros & modules
#lang racket
(require rackunit)
;; A singly linked list is either
;; - NULL
;; - pointer to data and a pointer a sll
(struct node (data-ptr next-ptr))
(define n4 (node 4 null))
@albrow
albrow / confirm.go
Last active April 16, 2023 03:03
Go (golang): How to ask for user confirmation via command line
import (
"fmt"
"log"
"os"
"sort"
)
// askForConfirmation uses Scanln to parse user input. A user must type in "yes" or "no" and
// then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as
// confirmations. If the input is not recognized, it will ask again. The function does not return
@brigand
brigand / GDIpHelper.ahk
Created October 23, 2012 20:28
Helper Library for GDIp library Based On Tic's tutorial #1
JustTheBasics() {
global
; Start gdi+
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 5, 2025 08:14
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@langmi
langmi / CustomSqlParameterSourceProvider.java
Created September 30, 2011 09:14
simple example CustomSqlParameterSourceProvider which constructs a MapSqlParameterSource with given item
/**
* CustomSqlParameterSourceProvider, constructs {@link MapSqlParameterSource} with
* given item.
*
* @author Michael R. Lange <[email protected]>
*/
public class CustomSqlParameterSourceProvider implements ItemSqlParameterSourceProvider<YourItemObject> {
@Override
public SqlParameterSource createSqlParameterSource(final YourItemObject item) {