Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
VictorTaelin / gpt4_abbreviations.md
Last active April 26, 2024 17:31
Notes on the GPT-4 abbreviations tweet

Notes on this tweet.

  • The screenshots were taken on different sessions.

  • The entire sessions are included on the screenshots.

  • I lost the original prompts, so I had to reconstruct them, and still managed to reproduce.

  • The "compressed" version is actually longer! Emojis and abbreviations use more tokens than common words.

@cryptaliagy
cryptaliagy / GoLinks tutorial.md
Last active December 1, 2022 22:12
A tutorial for how to install golinks locally. Check out the repository at https://github.com/taliamax/golinks
@DusanBrejka
DusanBrejka / fluent-ffmpeg-custom-args.js
Last active September 21, 2023 06:45
node-fluent-ffmpeg - Execute Custom FFMPEG arguments hack
/*
As at the time of writing this Fluent ffmpeg-API for node.js has not been updated
for years and still does not support custom FFMPEG attributes, the only solutions
are either forking it or resorting to hacks like this one...
Please use it only when fluent does not support more complex arguments
(like generating multi-rendition HLS with all playlists in a single command)
NOTE: this does not support 'progress' event, but you can do it easily by
parsing 'stderr' event with extractProgress method from fluent-ffmpeg/lib/options.js
@odbol
odbol / json_lines.js
Created August 27, 2019 04:42
Parse JSON Lines file in the browser with Javascript. http://jsonlines.org/
function parseJsonLines(file) {
let results = [];
for (let i = 0; i < file.length;) {
const end = file.indexOf('\n', i);
if (end < 0) {
end = file.length;
}
const currentLine = file.substring(i, end);
@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@hinchliff
hinchliff / c7n_run.py
Created April 19, 2019 12:31
Run a Cloud Custodian policy file from a Python script. Most useful perhaps to be able to run Cloud Custodian from AWS Lambda.
import os
import logging
from c7n.commands import run
from c7n.config import Config
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Capture our current directory
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@Hegemege
Hegemege / hue_shift.py
Last active February 29, 2024 20:25
OBS Hue Shift over Time
# How to use this script in OBS:
# You need Python 3.6 installed
# 1. Open OBS > Tools > Scripts
# 2. Copypaste the Python 3.6 install directory into Python Settings tab.
# 3. Download this file onto your computer and put it somewhere safe
# 4. Add the script to the list of Loaded Scripts by clicking the + at the bottom left
# 5. Select the script from the list and select the correct output source you want to apply the effect to.
# If you can't find the correct source, scroll to the bottom of the file to see if your source is filtered out
# The source you selected must have a Color Correction filter, that has been renamed to "Hue Shift".
# The script won't work otherwise. I couldn't figure out how to list all the filters in a dropdown because
@devdbrandy
devdbrandy / app.js
Created December 5, 2018 18:58
Simple Express API
/* eslint-disable */
const express = require('express');
const app = express();
app.use(express.json());
const db = {
users: [
@kerbeh
kerbeh / greenscren.md
Created September 25, 2018 00:17
Greenscreen chroma key with FFmpeg

##FFmpeg greenscreen process

ffmpeg -hwaccel videotoolbox -i background.jpg -i out.mp4 -filter_complex "[1:v]colorkey=0x34d454:0.3:0.15[ckout];[0:v][ckout]overlay[despill];[despill] despill=green[colorspace];[colorspace]format=yuv420p[out]" -map "[out]" output.mp4

###Explanation

*hwaccel enable hardware accelartion profile videotoolbok is avlaiable on my mac for this codec *-i is the input, the greenscreen video is second and the background image is first *-filter_complex chains up the filters in a string *colorkey provides the color of the green screen in hex, the threshold to match (higher is more) and the blend (higher is more)

@rbw
rbw / part_of_day.py
Last active October 17, 2022 22:44
Get part of day (morning, afternoon, evening, night) in Python3.6+
#!/usr/bin/env python3
def get_part_of_day(h):
return (
"morning"
if 5 <= h <= 11
else "afternoon"
if 12 <= h <= 17
else "evening"