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
cache = {} | |
def fib(n): | |
if n in cache: | |
return cache[n] | |
if n < 2: | |
cache[n] = 1 | |
else: | |
cache[n] = fib(n-1) + fib(n-2) | |
return cache[n] |
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 collections | |
import logging | |
import random | |
def roll(dice, sides_per_die): | |
""" Roll 'dice' 'sides_per_die'-sided die and return the sum """ | |
return sum([random.randint(1, sides_per_die) for _ in range(dice)]) | |
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 itertools | |
import ctypes | |
kNO_REPEAT = 0x4000 | |
MODIFIERS = dict(ctrl=0x0002 | kNO_REPEAT, | |
alt=0x0001 | kNO_REPEAT, | |
shift=0x0004 | kNO_REPEAT) | |
def hotkey_is_available(mods, vkey): | |
hotkey_available = False |
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 numpy as np | |
import utm | |
starting_lat = -16.770190621116416 | |
starting_lon = 145.94309647258999 | |
x, y, zone, letter = utm.from_latlon(starting_lat, starting_lon) | |
# Scalar | |
print(starting_lat, starting_lon, x, y) | |
lat_scalar, lon_scalar = utm.to_latlon(x, y, zone, letter) |
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
%windir%\system32\cmd.exe /k cd c:\dev && C:\dev\portable-tools\_setup_env_vars.bat && c:\dev\sandbox-heath\aliases.bat && echo Hello! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
void publish_subscribe_example() | |
{ | |
///////////////////////////////////////////// | |
// ZeroMQ pattern: Publish-subscribe | |
///////////////////////////////////////////// | |
zmq::context_t context(1); | |
zmq::socket_t subscr_target_data(context, ZMQ_SUB); | |
std::string address = "tcp://" + kHost + ":"; | |
std::string port = "61502"; |
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 pathlib | |
path = pathlib.Path(r"C:\Data") | |
print([f for f in path.glob("**/*.xlsx")]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.