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
(ns malli-select | |
(:require | |
[malli.core :as m] | |
[malli.util :as mu])) | |
(defn select | |
"Takes a malli schema and a vector of selection patterns and returns a schema | |
with keys that don't match any selection patterns set as optional. | |
A selection pattern either a keyword or a map. If a map, the keys must be |
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 | |
# --------------------------- | |
# Author: Brandon Patram | |
# Date: 2018-06-19 | |
# | |
# Description: List out merge commits and one off commits between | |
# the last tagged release and the current state of master. | |
# | |
# Usage: publish-release.sh [-y] [-h] [-v] [-V] | |
# Examples: |
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 configparser | |
import itertools as it | |
import re | |
_config = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) | |
_config.read('config.ini') | |
# expose built-in methods | |
get = _config.get | |
getboolean = _config.getboolean |
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
extern crate time; | |
use time::PreciseTime; | |
fn main() { | |
let m = 3; | |
for n in 20..31 { | |
println!("n: {}", n); | |
let s = PreciseTime::now(); |
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
extern crate time; | |
use time::PreciseTime; | |
fn main() { | |
let m = 3; | |
// Can't go higher, cuz it runs out of stack space. | |
for n in 1..12 { | |
println!("n: {}", 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
PS C:\Users\noah\Personal\roguelike> python3 .\tut.py | |
24 bits font. | |
key color : 0 0 0 | |
24bits greyscale font. converting to 32bits | |
quickFOV 0.0013250349431546578 | |
fov_algo 0.000496591807854921 | |
quickFOV 0.0006293323388328886 | |
fov_algo 0.0004001968984543858 | |
quickFOV 0.0006218261778547785 | |
fov_algo 0.00043614745892739393 |
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 blocks_light(x, y): | |
'''my_map is a nested list() of Tile objects that have block_sight, blocked, etc as in the classic tutorial. | |
''' | |
global my_map | |
return my_map[x][y].block_sight | |
def set_visible(x, y): | |
'''visible_tiles is a set() of (x, y) tuples, tracking which tiles are visible. | |
it is reset every time fov is recalculated. |
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 random | |
from bisect import bisect | |
from itertools import accumulate | |
class Struct: | |
def __init__(self, alist): | |
self.alist = alist | |
def main(): |
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
In [27]: %%timeit | |
...: result = [] | |
...: for i in range(2000): | |
...: result.append(i * 2) | |
...: | |
1000 loops, best of 3: 285 µs per loop | |
In [28]: %%timeit | |
...: result = [] | |
...: add = result.append |
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 timeit | |
from random import shuffle, randrange | |
from statistics import mean | |
from functools import partial | |
from collections import deque | |
def merge_original_1(left, right): | |
i = 0 | |
j = 0 | |
merged_list = [] |
NewerOlder