Skip to content

Instantly share code, notes, and snippets.

View AndersonTorres's full-sized avatar

Anderson Torres AndersonTorres

  • São Paulo, Brazil
View GitHub Profile
@AndersonTorres
AndersonTorres / rar2zip.fish
Last active July 10, 2020 17:27
Fish script to convert RAR to ZIP
#!/bin/fish
# rar2zip.fish
function usage
printf "
Usage: rar2zip.fish [Only one RAR file]
Transforms a single RAR file, passed under cmdline, to an equivalent ZIP file,
storing it in the current directory"
@AndersonTorres
AndersonTorres / nix-development-template-file.org
Last active July 26, 2024 00:09
A project workflow for Nixpkgs/NixOS

Standard project structure

This is a project structure I’ve found useful. Looking for any thoughts/comments/feedback. Roughly, I found a tension between the style nixpkgs expects and the style conducive to development, so I extracted the common portion into a derivation.nix which is used by the remaining .nix files. This setup allows me to use nix build, nix-shell, overlays, Hydra, alternate packaging schemes, cross-compiling, etc.

@AndersonTorres
AndersonTorres / pdf2zip.fish
Last active July 10, 2020 17:22
Fish script to convert PDF to ZIP
#!/bin/fish
# pdf2zip.fish
function usage
printf "
Usage: pdf2zip.fish [Only one PDF file]
Transforms a single PDF file, passed under cmdline, to an equivalent ZIP file,
storing it in the current directory"
@AndersonTorres
AndersonTorres / zig-em-30-minutos.org
Last active July 10, 2024 04:28
Zig em 30 Minutos (Tradução)
fn is_prime(comptime T: type,
n: T) bool {
var d: T = 2;
var exausted: bool = false;
var found: bool = false;
if (n < 0) return is_prime(-n);
if (n == 0 or n == 1) return false;
@AndersonTorres
AndersonTorres / debtags2nixtags.awk
Last active November 24, 2023 13:59
A quick and not too clean script to convert Debtags to Nix categories
BEGIN {
printf ("%s\n", "# DO NOT EDIT!");
printf ("%s", "categories = {");
}
/Facet:/ {
if (sub(/Facet: /,"")){
tmp_facet_name = $0
}
getline
@AndersonTorres
AndersonTorres / unit.sh
Created October 27, 2024 12:27 — forked from ptc-mrucci/unit.sh
Bash test: get the directory of a script
#!/bin/bash
tmp=$(python -c "import os, sys; print(os.path.realpath('/tmp'))")
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then