Skip to content

Instantly share code, notes, and snippets.

View peterforgacs's full-sized avatar

Peter Forgacs peterforgacs

View GitHub Profile
@a-sync
a-sync / install-opencv.sh
Last active November 25, 2021 12:36
OpenCV + extra modules install script for Ubuntu 16.04
#!/bin/bash
# https://gist.github.com/a-sync/276fbb5776ad5d5775d1bd6205e22a4a
OPENCV_VERSION="3.4.3"
read -p "Install/update dependencies? ([Yy] or skip this step) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@skeggse
skeggse / crypto-pbkdf2-example.js
Last active April 17, 2024 21:04
Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
var crypto = require('crypto');
// larger numbers mean better security, less
var config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();