Skip to content

Instantly share code, notes, and snippets.

View dmmfll's full-sized avatar

Don Morehouse dmmfll

  • Fort Lauderdale, Florida
View GitHub Profile
@dmmfll
dmmfll / gitsubmodules-deploy
Created July 10, 2016 12:53
output with trace "on" with gitsubmodules deploy
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
@dmmfll
dmmfll / pelican-deploy-from-MacBook
Created July 11, 2016 00:10
output of Pelican deploy to dokku from Macbook
+ case "$(lsb_release -si)" in
++ lsb_release -si
+ export DOKKU_DISTRO=ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
@dmmfll
dmmfll / unattended-dokku-install-example
Created July 11, 2016 16:17
an example of an unattended dokku install script
#!/bin/bash
# <UDF name="ssh_key" default="" label="Public SSH Key for user" />
# <UDF name="username" default="" label="default username" />
# <UDF name="hostname" default="" label="default username" />
function logit {
# Simple logging function that prepends an easy-to-find marker '=> ' and a timestamp to a message
TIMESTAMP=$(date -u +'%m/%d %H:%M:%S')
MSG="=> ${TIMESTAMP} $1"
@dmmfll
dmmfll / python_id_tester_via_tokenize.py
Created September 5, 2016 13:39
tokenize method for testing if a string is a valid identifier in Python
"""http://stackoverflow.com/questions/12700893/how-to-check-if-a-string-is-a-valid-python-identifier-including-keyword-check"""
import keyword
import tokenize
def isidentifier(ident):
"""Determines, if string is valid Python identifier."""
# Smoke test — if it's not string, then it's not identifier, but we don't
# want to just silence exception. It's better to fail fast.
@dmmfll
dmmfll / python_id_tester_via_ast.py
Created September 5, 2016 13:44
valid Python identifier tester using ast
"""http://stackoverflow.com/questions/12700893/how-to-check-if-a-string-is-a-valid-python-identifier-including-keyword-check"""
import ast
def isidentifier(ident):
"""Determines, if string is valid Python identifier."""
# Smoke test — if it's not string, then it's not identifier, but we don't
# want to just silence exception. It's better to fail fast.
if not isinstance(ident, str):
raise TypeError('expected str, but got {!r}'.format(type(ident)))
@dmmfll
dmmfll / sort_speed_test.ipynb
Created September 7, 2016 11:31
example of using timeit with sorting
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmmfll
dmmfll / echo_graceful_exit.rb
Created October 14, 2016 20:18
putting the "loop" into read-evaluate-print-loop
first_loop = true
loop do
# Trap ^C aka interrupt signal
Signal.trap("INT") {
puts "\nGoodbye!"
exit
}
[
@dmmfll
dmmfll / ProgrammaticNotebook.ipynb
Created October 15, 2016 21:45 — forked from fperez/ProgrammaticNotebook.ipynb
Creating an IPython Notebook programatically
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmmfll
dmmfll / twitter.js
Created November 5, 2016 15:24 — forked from cjoudrey/twitter.js
Lazy-rendering in PhantomJS
// This example shows how to render pages that perform AJAX calls
// upon page load.
//
// Instead of waiting a fixed amount of time before doing the render,
// we are keeping track of every resource that is loaded.
//
// Once all resources are loaded, we wait a small amount of time
// (resourceWait) in case these resources load other resources.
//
// The page is rendered after a maximum amount of time (maxRenderTime)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.