Skip to content

Instantly share code, notes, and snippets.

View Sigmanificient's full-sized avatar
🎲
Continuing random projets

Yohann Boniface Sigmanificient

🎲
Continuing random projets
View GitHub Profile
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
@Sigmanificient
Sigmanificient / cpu_freqs.py
Created January 25, 2025 10:32
Plot CPU freqs in real time
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [pygame psutil])"
import pygame
import psutil
pygame.init()
width = 1800
height = 1000
./pkgs/os-specific/linux/fwts/default.nix
./pkgs/desktops/plasma-5/discover.nix
./pkgs/desktops/plasma-5/xdg-desktop-portal-kde.nix
./pkgs/desktops/deepin/library/image-editor/default.nix
./pkgs/desktops/deepin/apps/deepin-movie-reborn/default.nix
./pkgs/desktops/deepin/tools/deepin-anything/default.nix
./pkgs/desktops/deepin/core/dde-grand-search/default.nix
./pkgs/desktops/deepin/core/dde-file-manager/default.nix
./pkgs/desktops/lxqt/libfm-qt/default.nix
./pkgs/desktops/lxqt/lxqt-build-tools/default.nix
@Sigmanificient
Sigmanificient / add_missing_hooks.py
Last active August 9, 2024 20:12
Script to insert missing `preInstall` and `postInstall` hook within `installPhase` of nixpkgs derivations
import io
import re
import pathlib
import sys
HOOK_PATTERN = r'(?P<ident>[ ]+)?(?P<decl>installPhase\s+=\s+)"(?P<block>.*)";'
HOOK_PATTERN_MULTILINE = (
r"(?P<decl>installPhase\s+=\s+(?:let(?:(?!\s+in\s+)(?:.|\n))+\s+in\s+)?)"
./doc/languages-frameworks/rust.section.md: maintainers = [];
./doc/languages-frameworks/rust.section.md: maintainers = with lib.maintainers; [];
./nixos/modules/hardware/ckb-next.nix: maintainers = with lib.maintainers; [ ];
./nixos/modules/hardware/raid/hpsa.nix: maintainers = with maintainers; [ ];
./nixos/modules/programs/dmrconfig.nix: meta.maintainers = with lib.maintainers; [ ];
./nixos/modules/programs/qdmr.nix: meta.maintainers = [ ];
./nixos/modules/services/admin/meshcentral.nix: meta.maintainers = [ ];
./nixos/modules/services/audio/jack.nix: meta.maintainers = [ ];
./nixos/modules/services/audio/jmusicbot.nix: meta.maintainers = with maintainers; [ ];
./nixos/modules/services/hardware/openrgb.nix: meta.maintainers = with lib.maintainers; [ ];
@Sigmanificient
Sigmanificient / tek-pool-challenge.c
Last active July 5, 2024 02:37
Code Golf of Epitech lib inspired from QuentindiMeo/tek-pool-challenge (2532 bytes)
#include<ctype.h>
#include<stddef.h>
#include<unistd.h>
#define H(c)"0W"[(c&15)>9]+(c&15)
#define I(n,m)_Bool n(q){N(s,V)U(W=0;*s;s++)W|=!m(*s);R!W;}
#define N(s,r)if(s==V)R r;
#define P my_putchar
#define R return
#define S(f)my_str##f
#define O(f)S(f)(C*a,C*b){R S(n##f)(a,b,S(len)(b)+1);}
#define I(n,m)J(n,m,0)
#define J(n,m,e)for(n=m;--n;o|=e)
#define K(x)int x[9]={0}
o,i,j,x,y;is_sudoku_valid(int s[9][9]){I(i,9)J(j,9,s[i][j]<0||s[i][j]>9);I(y,9){K(c);J(j,9,c[s[y][j]-1]++);K(d);J(i,9,d[s[y][i]-1]++);};I(x,3)I(y,3){K(c);I(i,3)J(j,3,c[s[3*y+i][3*x+j]-1]++);};return !o;}
@Sigmanificient
Sigmanificient / nixpkgs_by_name_progress.sh
Created June 4, 2024 21:50
Get the percentage of pkgs that has been migrated to by-name
export count=$( \
curl -L "https://channels.nixos.org/nixos-unstable/packages.json.br" \
| brotli -d --stdout \
| nix run nixpkgs#jq -- ".packages | length")
find pkgs/by-name -maxdepth 1 -type d \
| xargs -i sh -c "find {} -maxdepth 1 -type d| wc -l" \
| tr '\n' '+' \
| python -c "print(eval(input()[:-1]))" \
| python -c "print(100 * int(input()) / $count, '%')" \
| head -c 7 \
@Sigmanificient
Sigmanificient / top_nixpkgs_nix_files.sh
Created April 30, 2024 06:18
Get the amount of nix lines within the top 10 nixpkgs' nix files
find . -type f -name "*.nix" \
| xargs -i sh -c " \
cat {} \
| wc -l \
| xargs printf '%06d'; printf '\t%s\n' {}" \
| sort \
| tail -n 10 \
| tr '\t' ' ' \
| cut -d ' ' -f 1 \
| paste -s -d+ - \