Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hermantolim
hermantolim / quantize.js
Created January 9, 2023 00:39 — forked from nrabinowitz/quantize.js
Javascript module for color quantization, based on Leptonica
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@hermantolim
hermantolim / QR Code Scanner
Created March 22, 2022 12:50 — forked from DeadlySystem/QR Code Scanner
This is code that provides an interface to let you select the camera to be used with jsqrcode ( https://github.com/LazarSoft/jsqrcode ). To make it work, you will have to include said library and have elements with the IDs in the loadCommonHTMLElements method on your page. You may want to provide appropriate styling as well. This source code is …
"use strict";
define(["require", "exports"], function (require, exports) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Browser compatibility definitions
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private state
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var qrcodescanner = null;

Keybase proof

I hereby claim:

  • I am hermantolim on github.
  • I am hermantolim (https://keybase.io/hermantolim) on keybase.
  • I have a public key ASBq4cdchPkmQJVSRUZ7Nw2O9xJZvfOajlzuP0M2ubjIzAo

To claim this, I am signing this object:

@hermantolim
hermantolim / software-vs-hardware-raid.md
Last active July 20, 2018 11:04
Software vs hardware RAID performance and cache usage

source: https://serverfault.com/questions/685289/software-vs-hardware-raid-performance-and-cache-usage

In short: if using a low-end RAID card (without cache), do yourself a favor and switch to software RAID. If using a mid-to-high-end card (with BBU or NVRAM), then hardware is often (but not always! see below) a good choice.

Long answer: when computing power was limited, hardware RAID cards had the significant advantage to offload parity/syndrome calculation for RAID schemes involving them (RAID 3/4/5, RAID6, ecc).

However, with the ever increasing CPU performance, this advantage basically disappeared: even my laptop's ancient CPU (Core i5 M 520, Westmere generation) have XOR performance of over 4 GB/s and RAID-6 syndrome performance over 3 GB/s over a single execution core.

The advantage that hardware RAID maintains today is the presence of a power-loss protected DRAM cache, in the form of BBU or NVRAM. This protected cache give very low latency for random write access (and reads that hit