Skip to content

Instantly share code, notes, and snippets.

View wmertens's full-sized avatar

Wout Mertens wmertens

View GitHub Profile
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 26, 2024 01:50
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@genki
genki / uint8array_serializer.ts
Last active February 28, 2024 07:11
The Uint8Array serializer over valid UTF-16 string.
// pack bytes into valid UTF-16 string
//
// strategy:
//
// * using ESC as the escape character
// * if there is ESC in the bytes, double it
// * if there is unmatched surrogate pair, mark it by the escape character
//
// 0x007f: escape, because it's rare but still only one utf-8 byte.
// To escape itself, use 0x007f 0x08ff (two bytes utf-8)
@edolstra
edolstra / nix-ui.md
Last active February 2, 2024 23:31
Nix UI

General notes

  • nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.

  • By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.

    @vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.

TBD: How to deal with search path clashes.

@wmertens
wmertens / ssh-crypt.bash
Last active February 2, 2024 10:01
ssh-crypt: bash function to encrypt using ssh-agent and openssl
#!/usr/bin/env bash
#
# ssh-crypt
#
# Bash function to encrypt/decrypt with your ssh-agent private key.
# Requires the commands gzip, ssh-add, ssh-keygen and openssl.
#
# Uses bash-specific extensions like <<<$var to securely pass data.
#
# Wout.Mertens@gmail.com 2021-11-11 - MIT Licensed
@SaraVieira
SaraVieira / gist file.md
Last active December 5, 2023 11:59
The Origin of Furries

In this talk we will be all discussing the origin of the furry fandom. How we will thogheter create a new furry-in-js framework. We will going over how they have changed the current fandom world, our hearts and the js world in 5 very awesome minutes! This talk is to prove a point that stars mean nothing in this case.

https://reactiveconf.com/

@ryyppy
ryyppy / proposal.md
Last active May 20, 2023 02:07
A Life on a Commandline - How to never touch a mouse again. Lightning Talk Proposal for ReactiveConf 2016 (https://reactiveconf.com/)

Proposal for this year's Reactive lightning talks @ReactiveConf - If you want to see my talk, star this gist please :-) [Reactive Blogpost][reactive-conference-blogpost]


A life on a Commandline

As a JavaScript developer, could you imagine using something else than Atom, Sublime or other IDE-like text-editors? During their daily work, people wrangle a lot with different applications, editors, windows, browsers and loose a lot of time because of their tools getting in their way.

@wmertens
wmertens / wrap-sqlite-backup.sh
Last active October 6, 2022 09:52
Wrap a command with an SQLite read lock on given files so they can safely be backed up
#!/usr/bin/env bash
#
# This script wraps a command with a read lock on given SQLite databases
# Example: wrap-sqlite-backup.sh *.sqlite3 -- tar cvzf backup.tgz *.sqlite3
#
# Note that it doesn't check for errors, so it really only works in WAL mode.
# Updates that read from ${COPROC[0]} to check errors welcome.
#
# Wout.Mertens@gmail.com
# https://gist.github.com/wmertens/4df207197074f9cb93f003c1cb723b4c
@wmertens
wmertens / node-require-debug.js
Created February 8, 2022 22:36
spy on NodeJS require stack
// Require this in your program, or load it with node's -r flag
const Mod = require('module')
const req = Mod.prototype.require
let indent = ''
const rootRE = new RegExp(process.cwd(), 'g')
const stack = []
Mod.prototype.require = function() {
try {
const request = arguments[0]
@rastating
rastating / USNetflixHosts
Created November 27, 2013 22:04
A hosts file to use to access the US Netflix using the Unblock US service without using their DNS for all of your traffic.
# Hosts file to access US Netflix using Unblock US without their DNS.
67.216.222.61 movies.netflix.com
67.216.222.65 cbp-us.nccp.netflix.com
67.216.222.130 movies1.netflix.com
67.216.222.104 movies2.netflix.com
147.255.171.14 netflix.com
147.255.171.7 moviecontrol.netflix.com
69.197.181.166 api-global.netflix.com
67.216.222.83 api-us.netflix.com
147.255.227.2 api.netflix.com
Thank you for extending an invitation to speak at HighLoad++. I
sincerely appreciate your consideration.
I am an outspoken advocate for LGBTQ equality; this position is deeply
woven into my work. Clojure From The Ground Up is adamantly
LGBT-inclusive. Jepsen is named after a gay pop anthem and includes
dozens of references to same-sex relationships and trans identities. My
talk slides are populated with bearded nuns, genderqueer punks, and
trans hackers. My twitter feed is about as gay as it is possible to get.