Skip to content

Instantly share code, notes, and snippets.

@Gooseus
Gooseus / machine.js
Last active April 5, 2022 07:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@Gooseus
Gooseus / asymmetry-act.R
Last active June 14, 2018 21:56
Updated, Adapted and Commented Simulation Code for "Homophily and Contagion Are Generically Confounded in Observational Social Network Studies"
# Adapted from http://www.stat.cmu.edu/~cshalizi/homophily-confounding/asymmetry-act.R
# for R version 3.4.4 (2018-03-15)
# Simulate the asymmetric issue.
asymmetry.sim <- function (num.nodes=400,
scale=3,
offset=0,
y.noise=0.02,
friend.noms=1,
response="linear",
@Gooseus
Gooseus / awscore.nim
Created October 28, 2017 22:42
Nim AWS Request/Sigv4
#[
# AWS SDK Core Library
A core library for an ambitious attempt at a Nim AWS SDK.
]#
import os, times, math
import strutils except toLower
import sequtils, algorithm, tables, nimSHA2, unicode, uri
import httpclient, asyncdispatch, asyncfile
@Gooseus
Gooseus / aws_example.nim
Created October 27, 2017 01:08 — forked from Varriount/aws_example.nim
Nim AWS Snippets
# AWS Version 4 signing example
# EC2 API (DescribeRegions)
# See: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
# This version makes a GET request and passes the signature
# in the Authorization header.
import base64, httpclient, hmac, nimSHA2, os, times, strutils, httpcore
# ************* REQUEST VALUES *************
@Gooseus
Gooseus / s3_get_bucket_obj.nim
Last active October 25, 2017 06:57 — forked from Varriount/s3_get_bucket_obj.nim
Testing async dispatch and http requests in Nim
# testing async dispatch in pursuit of an efficient async s3 interface
import os, times, math, httpclient, asyncdispatch, asyncfile
let t0 = epochTime()
proc dt() : float =
round(epochTime() - t0,6)
const aws_url = "http://localhost:1234/"
@Gooseus
Gooseus / s3_get_bucket_obj.nim
Created October 25, 2017 05:00
Testing async dispatch and http requests in Nim
# testing async dispatch in pursuit of an efficient async s3 interface
import os, times, math, httpclient, asyncdispatch
let t0 = epochTime()
proc dt() : float =
round(epochTime() - t0,6)
const aws_url = "http://localhost:1234/"
@Gooseus
Gooseus / rx-server.js
Last active March 13, 2020 06:07
RxJS HTTP Server
// Rx HTTP Server
// first attempt at creating a minimal reactive nodejs HTTP server
//
// has:
// * url/querystring parsing
// * body parsing
// * some kind of routing
// * some kind of error handling
// * minimalist request logging
//
@Gooseus
Gooseus / pair-stream.js
Last active August 29, 2015 14:21
Finding Frequent Pairs in Lists of Items
"use strict";
/*****
Node Pair Stream
by Shawn Marincas
Consumes a CSV as a stream of item sets and outputs lines of comma-separated pairs of items that appear on the specified number of lines
- input : Stream input source, either a filename or defaults to STDIN for pipes
- threshold : Number of lines a pairs must appear on before being emitted
******/

Keybase proof

I hereby claim:

  • I am Gooseus on github.
  • I am gooseus (https://keybase.io/gooseus) on keybase.
  • I have a public key whose fingerprint is 5ABF CE96 A75E 7683 0363 A3BA A203 FFCF 0A78 1701

To claim this, I am signing this object:

@Gooseus
Gooseus / 0_reuse_code.js
Last active August 29, 2015 14:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console