Skip to content

Instantly share code, notes, and snippets.

View Laurian's full-sized avatar

Laurian Gridinoc Laurian

  • Creative Technologist ※ Knight-Mozilla OpenNews Fellow ※ Visual analytics × Computational Linguistics × Semantic Web
  • Cyberspace
  • X @gridinoc
View GitHub Profile
@kishmiryan-karlen
kishmiryan-karlen / Apply LUT (LookUpTable).js
Created August 13, 2014 12:59
A function that helps to apply LUT to image. Make sure to change the canvas IDs or to create temporary canvases.
/**
* Created by Karlen on 13-Aug-14.
*/
var imageContext = document.getElementById('imageCanvas').getContext('2d'),
lutContext = document.getElementById('lutCanvas').getContext('2d');
function applyLUT(image, lut) {
var imageData, lutData, iData, lData;
@grugq
grugq / gist:03167bed45e774551155
Last active April 15, 2025 11:22
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@josephg
josephg / react.html
Created July 28, 2014 20:48
ShareJS react demo
<!DOCTYPE html>
<html>
<head>
<title>Hello React</title>
<link rel="stylesheet" href="base.css" />
<script src="http://fb.me/react-0.11.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.11.0.js"></script>
<script src="channel/bcsocket.js"></script>
<script src="share.uncompressed.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
# IMPORTANT: this example is potentially out of date. The latest version can be found here: https://github.com/papertrail/remote_syslog2/blob/master/examples/remote_syslog.ebextensions.config
# See http://help.papertrailapp.com/kb/hosting-services/aws-elastic-beanstalk/
# Usage:
# - replace <VERSION> with the version of remote_syslog2 you want to use. Example: .../download/v0.14/remote_syslog_linux_amd64.tar.gz
# - replace <YOUR-TRACKED-FILES> with the files you want to monitor for new log lines. Example: - /var/log/httpd/access_log
# - replace <YOUR-APP-NAME> with the name of the application
# - replace <YOUR-LOG-DESTINATION> and <YOUR-PORT-NUMBER> with the values shown under log destinations: https://papertrailapp.com/account/destinations
sources:
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama
@staltz
staltz / introrx.md
Last active May 9, 2025 12:50
The introduction to Reactive Programming you've been missing
@hdragomir
hdragomir / sm-annotated.html
Last active February 2, 2025 02:22
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@mbostock
mbostock / .block
Last active August 5, 2019 23:43
Zoom to Bounding Box II
license: gpl-3.0
redirect: https://observablehq.com/@d3/zoom-to-bounding-box
#!/bin/bash
BASE_DIR=${TMPDIR:-/var/tmp}
ORIG_DIR=$PWD
HASH_CMD="md5sum"
DIR_NAME=`echo $PWD | $HASH_CMD | cut -f1 -d " "`
TMP_DIR=$BASE_DIR/$DIR_NAME
mkdir -p $TMP_DIR

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
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 4X memory