Skip to content

Instantly share code, notes, and snippets.

View damienstanton's full-sized avatar
🤷

Damien Stanton damienstanton

🤷
  • PwC
  • DC & Baltimore, USA
  • 01:17 (UTC -04:00)
View GitHub Profile
@damienstanton
damienstanton / update_pips.py
Last active August 29, 2015 14:06
Easily update all your pip dependencies. Works in venv or system.
# If using Flask-Script, simply drop this into manage.py under a @manage.command decorator
def update():
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
@damienstanton
damienstanton / config.fish
Last active August 29, 2015 14:07
Clean Fish Prompt with Git Stats
# Some Useful Aliases
alias c="clear;ls"
alias ct="clear;tree"
alias lsa="ls -ltra"
alias lss="ls -ltra|less"
alias la="ls -lsa|less"
alias cls="clear"
alias e="exit"
alias gs="git status -uno"
@damienstanton
damienstanton / setup.sh
Created October 17, 2014 13:57
Boilerplate for minimal Flask app
mkdir -p src
cd src
touch manage.py
mkdir -p app
cd app
touch __init__.py
mkdir -p home
mkdir -p static
mkdir -p templates
cd static
@damienstanton
damienstanton / killpyc.sh
Last active August 29, 2015 14:07
Remove .swp and .pyc files recursively
rm -rfv `find ./ | egrep -i "(pyc|.swp|˜)$"`
printf $"\nCleaned!"
@damienstanton
damienstanton / env.sh
Last active August 29, 2015 14:10
Make a Virtualenv in Ubuntu 14.04 with Python 3.4
# Workaround for the ensurepip problem: https://lwn.net/Articles/592007/
# --------------------------------------
# Usage:
# Add this script to your path, then run
# env.sh my_virtualenv_name
# --------------------------------------
pyvenv-3.4 --without-pip $1
source ./$1/bin/activate
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.4.4.tar.gz
@damienstanton
damienstanton / astar.txt
Last active June 20, 2021 19:47
A-Star Pseudocode
function A*(start,goal)
closedset := the empty set // The set of nodes already evaluated.
openset := {start} // The set of tentative nodes to be evaluated, initially containing the start node
came_from := the empty map // The map of navigated nodes.
g_score[start] := 0 // Cost from start along best known path.
// Estimated total cost from start to goal through y.
f_score[start] := g_score[start] + heuristic_cost_estimate(start, goal)
while openset is not empty
@damienstanton
damienstanton / example.feature
Last active August 29, 2015 14:11
Example Behave File
@tags @tag
Feature: Do A Thing
As [agent]
In order to accomplish the goal of a thing
I need to do a thing
Background: some requirement for this test
Given [agent] is an admin
And there are no other admins logged in
Then admin permissions are granted
--- ari_dev/ari/__init__.py (original)
+++ ari_dev/ari/__init__.py (refactored)
@@ -7,7 +7,7 @@
import ari.client
import swaggerpy.http_client
-import urlparse
+import urllib.parse
Client = client.Client
@damienstanton
damienstanton / mods.ahk
Created December 24, 2014 19:24
Autohotkey config
; Invert Scroll a la OSX
WheelUp::
Send {WheelDown}
Return
WheelDown::
Send {WheelUp}
Return
; Remap Mac Media Keys
@damienstanton
damienstanton / output.conf
Created December 30, 2014 15:10
Dialplan output when leaving test queue
-- Executing [27@queuemetrics:1] Answer("Local/27@queuemetrics-00000058;2", "") in new stack
-- Local/27@queuemetrics-00000058;1 answered
-- Executing [10@queuemetrics:1] Answer("Local/27@queuemetrics-00000058;1", "") in new stack
-- Executing [10@queuemetrics:2] Wait("Local/27@queuemetrics-00000058;1", "10") in new stack
-- Executing [27@queuemetrics:2] Set("Local/27@queuemetrics-00000058;2", "AGENTCODE=93651") in new stack
-- Executing [27@queuemetrics:3] GotoIf("Local/27@queuemetrics-00000058;2", "0?end") in new stack
-- Executing [27@queuemetrics:4] NoOp("Local/27@queuemetrics-00000058;2", " "QM: RemoveQueueMember (asterisk v1.4+) Agent/93651 on queue made by 'agent/93651'" ") in new stack
-- Executing [27@queuemetrics:5] RemoveQueueMember("Local/27@queuemetrics-00000058;2", ",Local/93651@from-queue/n,,,SIP/93651@hqcm02") in new stack
[2014-12-30 10:08:34] WARNING[18630][C-0000002c]: app_queue.c:7619 rqm_exec: Unable to remove interface from queue '': No such queue
-- Ex