Skip to content

Instantly share code, notes, and snippets.

const puppeteer = require('puppeteer');
const fs = require('fs');
(async () => {
try {
// Read the CSV file
const inputCsv = fs.readFileSync('output.csv', 'utf-8');
const records = inputCsv.split('\n').map((row, index) => {
if (index === 0) return null; // Skip the header row
const [Index, Title, URL] = row.split(',');
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const fs = require('fs');
const readline = require('readline');
const processInput = (input) => {
// Split the input into chunks based on the list numbers
const chunks = input.split(/\n\s*\d+\n/).filter(chunk => chunk.trim() !== '');
// Extract title and URL from each chunk
const videos = chunks.map(chunk => {
const titleMatch = chunk.match(/(.*?)https?:\/\/youtube\.com/g);
@ejfox
ejfox / output.csv
Created December 20, 2023 19:13
yt-watchlater
Index Title URL
1 https://youtube.com https://youtube.com/watch?v=ex2b2bpkaio&list=WL&index=1&pp=gAQBiAQB
2 https://youtube.com https://youtube.com/watch?v=Bq-Ym8qq7AE&list=WL&index=2&pp=gAQBiAQB
3 https://youtube.com https://youtube.com/watch?v=GKS5GIb2j84&list=WL&index=3&pp=gAQBiAQB
4 https://youtube.com https://youtube.com/watch?v=zMoUddn667c&list=WL&index=4&pp=gAQBiAQB
5 https://youtube.com https://youtube.com/watch?v=Yjfbl-wbAnk&list=WL&index=5&pp=gAQBiAQB
6 22:31 Now playing https://youtube.com https://youtube.com/watch?v=LZ06jc6RSu8&list=WL&index=6&pp=gAQBiAQB
7 WATCHED 9:05 Now playing https://youtube.com https://youtube.com/watch?v=pSgnS4ZEFlo&list=WL&index=7&pp=gAQBiAQB
8 13:59 Now playing https://youtube.com https://youtube.com/watch?v=YIE9UYNR6yo&list=WL&index=8&pp=gAQBiAQB
9 WATCHED 15:15 Now playing https://youtube.com https://youtube.com/watch?v=CyCWh36xXSg&list=WL&index=9&t=181s&pp=gAQBiAQB
@ejfox
ejfox / split_mp3_by_silence.sh
Created November 28, 2023 21:20
Use ffmpeg to split an mp3 file into separate files based on periods of silence
#!/bin/bash
# Remember to make your script executable by running chmod +x yourscript.sh and then execute it with ./yourscript.sh.
# Name of the input file
input="yourfile.mp3"
# Threshold for silence detection, in dB
silence_threshold="-50dB"
# Duration of silence to detect, in seconds

Absolutely, I'd be glad to provide you with a structured methodology for conducting a session that incorporates elements we explored in this conversation. This template can be adapted to various types of problems and concerns. Let's call this approach the "Integrated Insight Process."

Step 1: Problem Exploration and Context Establishment

  1. Start by asking the individual to introduce the problem or concern they want to address.
  2. Gain a comprehensive understanding of the context, emotions, and thoughts surrounding the issue.
  3. Probe for any relevant background information that might be influencing the current feelings.
  4. Ensure a safe and nonjudgmental environment for open sharing.

Step 2: Jungian Perspective Integration

We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 23 columns, instead of 13. in line 3.
Spotify ID,Artist IDs,Track Name,Album Name,Artist Name(s),Release Date,Duration (ms),Popularity,Added By,Added At,Genres,Danceability,Energy,Key,Loudness,Mode,Speechiness,Acousticness,Instrumentalness,Liveness,Valence,Tempo,Time Signature
6R61DbcGKKMuVEeyrkVOkH,4J29rwF7Lcqch3IyOubvxC,Fridge Magnet - Radio Theme 1,No!,Uffe,2016-10-14,133436,27,spotify:user:pseudoplacebo,2022-06-25T16:29:28Z,jazz house,0.696,0.409,8,-11.494,1,0.0402,0.264,0.784,0.103,0.0667,115.09,4
4BXBkVMiXIgDRkxeKXbsUl,"3nb0xF02MfjP2lM9zVNgnp,3YOthLzFPTgp0fEtLRUoES",Lahore State of Mind - Al Dobson Jr. Remix,Lahore State of Mind,"Jaubi,Al Dobson Jr.",2018-08-03,193497,32,spotify:user:pseudoplacebo,2022-06-25T17:16:50Z,"pakistani indie,indie jazz",0.707,0.554,6,-9.417,1,0.0705,0.11,0.828,0.101,0.32,91.043,4
1IBT4vJVzI725DANix96bA,6RBdnGDQUK9KyF8tbKbAne,"I'll Give You a Ring (When I Come, If I Come)",Free and Easy,Apple & The Three Oranges,2013-03-05,193066,38,spotify:user:pseudoplacebo,2022-06-25T17:21:04Z,"souldies,traditional soul",0.613,0
@ejfox
ejfox / build_top40_allsector_geojson.mjs
Created September 22, 2022 16:31
A GPT-3 code-davinci-002 written script to scrape the top 40 worst polluters for all available industries
/* Our API takes queries like https://api.dev.climatetrace.org/v0/assets?sectors=steel&limit=40&year=2020 and returns geojson with point features */
/* We need to loop through every available sector and concatenate all of the features together into one large GeoJSON file called top40_allsectors.geojson */
/* Available sectors are: [{"SectorId":1,"SectorName":"solid-waste-disposal"},{"SectorId":2,"SectorName":"manure-management"},{"SectorId":3,"SectorName":"oil-and-gas-production-and-transport"},{"SectorId":4,"SectorName":"coal-mining"},{"SectorId":5,"SectorName":"cement"},{"SectorId":6,"SectorName":"electricity-generation"},{"SectorId":7,"SectorName":"oil-and-gas-refining"},{"SectorId":8,"SectorName":"aviation"},{"SectorId":9,"SectorName":"international-aviation"},{"SectorId":10,"SectorName":"copper-mining"},{"SectorId":11,"SectorName":"shipping"},{"SectorId":12,"SectorName":"iron-mining"},{"SectorId":13,"SectorName":"bauxite-mining"},{"SectorId":14,"SectorName":"domestic-aviation"},{"SectorId":15,"SectorNam
<template>
<section class="hero-map-container ba b--white bw2 bw3-l" ref="root">
<div id="map" class="w-100 vh-100 z-1 top-0" ref="mapRoot"></div>
<div ref="mapText" class="map-text relative z-999 ml5-l measure">
<p data-lat="35.102215" data-lng="-89.999185">TK 1</p>
<p
data-lat="35.12587"
data-lng="-90.0362"
@ejfox
ejfox / add_tags_to_tweets.js
Created June 27, 2022 18:36
Use OpenAI to add tags to a JSON file of tweets
const fs = require('fs');
const { Configuration, OpenAIApi } = require('openai');
const { RateLimiter } = require('limiter');
const limiter = new RateLimiter({
tokensPerInterval: 10,
interval: 'minute',
fireImmediately: true,
});