Skip to content

Instantly share code, notes, and snippets.

💭
Code. Love. Defend.

Duane King duaneking

💭
Code. Love. Defend.
Block or report user

Report or block duaneking

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
@duaneking
duaneking / c99.l
Created Jun 4, 2017 — forked from codebrainz/c99.l
C99 Lex/Flex & YACC/Bison Grammars
View c99.l
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>
View gist:f9feac2bc032f804721a971363dfa8b7
### 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 / colorTempToRGB.js
Created Jul 5, 2016 — forked from paulkaplan/colorTempToRGB.js
Color Temperature to RGB
View colorTempToRGB.js
// 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;
View latency.markdown

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
View gist:afc3af18f25fea905faf
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
---
View Perlin_Tiled.cs
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;
View WavepotWindchimes.js
/*!
*
* wavepot windchimes
* nondefault.net
*
*/
var transpose = 0;
var ct = 0;
View gist:7010806
<?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");
View web_app.php
<?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);
You can’t perform that action at this time.