Simple and safe random getters to copy-paste
string randomBytes( int $length )
int randomInt ( int $min , int $max )
string randomUuid ( void )
'use strict'; | |
var modelConfig = require('../model-config.json'); | |
module.exports = function(app) { | |
app.use(function(req, res, next) { | |
// set tenant based subdomain or use public | |
var subdomain = (req.subdomains.length > 1) ? req.subdomains.pop() : req.subdomains[0]; | |
var tenant = req.subdomains.pop() || 'public'; |
<!-- | |
<form autocomplete="off"> will turn off autocomplete for the form in most browsers | |
except for username/email/password fields | |
--> | |
<form autocomplete="off"> | |
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields --> | |
<input id="username" style="display:none" type="text" name="fakeusernameremembered"> | |
<input id="password" style="display:none" type="password" name="fakepasswordremembered"> | |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
-Dawt.useSystemAAFontSettings=lcd | |
-Dswing.aatext=true |
// 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, |
username: vagrant | |
password: vagrant | |
sudo apt-get update | |
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev | |
sudo aptitude install mysql-server mysql-client | |
sudo nano /etc/mysql/my.cnf |
# Only listen on http; disable ajp and https | |
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1 |
<?php | |
/** | |
* Shit for handling IPv6 & mysql storage, @gsphpdev | |
* Bloody headache... remember this Gavin! | |
*/ | |
/** | |
* Only PHP 5.4+ has this function so need to add one if not |
#!/bin/bash | |
# RESULTS, feel free to repro yourself | |
# | |
# noLock FAIL | |
# accessShare FAIL | |
# rowShare FAIL | |
# rowExclusive FAIL | |
# shareUpdateExclusive SUCCESS | |
# share FAIL+DEADLOCKS | |
# shareRowExclusive SUCCESS |