Skip to content

Instantly share code, notes, and snippets.

Jean Nassar masasin

Block or report user

Report or block masasin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View filter_freqs.py
filtered_freq = [f if (950 < index < 1050 and f > 1) else 0 for index, f in enumerate(freq)]
@masasin
masasin / AB_salary_calculator.py
Last active Aug 9, 2016
Salary calculator for Alberta - Hourly wage to yearly net
View AB_salary_calculator.py
#!/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
@masasin
masasin / traffic_light_simulation.py
Last active Nov 28, 2015
Code cleanup for /u/SquidgeyBear. (See thread at http://redd.it/3tpv6v, and comment at https://goo.gl/G2H67c)
View traffic_light_simulation.py
#!/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
#!/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
#!/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
@masasin
masasin / Niko Nico Ordering Process
Last active Aug 29, 2015
Niko Nico Ordering Process
View Niko Nico Ordering Process
// customer cancels
/receive cancel request/;
cancel_order:
cancel order;
return;
// customer orders
/receive order/;
if urgent {
@masasin
masasin / yozakura local_client.py
Created Apr 3, 2015
Client code to test yozakura's server
View yozakura local_client.py
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))
@masasin
masasin / calculate_aldrin_periods_ksp.py
Created Feb 12, 2015
Calculate Kerbin-Duna Aldrin cycler periods in KSP
View calculate_aldrin_periods_ksp.py
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:
You can’t perform that action at this time.