Skip to content

Instantly share code, notes, and snippets.

@gununu
gununu / gilpreview.hpp
Created July 12, 2010 15:32
boost::gil preview library for windows
/*
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (http://www.boost.org/LICENSE_1_0.txt).
*/
#ifndef GUNUNU_GIL_PREVIEW_HPP
#define GUNUNU_GIL_PREVIEW_HPP
#include <windows.h>
#pragma comment(lib, "user32")
@sixtenbe
sixtenbe / analytic_wfm.py
Last active May 27, 2024 01:24 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@JoshuaEstes
JoshuaEstes / 000-Cheat-Sheets.md
Last active May 1, 2024 04:03
Developer Cheat Sheets for bash, git, gpg, irssi, mutt, tmux, and vim. See my dotfiles repository for extra info.
@jboner
jboner / latency.txt
Last active July 28, 2024 20:49
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@campagnola
campagnola / make_png.py
Last active August 19, 2022 04:13
Pure python PNG writer
import numpy as np
import zlib
import struct
def make_png(data):
"""
Convert numpy array to PNG byte array.
*data* must be (H, W, 4) with dtype=ubyte
"""

Interactive Machine Learning

Taught by Brad Knox at the MIT Media Lab in 2014. Course website. Lecture and visiting speaker notes.

@justmiles
justmiles / ipa.tf
Last active September 9, 2022 06:06
Deploy FreeIPA in AWS using Terraform
# Notes:
# You'll need to update any references to 'module.vpc' with your VPC's info (subnets, security groups, etc)
# If you define your subnets as a map, this will deploy different replicas across availabity zones. Note
# that the master and first replica will be in the same AZ.
#
# Look through the 'connection' fields and update with your bastion_host/key combos
#
# Number of IPA Replica(s) to deploy
variable "ipa_replicas" {
@MMesch
MMesch / robust_splines_sklearn.py
Last active July 6, 2023 23:04
Robust Spline Regression with Scikit-Learn
#!/usr/bin/env python
"""
Robust B-Spline regression with scikit-learn
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as si
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
@ChrisDowning
ChrisDowning / slurm.conf
Last active February 21, 2022 09:23
OpenHPC PEARC20 slurm.conf file for a dynamic cluster
ClusterName=pearc20
ControlMachine=ip-192-168-0-100
SlurmUser=slurm
SlurmctldPort=6817
SlurmdPort=6818
AuthType=auth/munge
StateSaveLocation=/var/spool/slurm/ctld
SlurmdSpoolDir=/var/spool/slurm/d
SwitchType=switch/none
@ChrisDowning
ChrisDowning / slurm-aws-shutdown.sh
Last active February 21, 2022 09:22
OpenHPC PEARC20 Slurm node shutdown script for a dynamic cluster
#!/bin/bash
export SLURM_ROOT=/etc/slurm
export CLUSTER_REGION=$(curl -sS http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region')
export SLURM_POWER_LOG=$SLURM_ROOT/power_save.log
export PATH=$PATH:/usr/local/bin:/usr/bin
function aws_shutdown()
{
COMPUTE_INSTANCE=$(aws ec2 describe-instances \