Skip to content

Instantly share code, notes, and snippets.

Avatar

Kane York riking

  • Fremont
View GitHub Profile
@riking
riking / gist:3e2aafc6315e10b1e296e0f0ad2688e3
Last active Jul 15, 2020
hash array mapped table immutable overlay node
View gist:3e2aafc6315e10b1e296e0f0ad2688e3
enum HAMTOverlay<K, V, Hash> {
Empty(),
FullTable(&[Self; 32]),
SingleKey(Hash::Hash, K, V, Rc<Self>),
SingleSubtree(Hash::Hash, Rc<Self>, Rc<Self>),
}
impl ... for SingleKey {
fn lookupWithHash(&self, k: K, h: Hash::Hash) -> Option<V> {
@riking
riking / beancount-export-patreon.js
Last active Aug 15, 2019
Beancount exporter for Patreon transactions.
View beancount-export-patreon.js
(function() {
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@riking
riking / .zshrc
Created Jul 26, 2018
Goinfre setup scripts
View .zshrc
# ...
# usage: mkrmrln <goinfre path> <home folder path>
function mkrmrln() {
mkdir -p $1
rm -rf $2
ln -s $1 $2
}
mkrmrln /goinfre/$(whoami) ~/goinfre
View colors-LUV.lua
XYZA.EPSILON = math.pow(6 / 29, 3)
XYZA.KAPPA = math.pow(29 / 3, 3)
XYZA.WHITE = XYZA.fromRGBA(255,255,255,1)
function bit2linear(channel)
--[[
http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html
This converts rgb 8bit to rgb linear, lazy because the other algorithm is really really dumb
]]
-- return Math.pow(channel, 2.2); -- use in shader cores
View gist:345a4d1b3bd0a984a779eced2c05c394
#include <signal.h>
#include <stdio.h>
#include <malloc.h>
#include <setjmp.h>
#include <stdbool.h>
static jmp_buf omg;
struct list {
char dummy[16384];
View TDeck color fix.css
@-moz-document domain("tweetdeck.twitter.com") {
html.dark .column,
html.dark .stream-item {
background-color: #222426;
}
html.dark .detail-view-inline-text {
background: #fff;
color: #8899a6;
}
html.dark a,
View gist:71d1c29a8112e8919075d31f32c540a6
kane@kane-TECRA-Z40-B:~/gocode/src/livesplit$ cat core.go
package livesplit
func Hello() int {
return 43
}
kane@kane-TECRA-Z40-B:~/gocode/src/livesplit$ cat cmd/livesplit/livesplit.go
package main
import "fmt"
View list.go
package list
import (
"fmt"
"io"
)
// generics - swap out V1 for a new implementation
type V1 int32
type I1 interface {
@riking
riking / colorfix.js
Created Jan 26, 2017
color fixing code extracted from ffz
View colorfix.js
// SOURCE: https://github.com/FrankerFaceZ/FrankerFaceZ/blob/master/src/colors.js
RGBAColor.prototype.luminance = function() {
var r = bit2linear(this.r / 255),
g = bit2linear(this.g / 255),
b = bit2linear(this.b / 255);
return (0.2126 * r) + (0.7152 * g) + (0.0722 * b);
}
View gist:eb9b41b0f8a0fd5f15762350a61cb9da
javascript:(function(){var e=document.body.style.cursor;document.body.style.cursor="crosshair";var t=document.createElement("div");var n="border:1px solid #3280FF;background-color:rgba(50,128,255,0.5);position:absolute;z-index:2147483647;display:none;";var r="pointer-events:none;";var i="transition:width 60ms,height 60ms,left 60ms,top 60ms;";n+=r+"-webkit-"+r+"-moz-"+r;n+=i+"-webkit-"+i+"-moz-"+i;t.setAttribute("style",n);document.body.appendChild(t);var s=null;var o=function(e){var n=e.target;if(n!==s&&n.parentNode){var r=n.getBoundingClientRect();var i=document.documentElement;var o=document.body;var u=i.clientTop||o.clientTop||0;var a=i.clientLeft||o.clientLeft||0;var f=window.pageYOffset||i.scrollTop||o.scrollTop;var l=window.pageXOffset||i.scrollLeft||o.scrollLeft;var c=l-a+r.left-1;var h=f-u+r.top-1;t.style.display="block";t.style.left=c+"px";t.style.top=h+"px";t.style.width=r.width+"px";t.style.height=r.height+"px";s=n}};var u=function(n){document.body.style.cursor=e;if(n.target.parentNode)n.target.par
You can’t perform that action at this time.