This file contains hidden or 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 asdl | |
| from contextlib import contextmanager | |
| from abc import ABCMeta | |
| from pathlib import Path | |
| from argparse import ArgumentParser | |
| _wrapper_types = { | |
| "int": "Integer", | |
| "boolean": "Boolean" | |
| } |
This file contains hidden or 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
| -- A portable filesystem API using LuaJIT's FFI | |
| -- | |
| local ffi = require("ffi") | |
| local table = require("table") | |
| require("string") | |
| -- Cache needed functions and locals | |
| local C, errno, string = ffi.C, ffi.errno, ffi.string | |
| local concat, insert = table.concat, table.insert | |
| -- "Standard" C99 functions |
This file contains hidden or 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 array import array | |
| from collections import Iterable | |
| def _chunks(l, n): | |
| """Yield successive n-sized chunks from l.""" | |
| for i in range(0, len(l), n): | |
| yield l[i:i + n] | |
| class BitVector: | |
| __slots__ = "_words", "size" |
This file contains hidden or 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 | |
| REPOSITORY="https://github.com/TechzoneMC/SonarPet" | |
| checkCommand() { | |
| command=$1 | |
| command_name=${2:-$1} | |
| if ! which $command >/dev/null 2>&1 ; then | |
| echo "Missing required command: $command" 1>&2; | |
| echo "Please install $command_name to compile SonarPet" 1>&2; |
This file contains hidden or 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
| use std::mem; | |
| pub struct Permutations<T: Ord> { | |
| elements: Vec<T>, | |
| times_generated: u64 | |
| } | |
| impl<T: Ord> Permutations<T> { | |
| #[inline] | |
| pub fn new(mut elements: Vec<T>) -> Permutations<T> { |
This file contains hidden or 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
| use std::cmp::min; | |
| fn basicSieve(bound: usize) -> Vec<usize> { | |
| let mut isPrime = vec![true; bound]; | |
| let top = ((bound as f64).sqrt().ceil() as usize) + 1; | |
| assert!(top < isPrime.len()); | |
| for i in 2..top { | |
| if isPrime[i] { | |
| let mut j = i*i; | |
| while j < bound { |
This file contains hidden or 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 math import floor, log10 | |
| tinyNumbers = { | |
| 1: "one", | |
| 2: "two", | |
| 3: "three", | |
| 4: "four", | |
| 5: "five", | |
| 6: "six", | |
| 7: "seven", | |
| 8: "eight", |
This file contains hidden or 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
| /* | |
| Game_First_to_Respond - A program for a quiz game function | |
| Copyright 2013 by V Boyd | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU Lesser General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains hidden or 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 | |
| VERSION="$1" | |
| if [ -z "$VERSION" ]; then | |
| echo "Please enter a version to update to!" >&2; | |
| exit 1; | |
| fi; | |
| echo "Downloading kotlin $VERSION from maven" | |
| OUTPUT_JAR=$(mktemp -t "kotlin-$VERSION-XXX.jar") |
This file contains hidden or 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 | |
| from argh import ArghParser, arg | |
| from random import Random | |
| from statistics import median | |
| class Territory: | |
| __slots__ = "name", "troops", "random" | |
| def __init__(self, name, troops, random=Random()): |