Skip to content

Instantly share code, notes, and snippets.

View catwell's full-sized avatar

Pierre Chapuis catwell

View GitHub Profile
@catwell
catwell / nested.lua
Last active April 30, 2024 07:54
Lua nested coroutines
-- mini scheduler
local tasks = {} -- execution delays in ticks, indexed by the coroutine
local delay_mt = {}
local function is_delay(x)
return type(x) == "table" and getmetatable(x) == delay_mt
end
local function make_delay(t)
@catwell
catwell / cloc.txt
Created March 19, 2024 10:26
Lines of code in Python, Lua, PHP and Ruby
=== Python-3.12.2 ===
github.com/AlDanial/cloc v 2.00 T=5.10 s (775.6 files/s, 446163.8 lines/s)
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
Python 1946 136288 157620 635104
C 365 60311 57289 411210
C/C++ Header 492 21539 11893 206768
reStructuredText 490 85145 106460 102226
Text 133 2830 0 96064
@catwell
catwell / about.md
Created August 9, 2011 14:58 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@catwell
catwell / active.md
Last active December 21, 2023 09:47
Speakerdecks
@catwell
catwell / johnny-refiners.txt
Created December 14, 2023 15:44
Refiners dependency graph (all extras) w/ JohnnyDep
name summary
-------------------------------------------------- -------------------------------------------------------------------------------------------------------
refiners[conversion,test,training] The simplest way to train and run adapters on top of foundational models
├── bitsandbytes<0.42.0,>=0.41.0 k-bit optimizers and matrix multiplication routines.
├── datasets<3.0.0,>=2.14.0 HuggingFace community-driven open-source library of datasets
│ ├── aiohttp Async http client/server framework (asyncio)
│ │ ├── aiosignal>=1.1.2 aiosignal: a list of registered asynchronous callbacks
│ │ │ └── frozenlist>=1.1.0 A list-like structure which implements collections.abc.MutableSequence
│ │ ├── attrs>=17.3.0 Classes Without Boilerplate
│ │ ├── frozenlist>=1.1.1 A list
@catwell
catwell / bearer-seg.log
Created March 7, 2023 13:44
Bearer segfault
[bearer_1.0.0_linux_amd64 14:43] ./bearer scan bear-publishing
Loading rules
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1d93a0 pc=0x7fc16c092f16]
runtime stack:
runtime.throw({0x1520dac?, 0x352?})
/opt/hostedtoolcache/go/1.19.6/x64/src/runtime/panic.go:1047 +0x5d fp=0x7fc16d518fc8 sp=0x7fc16d518f98 pc=0x43c55d
runtime.sigpanic()
/opt/hostedtoolcache/go/1.19.6/x64/src/runtime/signal_unix.go:819 +0x369 fp=0x7fc16d519018 sp=0x7fc16d518fc8 pc=0x452189
@catwell
catwell / inch-staff-eng-public.md
Last active February 18, 2023 16:52
Staff Software Engineer chez Inch (version publique)

Staff Software Engineer chez Inch

Objet du document

Ce document décrit le poste de Staff Software Engineer chez Inch. Cette version est quasiment identique à la version interne à part à quelques endroits indiqués par le mot SNIP.

Généralités sur les ladder techniques

Les niveaux de début de carrière d'un ingénieur logiciel (on va dire dev par la suite) sont relativement bien connus, en gros :

@catwell
catwell / 2022-11-27.rb
Created November 29, 2022 13:53
Binary tree serialization 😈
# Evil answer, don't try this at home 😈
def serialize(node, inbuf = nil)
buf = inbuf || StringIO.new
buf.write('Node.new(')
buf.write(node.val.inspect)
if node.left
buf.write(', ')
serialize(node.left, buf)
if node.right
@catwell
catwell / 2022-11-26.rb
Created November 28, 2022 13:51
smlpth daily 2022-11-26
def efficient_part2(input)
n = input.length
r = Array.new(n, 1)
p_up, p_down = 1, 1
0.upto(n - 1) do |i|
j = n - i - 1
r[i] *= p_up
r[j] *= p_down
p_up *= input[i]
p_down *= input[j]
@catwell
catwell / b64url-np.md
Last active November 27, 2022 21:18
Decoding Base64-URL without padding

Decoding Base64-URL without padding

1) Add padding

Divide the length of the input string by 4, take the remainder. If it is 2, add two = characters at the end. If it is 3, add one = character at the end.

You now have Base64-URL with padding.

2) Translate to Base64