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 deno run --allow-read --allow-hrtime | |
import { readLines } from "https://deno.land/[email protected]/io/mod.ts"; | |
function intersection<T>(a: Set<T>, b: Set<T>): Set<T> { | |
// Quick optimisation by iterating the smaller set instead of the larger one. | |
const [small, large] = a.size > b.size ? [b, a] : [a, b]; | |
const intersect = new Set<T>(); | |
for (const item of small) { | |
if (large.has(item)) { |
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 deno run --allow-read --allow-write | |
import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | |
import { relative, resolve } from "https://deno.land/[email protected]/path/mod.ts"; | |
/* | |
Transforms the content all files in a directory to remove `.ts` from | |
the end of imports. | |
*/ | |
const { args, exit, mkdir, readDir, readFile, remove, stat, writeFile } = Deno; |
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
declare module 'shim-definitions' { // This module name should match the package name. | |
/** | |
* This allows something like VSCode to auto-import with the name | |
* `shimDefinitions`. It could be any other name you want. | |
*/ | |
const shimDefinitions: any; | |
/** | |
* Doing this allows you to import like so: | |
* ```ts |
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 node | |
'use strict'; | |
/* | |
A Node.js implementation of | |
https://github.com/connorworley/dotfiles/blob/master/.bin/brew-autoremove | |
*/ | |
const child = require('child_process'); | |
const util = require('util'); |
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
/** | |
* Provides various helpers for running a Jakefile | |
* Source: https://devspri.me/jake-helpers | |
* @module jake-helpers | |
*/ | |
const { promisify } = require('util'); | |
// create promise version of exec | |
jake.exec.promise = promisify(jake.exec); |
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 dotnet script -c Release | |
public string RemoteTest() => "Hello world"; |
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 random import randint, shuffle | |
TIMES = 10_000_000 | |
def get_dict(): | |
return { | |
"wins": 0, | |
"losses": 0 |
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
/*-*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Sandbox.Common; | |
using Sandbox.Common.ObjectBuilders; | |
using Sandbox.Definitions; | |
using Sandbox.Engine; |
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 | |
import multiprocessing.connection # used to communicate between processes | |
# might re-work this communication to use either a multi-language socket | |
# lib or write my own | |
import socket | |
import sys | |
import traceback | |
# communication messages |
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 | |
import os | |
import re | |
def get_items(dir): | |
dirs = [] | |
files = [] | |
with os.scandir(dir) as scan: | |
for entry in scan: |
NewerOlder