Skip to content

Instantly share code, notes, and snippets.

@steven2358
steven2358 / ffmpeg.md
Last active March 12, 2025 01:04
FFmpeg cheat sheet
@superKalo
superKalo / browser-extension-api.js
Last active October 17, 2017 09:54
Make your browser extension code compatible with all browsers APIs
/**
* Тhe Extension API model is currently being standardized to browser.xxx,
* and some browsers are defining their own namespaces in the meantime
* (for example, Edge is using msBrowser).
*
* Fortunately, most of the API remains the same behind the browser.
* So, it’s very simple to support all browsers and namespace definitions.
*
* You’ll also need to use the subset of the API supported by all browsers:
* - Microsoft Edge: https://docs.microsoft.com/en-us/microsoft-edge/extensions/api-support
@Kartones
Kartones / postgres-cheatsheet.md
Last active March 16, 2025 18:07
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@jboner
jboner / latency.txt
Last active March 14, 2025 07:37
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