Skip to content

Instantly share code, notes, and snippets.

View jeffgodwyll's full-sized avatar

Jeffrey Godwyll jeffgodwyll

View GitHub Profile
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@merqurio
merqurio / login.py
Last active April 24, 2019 19:20
Flask login using Google App Engine User Service
# import dependencies
from functools import wraps
from google.appengine.api import users
from flask import redirect, request
USERS = ["[email protected]", "[email protected]"]
#Set's the login to Google Users Service
def login_required(func):
#!/usr/bin/python
'''
Convert Blogger xml-exported file to markdown
Primarily from https://gist.github.com/larsks/4022537 with some modifications
'''
import os
import sys
import argparse
import iso8601
import re
@jeffgodwyll
jeffgodwyll / recursive_x_mod
Created March 2, 2015 23:42
When I move my android sdk folder onto an NTFS disk, I tend to loose the executable bit. This is to remedy the situation a whole lot better.
# Run in project root
# Recursively add executable bit to all files without a dot filename
find -type f -not -name "*.*" -exec chmod +x \{\} \;
# Recursively add exec bit to all files with .so in filename
find -type f -name "*.so*" -exec chmod +x \{\} \;
# Recursively add exec bit to all files with .so in filename
find -type f -name "*.jar*" -exec chmod +x \{\} \;
# Snippet 1
###########
# Copy the build folder(containing the html files) to a folder in flask's static
# directory and serve this way:
@app.route('/<dir>/<filename>', defaults={'static': True})
def build_dir(dir='',filename='index.html'):
path = join(dir,filename)
return app.send_static_file(path)
@boyter
boyter / puzzle.py
Last active April 9, 2017 18:27
Friday Quiz Solution
# Three people are playing the following betting game.
# Every five minutes, a turn takes place in which a random player rests and the other two bet
# against one another with all of their money.
# The player with the smaller amount of money always wins,
# doubling his money by taking it from the loser.
# For example, if the initial amounts of money are 1, 4, and 6,
# then the result of the first turn can be either
# 2,3,6 (1 wins against 4);
# 1,8,2 (4 wins against 6); or
# 2,4,5 (1 wins against 6).