Skip to content

Instantly share code, notes, and snippets.

Toby DiPasquale codeslinger

Block or report user

Report or block codeslinger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
codeslinger / black-scholes.c
Created Jul 12, 2010 — forked from ecounysis/LICENSE.txt
Black-Scholes Option Pricing Model in C
View black-scholes.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double Normal(double);
double N(double, double, double, double, double);
double delta(double, double, double, double, double);
double delta2(double, double, double);
double ND2(double, double, double);
codeslinger /
Created Dec 5, 2017 — forked from stevenringo/
Links to YouTube recordings of AWS re:Invent 2017 sessions

| Title | Description

codeslinger /
Created Sep 8, 2017 — forked from O-I/
[TIx 8] Weighted Random Sampling in Ruby

One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.

Let's take the example of simulating the rolling of a die.

We can represent a die as an array of its faces.

die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
codeslinger / variants.c
Created Jun 26, 2017
Tagged unions (a.k.a variants) in C
View variants.c
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#define var __auto_type
#define let __auto_type const
static inline void * variant_cast(void * variant_ptr, ptrdiff_t desired_tag) {
ptrdiff_t * variant_tag = (ptrdiff_t *)variant_ptr;
assert(*variant_tag == desired_tag);
codeslinger /
Last active Apr 20, 2017
Handy Python functions
# Applies functions in `fs` in order whose input starts with `iv` and
# each function's output is fed into the next function in the chain.
# Should any function return `None`, the chain is broken, execution
# stops and `None` is returned.
def chain(iv, *fs):
v = iv
for f in fs:
v = f(v)
if v is None:
#!/usr/bin/env python2.7
from __future__ import print_function
import commands
import os
import stat
from gitlab import Gitlab
def get_clone_commands(token, repo_root):
con = Gitlab("http://gitlab.your.domain", token)
codeslinger / reclaimWindows10.ps1
Created Jan 9, 2017 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via (different defaults)
View reclaimWindows10.ps1
# Win10 Initial Setup Script
# Author: Disassembler <>
# Version: 1.7, 2016-08-15
# dasm's script:
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
codeslinger / CircularFIFO.h
Created Jan 3, 2016
SPMC ring buffer implementation in C++ from DKit
View CircularFIFO.h
* CircularFIFO.h - this file defines the template class for a single-producer,
* multi-consumer, circular FIFO queue with a size initially
* specified in the definition of the instance. This queue
* is completely thread-safe so long as there is ONE and ONLY
* ONE thread placing elements into this container, and there
* can be as many as necessary remobing them from the queue.
* The syntax is very simple - push() will push an element,
* returning 'true' if there is room, and the value has been
* placed in the queue.
View gist:23f5094536ce640ea43aaab536dfd2bf
# basic pfctl control
# ==
# Related:
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
codeslinger /
Created May 14, 2016 — forked from zg/
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.


  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.


You can’t perform that action at this time.