View audio_from_elevenlabs.js
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
// docs: | |
// https://docs.elevenlabs.io/api-reference/quick-start/introduction | |
// https://api.elevenlabs.io/docs#/text-to-speech/Text_to_speech_v1_text_to_speech__voice_id__post | |
const axios = require('axios'); | |
const fs = require('fs'); | |
const path = require('path'); | |
require('dotenv').config(); | |
View screenshot-url.ts
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
// Name: Screenshot URL | |
import "@johnlindquist/kit" | |
const { chromium }: typeof import("playwright") = await npm( | |
"playwright" | |
) | |
// get URL from user | |
let urlFromUser = await arg("Enter the URL to screenshot"); |
View today-timestamp.ts
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
// Name: today-timestamp | |
// Description: inserts today's date in "ISO" format 2023-02-11 | |
// Snippet: | |
import '@johnlindquist/kit'; | |
function twoDigits(number: number): string { | |
return number.toString().padStart(2, '0'); | |
} |
View giphy-search.js
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 "@johnlindquist/kit" | |
// Menu: Giphy | |
// Description: Search giphy. Paste link. | |
// Author: John Lindquist | |
// Twitter: @johnlindquist | |
let download = await npm("image-downloader") | |
let queryString = await npm("query-string") |
View generate-index-from-config.js
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
// For every website folder that contains a certain file, autogen an index.html landing page for it. | |
const { readdirSync, statSync, writeFileSync, existsSync, readFileSync } = require('fs'); | |
const { join } = require('path'); | |
// ----------------------------------------- Config | |
const DIR = '/home/deploy/www'; | |
const CONFIG_FILE = 'logo/info.txt'; |
View generate-nginx-config.js
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 { readdirSync, statSync, writeFileSync } = require('fs') | |
const { join } = require('path') | |
// ----------------------------------------- Config | |
const DIR = '/home/deploy/www'; | |
const TARGET = '/home/deploy/deployNginxConfig'; | |
const HEADER = ` | |
# Config generated by 'generate-nginx-config.js', do not hand-edit |
View addFileToGit.js
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 Octokit = require('@octokit/rest'); // https://octokit.github.io/rest.js/ | |
// Customize this stuff: | |
const auth = 'your-key-generated-in-github-ui'; // PRIVATE! | |
const owner = 'repo-owner'; | |
const repo = 'your-repo-name'; | |
// Constants | |
const userAgent = 'git commiter v1'; | |
const ref = 'heads/master'; |
View node-get-file-contents.js
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 path = require('path') | |
const DIR = 'input/'; | |
const readFile = name => fs.readFileSync(name); | |
(async () => { | |
const files = fs.readdirSync(DIR) | |
.filter(s => s.match(/\.csv$/)) // only .csv files -- change to whatever you want. |
View sort-object-keys.ts
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
export interface SomeShape { | |
b: string, | |
c: string, | |
a: string, | |
} | |
// Specify your sort order here | |
const rank: Array<keyof SomeShape> = ['a', 'b', 'c']; | |
export function sortedKvpString(obj: SomeShape) { |
View keybindings.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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "cmd+d", | |
"command": "editor.action.copyLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", | |
"command": "-editor.action.copyLinesDownAction", |
NewerOlder