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 __main__ | |
import types | |
# patch_requests by Joshua Saxby | |
# An experiment into monkey-patching the rather excellent Requests | |
# library so the module can be hooked on a global level with minimal | |
# code having to be written by the end-user. | |
try: |
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
class Animal { | |
constructor(name="Unnamed", age=0, height=0) { | |
this.name = name; | |
this.age = age; | |
this.height = height; | |
} | |
describe() { | |
return `Species:\t${this.constructor.name}\nName:\t${this.name}\nAge:\t${this.age}\nHeight:\t${this.height}`; | |
} | |
} |
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
function* fibonacci(a=0, b=1) { | |
`This is a fibonacci sequence generator.` | |
yield a; | |
yield b; | |
let current = b; | |
let previous = a; | |
while (true) { | |
let next = previous + current; | |
previous = current; | |
current = next; |
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 decimal import Decimal | |
from functools import reduce | |
def average(*items): | |
""" | |
Returns mean average of a list (expects Decimal objects). | |
""" | |
return reduce(lambda x, y: x+y, items) / Decimal(len(items)) |
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
/* | |
* PID Controller Implementation in C | |
* | |
* Created by Joshua Saxby (aka @saxbophone) on 1 Jan, 2016 | |
* | |
* My own attempt at implementing the PID algorithm in some (hopefully) clean, understandable C. | |
* No warranty, no patenting (LOL!), free use, yadda yadda etc, hope you find this useful and don't be evil! | |
*/ | |
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
#include <stdio.h> | |
typedef struct { | |
/* | |
* A struct used for storing the configured state of a Quadcopter's motors, | |
* such as the maximmum power output per motor and the other tuning paramters | |
* that effect how the quad will calculate the thrust ratios of the motors | |
*/ |
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 urllib | |
import webbrowser | |
try: | |
thing() | |
except Exception as E: | |
webbrowser.open( | |
'http://stackoverflow.com/search?q={}'.format( | |
urllib.quote_plus('{} {}'.format(E.__class__.__name__, E.message)) | |
) |
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
function meme() { | |
if [ "$1" -eq "1" ] && [ "$2" -eq "1" ] | |
then | |
wall <<< `cowsay "Hello! I am Cow, and I like to SAY things"` | |
else | |
wall <<< `fortune | cowsay` | |
fi | |
a=$1 | |
b=$2 | |
temp=$((a + 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<!-- Generated by: TmTheme-Editor --> | |
<!-- ============================================ --> | |
<!-- app: http://tmtheme-editor.herokuapp.com --> | |
<!-- code: https://github.com/aziz/tmTheme-Editor --> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Saxbotheme</string> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<!-- Generated by: TmTheme-Editor --> | |
<!-- ============================================ --> | |
<!-- app: http://tmtheme-editor.herokuapp.com --> | |
<!-- code: https://github.com/aziz/tmTheme-Editor --> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Noblue Night</string> |