View filter_freqs.py
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
filtered_freq = [f if (950 < index < 1050 and f > 1) else 0 for index, f in enumerate(freq)] |
View AB_salary_calculator.py
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
Convert an hourly wage to weekly, monthly, and (gross and net) yearly incomes. | |
Assumes that work is being done in Alberta, Canada. | |
""" | |
from __future__ import division, print_function | |
import argparse |
View traffic_light_simulation.py
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 python3 | |
""" | |
Runs a simulation of a traffic light cycle. | |
Written by /u/masasin as code cleanup for /u/SquidgeyBear. See the original | |
thread at https://redd.it/3tpv6v, and the explanatory comments at | |
https://goo.gl/G2H67c. | |
""" | |
from itertools import cycle |
View merge_branch.py
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 python | |
# -*- coding: utf-8 -*- | |
# Automate merging of git branches | |
# Copyright © 2015 Jean Nassar | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
View get_interfaces.py
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 python | |
# -*- coding: utf-8 -*- | |
# Get a list of network interfaces on Linux | |
# Copyright © 2015 Jean Nassar | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the |
View Niko Nico Ordering Process
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
// customer cancels | |
/receive cancel request/; | |
cancel_order: | |
cancel order; | |
return; | |
// customer orders | |
/receive order/; | |
if urgent { |
View yozakura local_client.py
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 pickle | |
import socket | |
import time | |
# Create a socket (SOCK_STREAM means a TCP socket) | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
try: | |
# Connect to server and send data | |
sock.connect(("localhost", 9999)) |
View calculate_aldrin_periods_ksp.py
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 calculate_periods(precision=1e-1, periods_to_check=1000, print_first_n=7): | |
"""Calculate optimal orbital periods for a Kerbin-Duna cycler. | |
This assumes that the cyclers will have the same orbital period as the | |
synodic period. Multiples of this period are also acceptable, but the | |
results will need to be modified accordingly. | |
All arguments are optional. | |
Args: |