Skip to content

Instantly share code, notes, and snippets.

View MannarAmuthan's full-sized avatar
🖤

Amuthan Mannar MannarAmuthan

🖤
View GitHub Profile
@TACIXAT
TACIXAT / cutout.py
Last active July 17, 2024 22:47
Python OpenCV command line implementation for Photoshop's Cutout Filter
import cv2
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import numpy as np
import random
import argparse
# big thanks to this answer for the sketch
# https://stackoverflow.com/a/63647647/1176872
@evanw
evanw / 0_stackify.ts
Last active June 11, 2024 21:18
Example "stackify" algorithm for turning SSA into WASM
// This code demonstrates a simplified "stackification" algorithm to turn
// instructions in a basic block back into a tree. This is useful when
// generating WebAssembly code from assembly instructions in SSA form.
//
// It's the algorithm used by LLVM's WebAssembly backend, viewable here:
// https://github.com/llvm-mirror/llvm/blob/master/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
type InsKind =
'Add' |
'LocalSet' |
@inlife
inlife / uv_read_file.c
Created February 13, 2017 13:58
Sample for reading a file asynchronously using libuv
// Sample for reading a file asynchronously using libuv
// taken from https://www.snip2code.com/Snippet/247423/Sample-for-reading-a-file-asynchronously
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <uv.h>
static uv_fs_t openReq;
static uv_fs_t readReq;