Skip to content

Instantly share code, notes, and snippets.

View Delapouite's full-sized avatar

Bruno Heridet Delapouite

View GitHub Profile
@christianparpart
christianparpart / terminal-synchronized-output.md
Last active May 18, 2024 17:52
Terminal Spec: Synchronized Output

Synchronized Output

Synchronized output is merely implementing the feature as inspired by iTerm2 synchronized output, except that it's not using the rare DCS but rather the well known SM ? and RM ?. iTerm2 has now also adopted to use the new syntax instead of using DCS.

Semantics

When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.

This mode attempts to mitigate that.

@ATRescue
ATRescue / MozLZ4-garbage.md
Last active January 2, 2023 08:40
MozLZ4/JsonLZ4 is a moronic idea. Here's why.

MozLZ4/JsonLZ4 is a moronic idea. Here's why.

Written by ATrescue.

I am not implying the comperssion algorithm Lz4 is bad. But adding an Lz4 layer to JSON files was a terrible idea by Mozilla.

Since Firefox version 56 (which is the last non-quantum version of Firefox), the session files in the 📁 sessionstore-backups directory are no longer recovery.bak and recovery.json, but recovery.baklz4 and recovery.jsonlz4. They should have called it recovery.bak.lz4 and recovery.json.lz4, which would be more logical file names, but they should not have done it in first place. Also the folders 📁bookmarkbackups 📁crashes/store.json.mozlz4 📁datareporting is affected (intoxicated) by Lƶ4.

“If it isn't broken, don't ‘fix’ it” does not apply to everything (e.g. when improving so

@Delapouite
Delapouite / tmux-commands.txt
Created May 17, 2017 20:29
tmux commands inverted : noun-verb
tmux list-commands | cut -d' ' -f1 | sed -r 's/([^-]*)-(.*)/\2-\1/' | sort
before-confirm
buffer-choose
buffer-delete
buffer-load
buffer-paste
buffer-save
buffer-set
@romainl
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active September 19, 2023 08:16
Vim: pushing built-in features beyond their limits

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us lose context very quickly,
  • when we need to compare the matches.
@gre
gre / constants.js
Last active September 1, 2015 21:06
const ENUM = `
BAR
FOO
WHATEVER
`;
const enumMap = {};
ENUM.split("\n").forEach(name => enumMap[name] = name);
module.exports = enumMap;
@aisamanra
aisamanra / callbacks.rs
Last active May 3, 2024 20:24
Creating a HashMap of closures in Rust
#![feature(unboxed_closures)]
#![feature(core)]
#![feature(io)]
use std::old_io::stdio::{stdin};
use std::collections::HashMap;
// This is our toy state example.
#[derive(Debug)]
struct State {
@bendc
bendc / nodelist-iteration.js
Created January 13, 2015 14:39
ES6: Iterating over a NodeList
var elements = document.querySelectorAll("div"),
callback = (el) => { console.log(el); };
// Spread operator
[...elements].forEach(callback);
// Array.from()
Array.from(elements).forEach(callback);
// for...of statement
@jbrown123
jbrown123 / reveal per-slide theme override.js
Last active May 5, 2024 21:00
Reveal.js - per-slide theme override using data-theme attribute
// the code below can be added to the end of your Reveal slide deck to implement
// per slide theme setting via the data-theme attribute
// I put this in right below the call to Reveal.initialize()
// the code is smart enough to restore the previous default theme
// (or slide specific theme) as you move forward and backward
// it also takes into account vertical slide stacks with a data-theme
// attribute on the outer <section> tag and allows individual vertical
// slides to specify their own override
@potfur
potfur / $.js
Last active February 15, 2023 14:49
window.S = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
};
// [S('#header'), S('.container'), S('?div')]
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs