Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active May 12, 2024 17:25
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@47ronin
47ronin / yt-dlp.sh
Last active May 12, 2024 17:25
Use yt-dlp to merge best video and best audio formats together into an MPEG-4 container, check for AV1/VP9, and transcode to H.264 if necessary. Usage: ./yt-dlp.sh <video_url>
#!/bin/bash
youtube_url="$1"
echo "Downloading video..."
video_info=$(yt-dlp -e -o "%(title)s" -- "$youtube_url")
sanitized_title=$(echo "$video_info" | sed 's/[^a-zA-Z0-9_.-]/_/g')
output_file="${sanitized_title}.mp4"
yt-dlp -o "temp.mp4" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -- "$youtube_url"
@m-Phoenix852
m-Phoenix852 / discord-token-logger.js
Created August 26, 2020 07:45
Simple script to log in to discord account using token.
let token = "your token";
function login(token) {
setInterval(() => {
document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `"${token}"`
}, 50);
setTimeout(() => {
location.reload();
}, 2500);
}
[FileInfo]
FileName=C:/Users/Stealth/Desktop/AC24ls.dcf
FileVersion=1
FileRevision=0
EDSVersion=4.0
Description=Gen4 (T,P,PS - slip)29 March 2012 13:20
CreationTime=04:38PM
CreationDate=02-24-2015
CreatedBy=Tech/Ops SEVCON Ltd
ModificationTime=04:38PM
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 12, 2024 17:15
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Tranquility2
Tranquility2 / get_samples.py
Created November 11, 2023 15:54
Util to fetch sample files
#!/usr/bin/env python3
"""Util to fetch sample files."""
import json
import logging
from dataclasses import dataclass
from urllib.error import HTTPError
from urllib.request import Request, urlopen
logging.basicConfig(encoding="utf-8", level=logging.INFO, format="%(asctime)-15s %(levelname)-8s | %(message)s")
@fracek
fracek / CMakeLists.txt
Last active May 12, 2024 17:13
CMake and GTK+ 3
# Thanks to @danger89 and @Ilothar for updating the gist.
# Set the name and the supported language of the project
project(hello-world C CXX)
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 3.10)
# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtkmm-3.0)

Setup and testing using local docker registry

Making the credential file

Create the folder

mkdir registry
cd registry/
mkdir auth

Crete the auth file

@Gavinok
Gavinok / toc_for_ms.org
Last active May 12, 2024 17:10
Some notes on using Groff to produce a Table of Contents with the ms macros

Table Of Contents

Example of automatic creating of tables of contents in groff

.NH
method

.XS \" index start
method contents
.XE \" end index
.LP
@v1mkss
v1mkss / JetBrains Activation.md
Last active May 12, 2024 17:09
JetBrains Activation

JetBrains Activation

  • No proxy for:
*.apache.org, *.github.com, *.github.io, *.githubusercontent.com, *.gitlab.com, *.google.com, *.gradle.org, *.jetbrains.space, *.maven.org, cache-redirector.jetbrains.com, cloudconfig.jetbrains.com, download-cdn.jetbrains.com, download.jetbrains.com, downloads.marketplace.jetbrains.com, ea-report.jetbrains.com, github.com, gitlab.com, google.com, gradle.org, jcenter.bintray.com, plugins.jetbrains.com, resources.jetbrains.com, www.jetbrains.com

Activation Key:

UX394X3HLT-eyJsaWNlbnNlSWQiOiJVWDM5NFgzSExUIiwibGljZW5zZWVOYW1lIjoiSG9uZ2lrIFVuaXZlcnNpdHntmY3snbXrjIDtlZnqtZAiLCJsaWNlbnNlZVR5cGUiOiJDTEFTU1JPT00iLCJhc3NpZ25lZU5hbWUiOiLkvJfliJvkupEg5bel5L2c5a6kIiwiYXNzaWduZWVFbWFpbCI6ImhhbmF6YXdhbWl0b0BnbWFpbC5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDI0LTEyLTEzIiwiZXh0ZW5kZ