Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
mattdeboard / change.py
Last active May 2, 2016 22:34
This was my first web app ever, for a school project.
from flask import Flask, request, render_template
from flaskext.wtf import Form, FloatField, Required
app = Flask(__name__)
app.secret_key = 'b\xcaf\xde\xc3\xc6\xdc\x03\xf0ls\xd6\x08\xe7\x9a2\x02j\xdf\xa7n\xe5\xf4\xdd'
class ChangeForm(Form):
cost = FloatField("Total cost of item: $")
tender = FloatField("Amount tendered: $")
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((nil . ())
(python-mode . ((python-environment-directory . "~/Envs")
(python-environment-virtualenv
'("virtualenv" "--system-site-packages" "--quiet" "--python" "/home/matt/Envs/api/bin/python"))
(jedi:environment-root . "api"))))
(defun git-link-cs-stash (hostname dirname filename branch commit start end)
(cl-destructuring-bind (project-name repo-root) (split-string dirname "/")
(format "http://stash.cs.sys/projects/%s/repos/%s/browse/%s#%s"
project-name
repo-root
filename
(if end
(format "%s-L%s" start end)
(format "%s" start)))))
@mattdeboard
mattdeboard / .bash_profile
Created November 16, 2015 20:06 — forked from fieg/.bash_profile
.bash_profile for OSX including autocomplete for ssh hosts, default variables and some aliases
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
$ sudo gem install -V chef
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://rubygems.global.ssl.fastly.net/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://rubygems.global.ssl.fastly.net/latest_specs.4.8.gz
200 OK
HEAD https://rubygems.org/specs.4.8.gz
<img width=3D"0" =
height=3D"0" class=3D"mailtrack-img" src=3D"https://mailtrack.io/trace/mail=
/b1a26fa29fb695ebc040620a19033f6879ba8161.png">
# This invocation of awscli outputs the value of the 'Environment' tag of the EC2 instance.
FACTER_environment=$(aws ec2 describe-tags \
--region us-east-1 \
--filters Name=tag:Environment,Values=* \
--query Tags[?ResourceId==\`$(ec2metadata --instance-id)\`].Value \
--output text) \
puppet apply --modulepath=/opt/puppet/modules -e "include core,apps::engage,apache2,pgbouncer,memcached,courseload::apps::api,apps::eventprocessing"
func videoOrientation() {
let previewConn = self.previewLayer?.connection
let orientation = UIApplication.sharedApplication().statusBarOrientation
switch orientation {
case UIInterfaceOrientation.LandscapeLeft:
previewConn!.videoOrientation = AVCaptureVideoOrientation.LandscapeLeft
case UIInterfaceOrientation.LandscapeRight:
previewConn!.videoOrientation = AVCaptureVideoOrientation.LandscapeRight
case UIInterfaceOrientation.Portrait:
var Shim = {
context: {
onLocationChanged: function() {
console.log("Location changed!");
}
},
activateDebugMode: function() {
console.log("Debug mode activated!");
},
def palindrome_test2(candidate):
if not isinstance(basestring, candidate):
raise TypeError("The argument to this function must be a string.")
alphanum_chars = [l for l in candidate if l != " "]
for idx, i in enumerate(alphanum_chars, 1):
if i == alphanum_chars[-idx]:
continue
else: