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
#!/usr/bin/env node | |
const FS = require('fs') | |
const Path = require('path') | |
const FolderMap = { | |
"1x": "mipmap-mdpi", | |
"2x": "mipmap-xhdpi", | |
"3x": "mipmap-xxhdpi", | |
} |
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
// Copyright Lionello Lunesu, placed in the public domain. | |
import std.algorithm; | |
import std.range; | |
ubyte charCode(dchar c) pure { | |
switch (c) { | |
case '<': return 0; | |
case 'A': .. case 'Z': return cast(ubyte)(c - 'A' + 10); | |
case '0': .. case '9': return cast(ubyte)(c - '0'); | |
default: assert(0); |
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
#define NOP() __asm volatile ( "NOP" ) | |
void ws2812_init(void) | |
{ | |
NRF_GPIO->PIN_CNF[PIN_WS_DIN] = (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos) | |
| (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos) | |
| (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | |
| (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | |
| (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); | |
} |
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 std.xml; | |
import std.file; | |
import std.stdio; | |
import std.conv; | |
import std.math; | |
real EPSILON = 1e-2; | |
real distance_to_line(real fx, real fy, real tx, real ty, real px, real py) { |
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
#!/usr/bin/env dmd -run | |
import std.xml; | |
import std.file; | |
import std.stdio; | |
Element getElementByTagName(Element parent, string name) { | |
foreach (child; parent.elements) { | |
if (child.tag.name == name) { | |
return child; |
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
#!/usr/bin/env node | |
const FS = require('fs') | |
const URL = require('url') | |
const Child_process = require('child_process') | |
const all = FS.readFileSync('pww.txt', {encoding:'utf8'}) | |
const regex = /\n(?:"([^"]*)")?\t"([^"]*)"\t"([^"]*)"\t"([^"]*)"\t"([^"]*)"\t(?:"([^"]*)")?/mg | |
while (true) { | |
const match = regex.exec(all) | |
if (!match) break |
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
#!/usr/bin/env node | |
const Child_process = require('child_process') | |
const Web3 = require('web3') | |
const Assert = require('assert') | |
const SOL = ` | |
contract BS { | |
function isValidSignature( | |
address signer, | |
bytes32 hash, |
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
Assert.rejects = async function rejects (blockOrPromise, error, message) { | |
return new Promise((resolve,reject) => { | |
if (typeof blockOrPromise === 'function') { | |
blockOrPromise = blockOrPromise() | |
} | |
blockOrPromise.then(x => { | |
reject(Error('Should fail, not return ' + x)) | |
}).catch(async err => { | |
if (typeof error === 'function') { | |
err = (await error(err)) || err |
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
/* Use this with an overmind Procfile like this: | |
geth: geth --dev --rpc console | |
jest: pnpx jest --watchAll | |
*/ | |
const ChildProcess = require('child_process') | |
const Web3 = require('web3') | |
const Assert = require('assert') | |
function addressOf(contract) { | |
return contract.options.address |
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
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |