Skip to content

Instantly share code, notes, and snippets.

@moyix
moyix / Makefile
Created March 8, 2024 05:26
Claude 3 writes a fuzzer
all: gifread gifread.asan gifread.ubsan gifread.coverage
gifread: gifdec.c gifread.c gifdec.h
$(CC) $(CFLAGS) -o $@ gifdec.c gifread.c $(LDFLAGS)
gifread.asan: gifdec.c gifread.c gifdec.h
$(CC) $(CFLAGS) -g -fsanitize=address -o $@ gifdec.c gifread.c $(LDFLAGS)
gifread.ubsan: gifdec.c gifread.c gifdec.h
$(CC) $(CFLAGS) -g -fsanitize=undefined -o $@ gifdec.c gifread.c $(LDFLAGS)
@gd3kr
gd3kr / embeddings.py
Created February 15, 2024 20:35
compute embeddings for tweets in tweets.json
"""
a simple script that reads tweets inside a json file, uses openai to compute embeddings and creates two files, metadata.tsv and output.tsv, which cam be used to visualise the tweets and their embeddings in TensorFlow Projector (https://projector.tensorflow.org/)
"""
# obtain tweets.json from https://gist.github.com/gd3kr/948296cf675469f5028911f8eb276dbc
import pandas as pd
import json
from openai import OpenAI
@ivanistheone
ivanistheone / txt2mp3.sh
Last active January 5, 2023 14:55
This script converts a plain text file, e.g. article.txt into a mp3 audiobook using the MacOS text-to-speech accessibility command-line tool `say`. Adjust the `VOICE` and `RATE` parameters to customize to your liking. Note this requires running on MacOS.
#!/usr/bin/env bash
set -e
# This script converts any text file into a mp3 audiobook using the MacOS
# text-to-speech accessibility command-line tool `say`.
# Adjust the `VOICE` and `RATE` parameters to customize to your liking:
VOICE="Alex"
RATE="295" # pretty fast
if [ $# -eq 0 ]; then
@khushal87
khushal87 / blog3.md
Last active April 25, 2024 13:13
Linking a custom domain from Google domains to Vercel app

Linking a custom domain to a deployed application is confusing and at times you don't get a route on how to link the domain with the website. 😫

In this article, I will be explaining how to link a Custom domain brought in Google Domains service to an application hosted on Vercel.

Perks of using vercel is that it allows adding domain without any verification unlike Heroku/Netlify, which means you don't have to add your billing details to add a domain to your application. Moreover, it is fast, efficient, and easy to use.😁

What is Vercel?

​Vercel is a deployment and collaboration platform for frontend developers. ​Vercel enables developers to host websites and web services that deploy instantly and scale automatically – all without any configuration. Source - Official Docs

@navsing
navsing / clubhouse.swift
Created February 11, 2021 21:22
Recreating ClubHouse in SwiftUI with Dark Mode
//
// Clubhouse.swift
// Playground
//
// Created by Nav Singh on 2/11/21.
//
import SwiftUI
struct Clubhouse: View {
@jordansinger
jordansinger / iPod.swift
Created July 27, 2020 21:19
Swift Playgrounds iPod Classic
import SwiftUI
import PlaygroundSupport
struct iPod: View {
var body: some View {
VStack(spacing: 40) {
Screen()
ClickWheel()
Spacer()
}
@mhart
mhart / index.js
Created July 24, 2019 21:04
Log errors to Sentry from a Cloudflare Worker
// Get the key from the "DSN" at: https://sentry.io/settings/<org>/projects/<project>/keys/
// The "DSN" will be in the form: https://<SENTRY_KEY>@sentry.io/<SENTRY_PROJECT_ID>
// eg, https://0000aaaa1111bbbb2222cccc3333dddd@sentry.io/123456
const SENTRY_PROJECT_ID = '123456'
const SENTRY_KEY = '0000aaaa1111bbbb2222cccc3333dddd'
// Useful if you have multiple apps within a project – not necessary, only used in TAGS and SERVER_NAME below
const APP = 'my-app'
// https://docs.sentry.io/error-reporting/configuration/?platform=javascript#environment
@pofulu
pofulu / Audio to Spark AR
Last active August 14, 2020 21:01
Convert any sound to the format acceptable to Spark AR Studio with FFmpeg.
ffmpeg -i audio.wav -ar 44100 -ac 1 output.m4a
@matthewreagan
matthewreagan / Perlin
Last active March 30, 2024 16:18
Perlin noise generation in Swift
// Perlin.swift
// Created by Matthew Reagan on 8/7/18.
//
// Quick implementation of the the classic Perlin noise
// generation function, useful for creating organic textures
// or terrain. Perlin noise can also be easily generated with
// Apple's GameplayKit framework, this code is mostly for
// experimentation purposes. (Disclaimer: This code is not
// optimized, nor particularly elegant, but it can be used as
// a jumping off point for writing custom noise functions.)
@jashmenn
jashmenn / final-cut-it-out.js
Created September 21, 2017 11:44
Remove Silence from Final Cut Pro clips, automatically, using ffmpeg timecodes and OSX JavaScript Automation - Demo: https://imgur.com/a/Zisav
#!/usr/bin/env osascript -l JavaScript
/**
* Delete silence from Final Cut Pro timeline using a script.
* Demo: https://imgur.com/a/Zisav
*
* This script accepts an ffmpeg silencedetect log as input.
*
* To setup, have fcp running along with your clip selected. Ensure that the
* timecode will start at zero before running this script. That is, if your clip