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
(async () => { | |
async function sleep(ms) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
let el = document.querySelector('[aria-label="My calendars"]').children[0]; | |
while (el) { | |
const label = el.querySelector("label"); | |
const checkbox = el.querySelector("[role=checkbox]"); |
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
/* eslint-disable no-param-reassign */ | |
const fetch = require("node-fetch"); | |
const _ = require("lodash"); | |
const fs = require("fs"); | |
const { format } = require("util"); | |
const SOURCE_REDASH = "https://app.redash.io/domain"; | |
const SOURCE_REDASH_API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"; |
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 glob = require("glob"); | |
const yargs = require("yargs"); | |
const { hideBin } = require("yargs/helpers"); | |
const path = require("path"); | |
const fs = require("fs"); | |
const yaml = require("yaml"); | |
const lodash = require("lodash"); |
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 bash | |
set -e | |
while (( $# > 0 )); do | |
case "${1}" in | |
-w | --workspace) | |
workspace="${2}" | |
shift 2 | |
;; |
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 MIN_CHUNK_SIZE = 5242880; // 5MB in bytes | |
const DEFAULT_CHUNK_SIZE = 26214400; // 25MB in bytes | |
export function getUploadParts(contentLength: number, chunkSize: number = DEFAULT_CHUNK_SIZE): string[] { | |
if (contentLength <= 0) { | |
throw new Error('ContentLength should be greater than 0 bytes'); | |
} | |
if (chunkSize < MIN_CHUNK_SIZE) { | |
throw new Error('ChunkSize should be greater or equal to 5 mb'); |
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
set -eo pipefail | |
node_modules=$(pwd)/node_modules | |
output="$1/nodejs/node_modules" | |
list=($(npm list --production --all --parseable)) | |
mkdir -p $output | |
for item in "${list[@]}"; do | |
path=$(realpath --relative-to="$node_modules" "$item") |
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 crypto = require("crypto"); | |
class Multipass { | |
constructor(multipass_secret) { | |
const key_material = crypto.createHash("sha256").update(multipass_secret).digest(); | |
this.encryption_key = key_material.subarray(0, 16); | |
this.signature_key = key_material.subarray(16); | |
} | |
generate_token(customer_data_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
const regex = /([^ ]+) [^(]*\(([^:]+):(\d+)/; | |
function getLocator() { | |
// stack 3 | |
const { stack } = new Error(); | |
if (!stack) { | |
return null; | |
} | |
// how far is your stdout? std write is 2 steps away | |
const match = stack.split(" at ")?.[3].match(regex); |
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 { Response } from "express"; | |
type WriteCallback = (error: Error | null | undefined) => void; | |
type WriteArguments1 = [chunk: any, callback?: WriteCallback]; | |
type WriteArguments2 = [chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void]; | |
type EndCallback = () => void; |
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
var flatten;(()=>{var r={666:r=>{function e(r,t,n){return Array.isArray(t)?t.reduce(((t,o,c)=>({...t,...e(r?`${r}[${c}]`:`[${c}]`,o,n)})),{}):t&&"object"==typeof t?Object.entries(t).reduce(((t,[o,c])=>{const u=r?`${r}.${o}`:`${o}`,s=n.ignore?.includes(u);return{...t,...s?{[u]:c}:e(u,c,n)}}),{}):{[r]:t}}r.exports=function(r,t={}){return e(void 0,r,t)}},138:(r,e,t)=>{const n=t(666),o=t(961);r.exports={flatten:n,unflatten:o}},961:r=>{function e(...r){return r.reduce(((r,t)=>(Object.keys(t).forEach((n=>{const o=r[n],c=t[n];Array.isArray(o)&&Array.isArray(c)?r[n]=o.concat(...c):r[n]=o&&"object"==typeof o&&c&&"object"==typeof c?e(o,c):c})),r)),{})}r.exports=function(r){return Object.entries(r).reduce(((r,[t,n])=>e(r,function(r,e){return(t=r,t.match(/(\[\d+\])|([^\.\[]+)/gi)).reverse().reduce(((r,e)=>function(r){return/^\[\d+\]$/.test(r)}(e)?[r]:{[e]:r}),e);var t}(t,n))),{})}}},e={},t=function t(n){var o=e[n];if(void 0!==o)return o.exports;var c=e[n]={exports:{}};return r[n](c,c.exports,t),c.exports}(138);flatten=t} |