Skip to content

Instantly share code, notes, and snippets.

View carsonfarmer's full-sized avatar
🏖️
Remote working...

Carson Farmer carsonfarmer

🏖️
Remote working...
View GitHub Profile
@KevinAst
KevinAst / article.md
Last active March 5, 2023 13:24
Integrating GitBook with JSDoc to Document Your Open Source Project

Integrating GitBook with JSDoc to Document Your Open Source Project

Introduction

Good documentation should include two distinct elements - a Guide and an API:

  1. The Guide builds concepts, providing examples, etc.

GitBook is well suited to

@chrisveness
chrisveness / crypto-aes-gcm.js
Last active May 2, 2024 06:51
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@erynofwales
erynofwales / AlmostEquatable.swift
Created November 7, 2015 07:14
An AlmostEquatable protocol for Swift floating point types
import Foundation
public protocol AlmostEquatable {
@warn_unused_result
func ==~(lhs: Self, rhs: Self) -> Bool
}
public protocol EquatableWithinEpsilon: Strideable {
static var Epsilon: Self.Stride { get }
}
@yusugomori
yusugomori / Dropout.py
Last active March 13, 2023 05:46
Dropout Neural Networks (with ReLU)
# -*- coding: utf-8 -*-
import sys
import numpy
numpy.seterr(all='ignore')
'''
@kirsteins
kirsteins / Array -> UnsafeMutablePointer -> Array
Last active October 11, 2022 12:25
Array -> UnsafeMutablePointer -> Array
var initalArray = [1, 2, 3]
let pointer: UnsafeMutablePointer<Int> = UnsafeMutablePointer(initalArray)
let arrary = Array(UnsafeBufferPointer(start: pointer, count: initalArray.count))
@natecook1000
natecook1000 / openRanges.swift
Last active May 27, 2021 19:37
Open-ended range operators for Swift
// Open-ended range operators
//
// 100... is equivalent to 100...Int.max
// ...-100 is equivalent to Int.min...-100
// ..<3 is equivalent to Int.min..<3
import Swift
/// Conforming types provide static `max` and `min` constants.
protocol MinMaxType {
@brentp
brentp / betareg.py
Last active June 24, 2022 11:46
beta regression in statsmodels
# -*- coding: utf-8 -*-
u"""
Beta regression for modeling rates and proportions.
References
----------
Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression
in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in
Economics and Statistics, 2011.
@chris-rock
chris-rock / crypto-stream.js
Last active October 6, 2022 18:38
Encrypt and decrypt streams
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption of buffers
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
var fs = require('fs');
var zlib = require('zlib');
@rjz
rjz / stdin-and-fs-stream.js
Created March 12, 2014 05:18
Streaming from stdin or a file
// Depends on `through`
//
// $ npm install through
//
// Usage:
//
// $ echo 'hello' | node stdin-and-fs-stream.js
// $ echo 'hello' > tmp && node stdin-and-fs-stream.js tmp
//
var fs = require('fs'),
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t