This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A recursively self-calling shell script, using Unix at daemon | |
# for scheduling future runs of itself. | |
# ... | |
# Put whatever you want your script to do here | |
# ... | |
# This bit will schedule this file to run again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inf(): | |
try: | |
while True: | |
try: | |
pass | |
except KeyboardInterrupt: | |
inf() | |
except KeyboardInterrupt: | |
inf() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't use the C-Shell! | |
alias csh='wget -qO- http://www.grymoire.com/unix/CshTop10.txt | less' | |
alias tcsh='wget -qO- http://www.grymoire.com/unix/CshTop10.txt | less' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from type_safety import typed | |
class TypeSafetyTestCase(unittest.TestCase): | |
def test_positional_typing(self): | |
""" | |
When the @typed() decorator is used with a list of types | |
it should force these types on the corresponding positional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from oset import oset | |
def k(l): | |
""" | |
Generate a random set of non-repeating integers, containing all integers from 0 to l. | |
""" | |
s = oset() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sequence(i): | |
store = (i + 1) * (i / 2) | |
while True: | |
yield store | |
store = (store + 1) * (store / 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibonacci(a=0, b=1): | |
yield a | |
yield b | |
while True: | |
a = a+b | |
yield a | |
b = b+a | |
yield b | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fake_server() { | |
# function that takes port to listen on as first argument, file to read from as second | |
# perpetually listens on given port and outputs the contents of given file on connections | |
while true; do nc -l $1 < $2; done; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sort(unsorted, asc=True): | |
if len(unsorted) == 1: | |
return [unsorted[0]] | |
else: | |
smallest = 0 | |
for i in range(len(unsorted)): | |
if unsorted[i] > smallest: | |
smallest = unsorted[i] | |
unsorted.remove(smallest) | |
if asc: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
########################################################################### | |
# # | |
# MINESTRAPS - A no-shit bootstrap script for Minecraft on Amazon Linux # | |
# Written By Joshua Saxby 2015 # | |
# # | |
########################################################################### | |
# Initialise config variables |