Skip to content

Instantly share code, notes, and snippets.

View tdumitrescu's full-sized avatar
🌯

teddddd tdumitrescu

🌯
View GitHub Profile
@wolever
wolever / lolmutex.js
Created February 28, 2017 23:24
A LocalStorage-based mutex. Guarantees¹ that only one browser window will be able to execute a callback at a time.
/**
* A LocalStorage-based mutex. Guarantees¹ that only one browser window will be
* able to execute the code inside the callback at a time.
*
* Based on the Alur and Taubenfeld fast lock
* (http://www.cs.rochester.edu/research/synchronization/pseudocode/fastlock.html)
* with an added timeout to ensure there will be eventual progress in the event
* that a window is closed in the middle of the callback.
*
* 1. The guarantee assumes that the algorithm is correctly implemented.
@deviantony
deviantony / phantomjs
Last active January 4, 2018 17:18 — forked from wbotelhos/phantomjs_intaller.sh
Installer script to setup phantomjs 1.9.7, it will remove any previous setup. Contains also the init script to manage phantomjs as a system service and the default configuration file. Tested on Ubuntu 12.04.
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <lapenna.anthony@gmail.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Phantomjs service"
NAME=phantomjs
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME