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 | |
while(true) | |
do | |
echo `date`, `ps -Al | wc -l 2>&1`, `lsof -u jenkins | wc -l 2>&1` | tee -a ./process_count.log | |
sleep 1 | |
done |
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
nc -l -p 9000 -c "nc 127.0.0.1 10353" | |
// "forward" 10353 to 9000 so it can be accessed externally |
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
nc -zv hostname port |
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
// Used to run mocha tests within intellij. Provide "--require setupMocha" to mocha to use this | |
require("babel/register"); | |
var chai = require("chai"); | |
var sinonChai = require("sinon-chai"); | |
var jsdom = require("jsdom").jsdom; | |
global.document = jsdom(""); | |
global.window = document.defaultView; | |
Object.keys(document.defaultView).forEach((property) => { | |
if (typeof global[property] === "undefined") { |
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
# Record Simulator screen - CTRL+C to finish | |
xcrun simctl io booted recordVideo appVideo.mov | |
# Optionally, convert to gif to attach to a GitHub PR: | |
# install dependencies | |
brew install ffmpeg -- --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265 | |
brew install imagemagick | |
# convert .mov to a series of PNGs |
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
if (process.argv.length !== 3) { | |
console.error("Expects exactly one argument"); | |
return; | |
} | |
const path = process.argv[2]; | |
console.log(path + "\n"); | |
const lineReader = require('readline').createInterface({ | |
input: require('fs').createReadStream(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
// 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(",", ""); |
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 | |
# 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 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 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; |
OlderNewer