Skip to content

Instantly share code, notes, and snippets.

View dctalbot's full-sized avatar
🕊️

David Talbot dctalbot

🕊️
View GitHub Profile
@dctalbot
dctalbot / gist:b47a2d43a6af1307845c6da27397f35f
Created March 20, 2024 06:28
compress a video with ffmpeg
`ffmpeg -i ~/Downloads/foo.MOV ~/Desktop/new-foo.MP4`
@dctalbot
dctalbot / list_npm_dependencies.js
Last active December 21, 2023 08:39
Node script to get a flat list of all npm dependencies in a project
// USAGE: npm ls --all --json | node deps.js > result.json
import * as fs from "fs";
import * as _ from "lodash-es";
import * as crypto from "crypto";
const VERSION_NONCE_DELIM = crypto.randomBytes(20).toString("hex");
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@dctalbot
dctalbot / postgres-dump-all-tables-into-csv.sh
Last active November 19, 2023 05:32
A psql command that dumps a postgres database into CSV files, 1 per table.
psql -Atc "select tablename from pg_tables where schemaname='$SCHEMA'" $DB |\
while read TBL; do
psql -c "COPY $SCHEMA.$TBL TO STDOUT WITH CSV HEADER" $DB > $TBL.csv
done
@dctalbot
dctalbot / tailwind.css
Created February 8, 2021 06:05
Tailwind full generated stylesheet
This file has been truncated, but you can view the full file.
/* ./your-css-folder/styles.css */
/* ! tailwindcss v2.0.3 | MIT License | https://tailwindcss.com */
/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
/*
Document
========
*/
@dctalbot
dctalbot / unlike_all_tweets.md
Last active September 12, 2021 09:21
twitter: delete all liked tweets

One gap in twitter's API is the ability to unlike tweets, so here we are doing it manually

  1. Navigate to twitter.com/<insert username>/likes
  2. Copy and paste this script into console
  3. Wait for script to finish
setInterval(() => {
  try {
 document.querySelector('[data-testid="unlike"]').click()
@dctalbot
dctalbot / get_color.js
Created June 26, 2019 20:26
Get Common or "Dominant" Color from Image
drawImage = async img_path => {
let canvas = document.createElement("canvas");
canvas.src = img_path;
const context = canvas.getContext("2d");
const img = await loadImage(img_path);
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);
@dctalbot
dctalbot / gh-pages-deploy.md
Created June 17, 2018 05:15 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).