Skip to content

Instantly share code, notes, and snippets.

View bew's full-sized avatar
😎
https://nohello.net

Benoit de Chezelles bew

😎
https://nohello.net
View GitHub Profile
@bcardiff
bcardiff / list-deps.cr
Last active May 29, 2024 17:37
List binary dependencies to build a minimal docker image from scratch
unless ARGV.size > 0
puts " Missing executable file argument"
puts " Usage (in a Dockerfile)"
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable"
exit 1
end
executable = File.expand_path(ARGV[0])
unless File.exists?(executable)
require "../crystal/**"
require "../onyx/**"
macro dump_prop(name)
io << "\n" << " " * (depth+1) << {{name.stringify}}[1..-1].cyan << ": "
case (v = {{name}})
when Nil then io << "nil"
else v.dump_inspect(io, terse_output, depth + 1)
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active April 27, 2025 10:04
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
@Papierkorb
Papierkorb / 00_LICENSE.md
Last active April 25, 2017 19:41
Struct-by-reference helper class

Copyright (c) 2017 Stefan Merettig

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all

# This isn't meant to be ran as a script, but line-by-line
# Props to Binary (benary.org) for helping me with this
# 0: Create a Scaleway instance and SSH into it
ssh root@...
# 1: Install Nix
adduser user # set a password, doesn't matter what because it's not staying long
adduser user sudo
su -l user
Window
----
N new widnow
P new private window
W close window
o quick command # this is really helpful when used as key sequnce e.g. pressing o r d in sequence brings me to reddit immediately as 'o' to show quick command window and 'rd' is nickname of reddit in my bookmarks
+Esc Task Manager
E extensions
Y history
? keyboard cheatsheet
@chainat
chainat / gist:e2d4d806b8b1a3ddb6d5b8400e1e30ea
Last active May 28, 2022 20:07
Compact local git repo
These two commands will minimise the diskspace used for the repo. Please note that Github, BitBucket run this all the time to minimise the diskspace.
Suggestion: Run as often as you can (i.e. once a week for small working-in-progress repo, one in every few days if many people work together).
It's no harm to run it often, cron or system task could be an option too.
# Clean unused commits
`git reflog expire --all --expire=now`
# Compact the disk by remove unneccesary files from the local git repository
`git gc --aggressive --prune=now`
@kawanet
kawanet / material-colors.json
Last active March 23, 2025 04:07
Material Design Style Color Palette as JSON
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"200": "#ef9a9a",
"300": "#e57373",
"400": "#ef5350",
"500": "#f44336",
"600": "#e53935",
"700": "#d32f2f",
@pocketkk
pocketkk / keymap.c
Created April 13, 2016 19:20
Chord and Pick Keymap
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@novaluke
novaluke / 0-Q&A.md
Last active January 16, 2025 20:38
I want to use Nix for development, but... -- answers to common concerns about Nix

Nix seems perfect for developers - until I try to use it...

Want to use Nix for development but you're not sure how? Concerned about the fluidity of nixpkgs channels or not being able to easily install arbitrary package versions?

When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.