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 | |
set -euo pipefail | |
BOLD=$(tput bold) | |
DIM=$(tput dim) | |
YELLOW=$(tput setaf 3) | |
RESET=$(tput sgr0) | |
pr() { |
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 createDebug = require('debug') | |
const { serializeError } = require('serialize-error') | |
const receiveCommands = async (main, commands, debug) => { | |
for await (const message of main.subscribe()) { | |
if (message.data == null || typeof message.data.type !== 'string') { | |
debug('unexpected message', { message }) | |
continue | |
} | |
const { type, payload } = message.data |
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
<?php | |
// | |
// delete-old-tweets.php - https://github.com/timdp | |
// | |
// -- Instructions -- | |
// 1. Save this script somewhere as delete-old-tweets.php | |
// 2. Get your Twitter archive and extract it to the same folder | |
// 3. Clone https://github.com/themattharris/tmhOAuth to the same folder | |
// 4. Register an app at dev.twitter.com and enter its credentials below |
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 misleadingStrings = ['', 'true', 'false'] | |
const reWhitespaceStart = /^\s/ | |
const reWhitespaceEnd = /\s$/ | |
const reNumeric = /^\s*(?:[0-9]+|[0-9]*\.[0-9]+)\s*$/ | |
const indent = ' ' | |
const maxStringLength = 60 | |
const keysSorted = true | |
const byKey = (a, b) => a[0].localeCompare(b[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
#!/bin/bash | |
set -euo pipefail | |
curl \ | |
--silent \ | |
"https://api.cloudflare.com/client/v4/zones" \ | |
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \ | |
-H "X-Auth-Key: $CLOUDFLARE_TOKEN" \ | |
-H "Content-Type: application/json" | |
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 http = require('http') | |
const net = require('net') | |
const { performance } = require('perf_hooks') | |
const HOST = 'example.com' | |
const ADDRESS = '93.184.216.34' | |
const FAMILY = 4 | |
let lookupCountCreateConnection = 0 | |
let lookupCountSocketEvent = 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
const http = require('http') | |
const PORT = 8888 | |
const REQUEST_LATENCY = 100 | |
const REQUEST_COUNT = 1000 | |
const requestOptions = { | |
hostname: '127.0.0.1', | |
port: PORT, | |
path: '/', |
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 delay from 'delay' | |
const createAttempter = (worker) => async () => { | |
let retval, error, time | |
const startTime = Number(new Date()) | |
try { | |
retval = await worker() | |
} catch (err) { | |
error = 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
# Requirements: | |
# - curl | |
# - pup (https://github.com/ericchiang/pup) | |
# - npm-dependents (https://www.npmjs.com/package/npm-dependents) | |
curl -s 'https://www.npmjs.com/~timdp' | \ | |
pup '.collaborated-packages a text{}' | \ | |
xargs -n1 -I % sh -c 'echo -n %:\ ; npm-dependents % --list' |
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 libxmljs = require('libxmljs') | |
const doc = new libxmljs.Document() | |
const measure = () => { | |
global.gc() | |
return process.memoryUsage() | |
} | |
const run = () => { |
NewerOlder