Usage:
$ npx jscodeshift -t https://gist.githubusercontent.com/novemberborn/c2cdc94020083a1cafe3f41e8276f983/raw/eaa64c55dfcda8006fc760054055372bb3109d1c/transform.js test.jsSee https://github.com/facebook/jscodeshift#usage-cli for further details.
| import {WorkerHost} from '@nestjs/bullmq'; | |
| import {Job} from 'bullmq'; | |
| export class BatchWorkerHost extends WorkerHost { | |
| private jobBatchCreationTime: Date; | |
| private jobBatch: Job[]; | |
| private jobBatchProcessPromise: Promise<void>; | |
| private running: boolean = false; | |
| private resolveJobBatchProcessPromise: () => void; |
| #!/bin/bash | |
| # This script takes a clean Ubuntu Server 24.04 LTS AMI and installs and configures | |
| # everything needed to deploy a Rails 7 app to it. The resulting state is a secure, | |
| # production-ready instance. | |
| set -euo pipefail | |
| # --- AESTHETICS --- |
| #!/bin/bash | |
| # I edited the ruby lexer (line 637 in the following file... | |
| # [skm@skmair2:/Library/Python/2.7/site-packages/pygments/lexers/agile.py | |
| # to remove spacial handling of the word 'name' | |
| # so I could use it as a variable/method name. | |
| # This script come from Katrina, with these instructions: | |
| # I've also attached the presentation.py file which is where the style | |
| # is defined. The colors are normal hex values, so if you know how you |
| // abstract class, not intended to be instantiated directly | |
| class CalendarItem { | |
| static #UNSET = Symbol("unset") | |
| static #isUnset(v) { | |
| return v === this.#UNSET; | |
| } | |
| static { | |
| for (let [idx,msg] of [ | |
| "ID is already set.", | |
| "ID is unset.", |
| /* Scale a value from one range to another | |
| * Example of use: | |
| * | |
| * // Convert 33 from a 0-100 range to a 0-65535 range | |
| * var n = scaleValue(33, [0,100], [0,65535]); | |
| * | |
| * // Ranges don't have to be positive | |
| * var n = scaleValue(0, [-50,+50], [0,65535]); | |
| * | |
| * Ranges are defined as arrays of two values, inclusive |
| echo "Creating an SSH key for you..." | |
| ssh-keygen -t rsa | |
| echo "Please add this public key to Github \n" | |
| echo "https://github.com/account/ssh \n" | |
| read -p "Press [Enter] key after this..." | |
| echo "Installing xcode-stuff" | |
| xcode-select --install |
Usage:
$ npx jscodeshift -t https://gist.githubusercontent.com/novemberborn/c2cdc94020083a1cafe3f41e8276f983/raw/eaa64c55dfcda8006fc760054055372bb3109d1c/transform.js test.jsSee https://github.com/facebook/jscodeshift#usage-cli for further details.
| function Perceptron(opts) { | |
| if (!opts) opts = {} | |
| var debug = 'debug' in opts ? opts.debug : false; | |
| var weights = 'weights' in opts | |
| ? opts.weights.slice() | |
| : [] | |
| var threshold = 'threshold' in opts |
convert google takeout archive for location history from kml to gpx and split file into one per day
gpsbabel -i kml -f Location\ History.kml -o gpx -F out.gpx
gpsbabel -t -i gpx -f out.gpx -x track,merge,pack,split,title="ACTIVE LOG # %Y%m%d" -o gpx -F split.gpx
python2 gpxsplitter.py split.gpx
| import * as fs from "fs"; | |
| import * as path from "path"; | |
| import * as url from "url"; | |
| import { exec } from "child_process"; | |
| import cuid from "cuid"; | |
| import snoowrap from "snoowrap"; | |
| import throat from "throat"; | |
| import mmm from "mmmagic"; | |
| import axios from "axios"; |