Skip to content

Instantly share code, notes, and snippets.

View nathantowell's full-sized avatar
🏙️
Hardly Working

Nathan Towell nathantowell

🏙️
Hardly Working
View GitHub Profile
@nathantowell
nathantowell / .bashrc
Created June 25, 2018 08:11
Custom bash setup
# Include Custom Setup
source ~/.custombash
@nathantowell
nathantowell / index.js
Created August 2, 2017 12:13
Koa hello world example with response time middleware
'use strict'
const Koa = require('koa')
const app = new Koa()
app.use(async (context, next) => {
let start = Date.now()
await next()
let ms = Date.now() - start
context.set('X-Response-Time', ms + 'ms')

Keybase proof

I hereby claim:

  • I am nathantowell on github.
  • I am natho_ (https://keybase.io/natho_) on keybase.
  • I have a public key whose fingerprint is A8FC 49CD 1092 9B48 913A BAB4 14D4 9A06 2F9E 9327

To claim this, I am signing this object:

@nathantowell
nathantowell / opinion.js
Created September 16, 2016 12:23
Find out if your opinion matters...
/**
* Function that tells you if your opinion matters.
* @param Your opinion
* @returns Opinion matter-ness
*/
function doesMyOpinionMatter(var opinion) {
return false;
}
doesMyOpinionMatter("Something Something...");
$social-colors: (
facebook: #3b5998,
twitter: #00aced,
googleplus: #dd4b39,
linkedin: #007bb6,
youtube: #bb0000,
vimeo: #aad450,
tumblr: #32506d,
instagram: #517fa4,
flickr: #ff0084,
@nathantowell
nathantowell / guess.py
Created August 2, 2016 00:05
A simple game to guess a random number!
from random import randint
def game():
print("Welcome to the number guessing game!")
while True:
pair = setup()
rand = generate(pair)
print("Time to guess the number chosen...")
tries = get_guesses(pair, rand)
@nathantowell
nathantowell / client.py
Created August 1, 2016 13:50
A quick use of sockets in python 3
import socket
s = socket.socket()
host = socket.gethostname()
port = 6789
s.connect((host, port))
print(s.recv(1024).decode())
s.close
@nathantowell
nathantowell / max_of.py
Created July 31, 2016 17:30
A simple function to order a list.
def max_of(list):
for a in reversed(range(1, len(list)+1)):
for b in range(1, a):
if list[b-1] > list[b]:
temp = list[b-1]
list[b-1] = list[b]
list[b] = temp
return list
#Example
import re
suffix = "ay"
def translate_word(word):
word = re.sub("[^a-zA-Z]+", "", word)
new_word = word[1:] + word[0] + suffix
if word[0] == word[0].upper():
if word[1:] == word[1:].lower():
return new_word[0].upper() + new_word[1:]