Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@faustinoaq
faustinoaq / .bashrc
Last active July 13, 2024 05:59
Bash Source with python pip logic to add or remove packages from requirements.txt on install or remove
alias pi='pip install'
alias pu='pip uninstall -y'
# pip add
pa() {
pi $1 && pip freeze | grep -i $1 | tee -a requirements.txt
}
# pip remove
pr() {
@faustinoaq
faustinoaq / help.md
Last active July 8, 2024 02:26
Recover ZFS boot disk in Ubuntu 22.04.4

Recovery

TL;DR: for some weird reason zfs was not being loaded in grub, maybe related to this bug?

ATTENTION: I copy pasted some things from my memory so, some things may be mistyped or wrong, proceed with caution or leave a comment ⚠️

insmod zfs
zfs-bootfs (hd1,gpt3) # or whatever is your structure
@faustinoaq
faustinoaq / Makefile
Last active April 10, 2019 20:58
Makefile for arduino.cr
# Compiled using LLVM 6 with AVR target support
# Digispark Attiny85 version
CC=avr-gcc
AR=avr-ar
OBJCOPY=avr-objcopy
STRIP=avr-strip
SIZE=/home/main/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-size
CRYSTAL=/run/media/main/5E7F72DC50CCBB04/crystal-master-4f5c55d-0.27.1-dev/bin/crystal
AVR-INCLUDE=$(HOME)/.arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/avr/include/
@faustinoaq
faustinoaq / aes.cr
Last active May 23, 2021 13:50
AES Cipher example in Crystal
require "openssl/cipher"
module AES
def self.encrypt(data, password)
cipher = OpenSSL::Cipher.new("aes-128-cbc")
cipher.encrypt
cipher.key = password
io = IO::Memory.new
io.write(cipher.update(data))
io.write(cipher.final)
@faustinoaq
faustinoaq / empresas-panama.csv
Last active April 16, 2024 15:45
Lista de empresas de tecnología y desarrollo en Panamá
Sitio Web Nombre de la Empresa
http://www.admios.com Admios
https://allsafe.com.pa All Safe Solutions S.A.
http://www.allsecurity.org/wp AllSecurity – Revista Allsecurity Especializada en Tecnologías & Seguridad de la información Noticias comunidad Hardware Software ethical Hacking cybersecurity.
http://www.americavirtual.net America Virtual – Diseño Web Panama – Marketing Digital
https://arpiasoftware.com arpiasoftware.com
http://www.livewalkpty.com Audio walks that Awaken Panama's HIstory - Panama Self-Guided Audio Walking Tours
http://best.com.pa Best Software Inc. – Sage 50 (antes Peachtree) ACT! OIS en Panamá
http://www.bitban.com Bitban | Simplificando la web
http://bluetideconsulting.com BlueTide IT Consulting
@faustinoaq
faustinoaq / dependencies.cr
Last active December 6, 2017 03:11
Extract binary dependencies (dynamic libraries) for crystal compiled program
executable = "bin/critter"
deps = [] of String
output = `ldd #{executable}`.scan(/(\/.*)\s\(/) do |m|
library = m[1]
deps << library
real_lib = File.real_path(library)
deps << real_lib if real_lib != library
end
@faustinoaq
faustinoaq / routes.cr
Last active December 2, 2017 06:11
Build routes for Amber automatically
def build_url
case verb
when "get"
case action_name
when :index then "/"
when :show then "/:#{param}"
when :new then "/new"
when :edit then "/:#{param}/edit"
end
when "post"
@faustinoaq
faustinoaq / proc.cr
Last active December 6, 2017 03:14
Using Kemal via def to proc
require "kemal"
def index(env)
"Hello World!"
end
get "/", &->index(HTTP::Server::Context)
Kemal.run
@faustinoaq
faustinoaq / untyped.cr
Created September 26, 2017 23:09
Compiled time array
A = [] of Nil
{% A << 0 %}
{% A << "Some String" %}
{% p A[0] %} # => 0
{% p A[1] %} # => "Some String"