Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks https://gist.githubusercontent.com/lyoshenka/de4d3a0e82d8be987d69/raw/gist-backup.py | python
# curl -ks https://gist.githubusercontent.com/lyoshenka/de4d3a0e82d8be987d69/raw/gist-backup.py | USERNAME=lyoshenka python
# USERNAME=lyoshenka python gist-backup.py
import json
import urllib
from subprocess import call
from urllib import urlopen

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxvhost\""
exit 1
fi
# May need to run this as sudo!
# I have it in /usr/local/bin and run command 'ngxvhost' from anywhere, using sudo.
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
<?php
function append_error_handler($handler) {
set_error_handlers(array(set_error_handler($handler), $handler));
}
function prepend_error_handler($handler) {
set_error_handlers(array($handler, set_error_handler($handler)));
}
@lyoshenka
lyoshenka / router.php
Created February 22, 2014 20:24 — forked from michalpipa/router.php
Router script to make Symfony2 work with the PHP built-in server
<?php
if (isset($_SERVER['SCRIPT_FILENAME'])) {
return false;
} else {
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT']
. DIRECTORY_SEPARATOR
. 'app.php'
;
@lyoshenka
lyoshenka / daemonize_anything.sh
Last active August 29, 2015 13:56 — forked from Radamanf/Ghost - Demonize anything
Turn any command into a daemon. Use this as an init.d script.
#!/bin/bash
# Licence: GPLv3, MIT, BSD, Apache or whatever you prefer; FREE to use, modify, copy, no obligations
# Description: Bash Script to Start the process with NOHUP and & - in background, pretend to be a Daemon
# Author: Andrew Bikadorov
# Script v1.5
# For debugging purposes uncomment next line
#set -x

Backtick.io - Save to Pinboard

@lyoshenka
lyoshenka / .gitignore
Created November 20, 2013 23:06 — forked from monde/.gitignore
Gemfile.lock