Skip to content

Instantly share code, notes, and snippets.

View kwizzn's full-sized avatar

Chris Neuhäuser kwizzn

View GitHub Profile
@kwizzn
kwizzn / csrf-demo.php
Created July 9, 2015 09:12
Simple PHP CSRF form protection demo
<?php
function storeCsrfInSession($key, $value) {
if (isset($_SESSION)) {
$_SESSION[$key] = $value;
}
}
function removeCsrfFromSession($key) {
$_SESSION[$key] = ' ';

Keybase proof

I hereby claim:

  • I am kwizzn on github.
  • I am kwizzn (https://keybase.io/kwizzn) on keybase.
  • I have a public key whose fingerprint is ACD9 ADB6 991C 78EF 79C0 6119 ACA4 A885 957C A666

To claim this, I am signing this object:

@kwizzn
kwizzn / nodejs-init-script
Created August 27, 2014 23:13
Daemon init script for a Node.js app using PM2 that runs under a different user
#!/bin/bash
NAME=myApp
APP=/path/to/app/index.js
PARAMS="--foo bar"
PM2=/usr/local/bin/pm2
USER=nobody
INSTANCES=max
LOGFILE=/tmp/.pm2/.log
ERRORFILE=/tmp/.pm2/.error