Skip to content

Instantly share code, notes, and snippets.

View jeffgodwyll's full-sized avatar

Jeffrey Godwyll jeffgodwyll

View GitHub Profile
@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).
# 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)
@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 \{\} \;
#!/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
@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):
@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
@quchen
quchen / trolling_haskell
Last active November 12, 2024 00:10
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@larsks
larsks / blogger2scriptogram.py
Created November 6, 2012 04:23
Convert Blogger posts to Markdown for use with Scriptogr.am
#!/usr/bin/python
import os
import sys
import argparse
import iso8601
import re
import subprocess
import logging
import json
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik