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
type FilterOut = | |
| string | |
| number | |
| Date | |
| undefined | |
| null | |
// eslint-disable-next-line @typescript-eslint/ban-types | |
| Function | |
| FilterOut[]; |
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
export type RelationDepth = { | |
[key: string]: RelationDepth; | |
}; | |
export function getRelations(depth: RelationDepth = {}) { | |
const relations: string[] = []; | |
const recurse = (obj: RelationDepth, path = '') => { | |
Object.keys(obj).forEach((key) => { | |
relations.push(path + key); | |
recurse(obj[key], path + key + '.'); |
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 Redis from 'ioredis'; | |
const { HOST: host, PORT: port } = process.env; | |
const redis = new Redis({ host, port: parseInt(port || '6379', 10) }); | |
const subRedis = new Redis({ host, port: parseInt(port || '6379', 10) }); | |
// Write a class that checks a redis key for a cache. | |
// If the source is not locked, lock it and fetch it. | |
// If the source is already locked, wait for the lock to expire. |
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/sh | |
# Datadog Agent installation from source script (should support most Unix OSes): | |
# download the source of the Agent, install its dependencies and set it up. | |
# Bail on errors | |
set -e | |
# We shouldn't have unbounded vars | |
set -u | |
####################################################################### |
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
const Blueprint = require('factorio-blueprint'); | |
const alphabet = ` | |
~AA BBB CCC DDD EEEE FFFF GGG H H IIIII JJJJJ K K L MMM MMM NN N OOO PPP QQQ RRR SSSS TTTTT U U V V W W X X Y Y ZZZZZ ( ) * * * ! ?? | |
A A B B C D D E F G H H I J K K L M M M N N N O O P P Q Q R R S T U U V V W W X X Y Y Z ( ) *** ! ? | |
AAAA BBB C D D EEEE FFFF G GGG HHHH I J KK L M M M N N N O O PPP Q Q RRR SSS T U U V V W W W X Y Z ( ) ***** ! ? | |
A A B B C D D E F G G H H I J J K K L M M N NN O O P Q QQ R R S T U U V V W W W X X Y Z ( ) *** .. ? , | |
A A BBB CCC DDD EEEE F GGG H H IIIII JJJ K K LLLLL M M N N OOO P QQQQ R R SSSS T UUU V WWW X X Y ZZZZZ ( ) * * * .. ! ? ,~~ | |
`.trim().replace(/\~/g, ' ').split('\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
function drawer(price, cash, cid) { // cid == denominations array | |
price *= 100; cash *= 100; // Convert to pennies | |
// Really we're just trying to get the coins for cash-price | |
var vals = [1,5,10,25,100,500,1000,2000,10000]; // How much each denomation is worth (in pennies) | |
var cidHave = cid.map(x=>Math.round(x[1]*100)); // Convert each denomination we have into pennies (e.g. $1.05 in nickels to 105) | |
var cidAmts = cidHave.map((x,i)=>Math.floor(x/vals[i])); // e.g. 105 pennies worth in nickels to 21 nickels or 20000 pennies worth in quarters to 80 quarters | |
var best = [[0,0,0,0,0,0,0,0,0]]; // Start with $0.00 = 0 of each coin | |
var bestScoreList = [0]; // # of coins for $0.00 is 0 | |
for (var i = 1; i <= cash-price; i++) { // For $0.00 to amt | |
best[i] = [...Array(cid.length)].map(x=>0); // Empty array of denominations |
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
/* | |
HOW TO RUN: | |
- Download and Install node.js. Check by running: node -v | |
- Create a folder "wakeup" and stick this index.js inside | |
- cd to the folder. On a mac, this might look like: cd Desktop/wakeup | |
no idea on a windows, I think it's something like: cd C:\Users\username\Desktop\wakeup | |
- Run: npm install request | |
- Run: npm install sfx |
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
const Blueprint = require('factorio-blueprint'); | |
const PNG = require('png-js'); | |
const inputs = Object.keys(Blueprint.getEntityData()).filter(key => !Blueprint.getEntityData()[key].combinator).slice(0, 60); | |
const bp = new Blueprint(); | |
const FRAMES = 4230; // Number of images I had | |
const COL = 30; // Max height = COL * 4 or something | |
const LEFT = true; // Change so you can get the left and the right side |
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
const Blueprint = require('factorio-blueprint'); | |
const inputs = Object.keys(Blueprint.getEntityData()).filter(key => !Blueprint.getEntityData()[key].combinator).slice(0, 60); | |
const carries = Object.keys(Blueprint.getEntityData()).filter(key => !Blueprint.getEntityData()[key].combinator).slice(60, 90); | |
const bp = new Blueprint(); | |
for (let i = 0; i < 2; i++) { | |
const start = i == 0 ? 0 : 59; | |
const dir = i == 0 ? 1 : -1; | |
let prevCombinator = null; |
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
module.exports = { | |
player: playerInject, | |
server: serverInject, | |
disable: disable | |
} | |
function playerInject(serv, player, self) { | |
var pData = player.plugin(self); // Player Data | |
pData.blocklist = []; |