Skip to content

Instantly share code, notes, and snippets.

View vrde's full-sized avatar
🗿

vrde vrde

🗿
View GitHub Profile
@kosamari
kosamari / serviceworker.js
Created June 21, 2016 21:22
cache index.html using Service Worker
/*
* CHALLANGE:
* Cache `index.html` file using service worker.
*
* This bit of code is included in <script> tag of index.html
* if (navigator.serviceWorker) {
* navigator.serviceWorker.register('serviceworker.js', {scope: '/'})
* }
*
*/
@rianhunter
rianhunter / unintuitive_sqlite_behavior.py
Created March 23, 2016 06:40
Code that unintuitively generates a "database is locked" error with the Python sqlite module
#!/usr/bin/env python3
# This code demonstrates a code sequence that will cause the Python sqlite
# to immediately generate a "database is locked" exception, even with a large
# timeout
import sqlite3
import time
import threading
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@candycode
candycode / image-arraybuffer.js
Created March 7, 2014 15:24
Create a jpg image from ArrayBuffer data
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@eimajtrebor
eimajtrebor / darktable-workflow.md
Last active September 8, 2023 13:24
My Darktable Workflow

My Darktable Workflow

Basic workflow

  • Copy a film roll (a directory of RAW images) into a directory on the machine running Darktable.
  • Import the film roll into Darktable.
  • Review the images using lighttable mode and remove any images that are beyond repair.
  • Take a snapshot of the image so we can do a before and after comparison.
  • Adjust the white balance.
  • Exposure compensation and recovery.
@rriemann
rriemann / booklet.sh
Created October 9, 2013 12:43
use pdfjam to create a nice A5 booklet
/usr/bin/pdfjam --landscape --suffix book --a4paper --trim '1cm 1cm 1cm 1cm' --clip 'true' --signature '32' -- input.pdf -
@aras-p
aras-p / preprocessor_fun.h
Last active April 12, 2024 17:24
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@masak
masak / explanation.md
Last active April 11, 2024 02:50
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@alanbriolat
alanbriolat / default.conf
Created September 28, 2011 14:01
nginx userdir + PHP-FPM
server {
listen 80;
server_name localhost;
# ... other default site stuff, document root, etc. ...
location ~ ^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
alias /home/$userdir_user/public_html$userdir_uri;
index index.html index.htm index.php;
autoindex on;