Skip to content

Instantly share code, notes, and snippets.

nc -k -l 13370 | bash &
@lightdiscord
lightdiscord / default.nix
Last active May 2, 2020 16:43
htop configuration
{ pkgs, ... }:
{
home.file.".config/htop/htoprc".source = ./htoprc;
home.packages = [ pkgs.htop ];
}
@lightdiscord
lightdiscord / config
Last active May 2, 2020 16:43
rofi configuration
rofi.modi: window,drun
rofi.theme: gruvbox-dark-hard
rofi.show-icons: true
@lightdiscord
lightdiscord / config
Last active February 8, 2020 20:39
i3 configuration
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $alt Mod1
set $super Mod4
set $mod Mod4
font pango: Source Code Pro 9
set $refresh_i3status killall -SIGUSR1 i3status
@lightdiscord
lightdiscord / config
Created February 9, 2020 17:24
i3status configuration
general {
output_format = "i3bar"
colors = true
interval = 5
}
order += "wireless _first_"
order += "ethernet _first_"
order += "battery 0"
order += "tztime local"
@lightdiscord
lightdiscord / config
Last active February 9, 2020 17:27
i3status configuration
general {
output_format = "i3bar"
colors = true
interval = 5
}
order += "wireless _first_"
order += "ethernet _first_"
order += "battery 0"
order += "tztime local"
@lightdiscord
lightdiscord / get-log-time.js
Created September 11, 2020 07:47
Get total log time on the intra
(() => {
const total = [...document.querySelectorAll("g[data-toggle='tooltip']")]
.map(({ dataset }) => dataset.originalTitle)
.map((title) => {
const [h, m] = title.split("h");
return (+h * 60 + +m)
})
.reduce((a, b) => a + b);
return (`${Math.floor(total / 60)}h${total % 60}`);
@lightdiscord
lightdiscord / fetcher.js
Last active September 15, 2021 13:12
Intra 42 videos achievements
(() => {
const videos = [...document.querySelectorAll("a.video-item")];
const links = videos.map(anchor => anchor.href);
const seenLinks = links.map(link => `${link}/seen`);
const requests = seenLinks.map(link => fetch(link));
return Promise.all(requests)
.then(() => console.log("You've seen a lot of videos today"));
})()
@lightdiscord
lightdiscord / norminette-aggregate.sh
Last active January 12, 2021 12:27
Aggregate norminette results to have the filename in the same line as the message.
#!/usr/bin/env bash
LAST_FILE=""
norminette "$@" | while read -r line
do
if [[ "$line" =~ "Norme: " ]]
then
LAST_FILE="${line:7}"
else
@lightdiscord
lightdiscord / README.md
Last active June 16, 2021 15:23
Test to check that some function copy past nul byte.

Test-case copy after nul byte.

for gets

$ echo -en 'this is fun!\x00oh no, it copies after nul byte!' | ./a.out | hexdump -C
00000000  74 68 69 73 20 69 73 20  66 75 6e 21 00 6f 68 20  |this is fun!.oh |
00000010  6e 6f 2c 20 69 74 20 63  6f 70 69 65 73 20 61 66  |no, it copies af|
00000020  74 65 72 20 6e 75 6c 20  62 79 74 65 21 00 00 00  |ter nul byte!...|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|