Skip to content

Instantly share code, notes, and snippets.

View duaneking's full-sized avatar
🏡
Working From Home. Code. Love. Defend.

Duane King duaneking

🏡
Working From Home. Code. Love. Defend.
View GitHub Profile
/*!
*
* wavepot windchimes
* nondefault.net
*
*/
var transpose = 0;
var ct = 0;
public class Perlin {
public int repeat;
public Perlin(int repeat = -1) {
this.repeat = repeat;
}
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
Ok so I was hoping tht pycharm would respect my virtialenv but apperently it did not.
Duanes-Air-4:crown Duane$ pip show cqlsh cqlengine six cassandra-driver
---
Name: cqlsh
Version: 4.1.1
Location: /Library/Python/2.7/site-packages
Requires: cql, simplejson, unittest2
---

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

<?php
// minimal routing
function web_app($routes, $verb, $path) {
$verb = strtoupper($verb);
$path = trim(parse_url($path, PHP_URL_PATH), '/');
foreach ($routes as $route => $func) {
@list($req_verb, $req_path) = preg_split('/\s+/', $route, 2);
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@duaneking
duaneking / colorTempToRGB.js
Created July 5, 2016 01:05 — forked from paulkaplan/colorTempToRGB.js
Color Temperature to RGB
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;
### Keybase proof
I hereby claim:
* I am duaneking on github.
* I am dfk (https://keybase.io/dfk) on keybase.
* I have a public key whose fingerprint is 9C92 9D9B 982A 9067 6057 FDED 3D39 F25A B4D7 CAF0
To claim this, I am signing this object:
@duaneking
duaneking / c99.l
Created June 4, 2017 03:31 — forked from codebrainz/c99.l
C99 Lex/Flex & YACC/Bison Grammars
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>
@duaneking
duaneking / clouds.md
Created September 4, 2021 04:12 — forked from miglen/clouds.md
AWS & GCP explained in simple English

Amazon Web Services (AWS) & Google Cloud Platform (GCP) explained in simple English

This guide is only representative from my point of view and it may not be accurate and you should go on the official AWS & GCP websites for accurate and detailed information. It's initially inspired by AWS in simple English and GCP for AWS professionals. The idea is to compare both services, give simple one-line explanation and examples with other software that might have similiar capabilities. Comment below for suggestions.

Category Service AWS GCP Description It's like
Compute IaaS Amazon Elastic Compute Cloud (EC2) Google Compute Engine Type-1 virtual servers VMware ESXi, Citrix XenServer
  PaaS AWS Elastic Beanstalk Google App Engine Running your app on a platform