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
set line_count (wc -l < data.jsonp) | |
set i 1 | |
while test $i -lt (math $line_count + 1) | |
echo "Comparing lines $i and $(math $i + 1)" | |
diff (sed -n "$i"p data.jsonp | jq --sort-keys . | psub) (sed -n (math $i + 1)p data.jsonp | jq --sort-keys .| psub) | |
echo "----------------------------------------" | |
set i (math $i + 1) | |
end |
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 | |
/** | |
* Usage: | |
* ./add_descriptions.ts sic_codes.csv codes.csv | |
* | |
* sic_codes.csv should contain two columns: | |
* code,description | |
* | |
* codes.csv should contain a list of codes, one per row. | |
*/ |
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
[ | |
{ | |
"isDefault": false, | |
"name": "Momentum2", | |
"gains": { | |
"global": 0, | |
"bands": [ | |
-6.6, | |
-3.6, | |
-3.4, |
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
// Async stack traces are often a bit useless - there is a max depth after which context is lost. | |
// This is a rather hacky attempt to maintain the full stack. | |
// https://github.com/sindresorhus/got/blob/main/documentation/async-stack-traces.md | |
// https://github.com/nodejs/node/issues/36126 | |
const asyncHooks = require("async_hooks"); | |
const traces = new Map(); | |
asyncHooks |
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 { useEffect, useMemo, useRef } from "react"; | |
import { v4 as uuid } from "uuid"; | |
const renderCounter: { [id: string]: number | undefined } = {}; | |
const incrementRenderCount = (id: string) => { | |
const next = (renderCounter[id] ?? 0) + 1; | |
renderCounter[id] = next; | |
return next; | |
}; |
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
// Usage: | |
// node ./slow-appium-commands.js <log file> | |
// | |
// If your logs contain ANSI colour tags (ie downloaded from semaphore), first strip with | |
// sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g" <log file> | |
const fs = require("fs"); | |
// any webdriver commands which took longer than this will be logged | |
const THRESHOLD = 5000; // ms |
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
// https://stackoverflow.com/questions/70028907/narrowing-an-object-of-type-unknown | |
export const hasKey = <K extends string>(key: K, object: unknown): object is Record<K, unknown> => | |
typeof object === "object" && object !== null && key in object; |
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
const fs = require("fs"); | |
const pageCount = 69; // replace with actual page count | |
const workflows = []; | |
for (let i = 1; i < pageCount + 1; i++) { | |
const file = fs.readFileSync(`./sem_workflows_page_${i}.json`); | |
const page = JSON.parse(String(file)); | |
page.forEach((w) => workflows.push(w)); |
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 | |
# Replace <API_TOKEN> with your token from https://me.semaphoreci.com/account | |
# Replace <PROJECT_ID> with the project ID (can get this by describing a job: https://docs.semaphoreci.com/reference/api-v1alpha/#describe-job) | |
# Run the following to get the page count (in the `link` header, rel=last) & replace 69 below with the value: | |
# | |
# curl -sIXGET -H "Authorization: Token <API_TOKEN>" \ | |
# "https://countingup.semaphoreci.com/api/v1alpha/plumber-workflows?project_id=<PROJECT_ID>" | |
# |
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
// node <this file.js> <sainsbury json receipt> | |
const fs = require("fs"); | |
const file = process.argv[2]; | |
const data = JSON.parse(fs.readFileSync(file, { encoding: "utf8", flag: "r" })); | |
console.log("name,qty,total"); | |
data.order_items.map(item => { | |
const name = item.product.name.replace(",", ""); |
NewerOlder