Skip to content

Instantly share code, notes, and snippets.

View themaxhero's full-sized avatar
😀

Marcelo Amancio de Lima Santos themaxhero

😀
View GitHub Profile
@themaxhero
themaxhero / install-erlang-through-asdf.sh
Created February 8, 2022 09:00
Script for Installing the latest version of erlang in Archlinux
#!/bin/bash
sudo pacman -S openssl-1.0
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang
mkdir ~/.openssl-1.0
cd ~/.openssl-1.0
ln -s /usr/include/openssl-1.0 include
ln -s /usr/lib/openssl-1.0 lib
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
@themaxhero
themaxhero / projects.sh
Created January 21, 2022 00:56
Wofi Project Selector
#!/bin/bash
__choice=$(printf '%s\n' Work Personal | wofi -dmenu -p "Select project scope" -L 2)
__work_projects=~/projects/work
__personal_projects=~/projects/personal
show_options() {
case $1 in
'Open with Emacs') emacs $2;;
@themaxhero
themaxhero / double_cola.ex
Last active November 3, 2021 10:42
Resolution for Double Cola Problem in Elixir
defmodule DoubleCola do
defp mapper({current_names, size}),
do: Enum.map(current_names, &(%{name: &1, size: size}))
defp traverse([%{name: name, size: size} | rest], n) when n <= size,
do: name
defp traverse([%{name: name, size: size} | rest], n),
do: traverse(rest, n - size)
def find_nth(names, n) do
type Result<T> = {type: "ok", data: T} | {type: "error", reason: string};
export const ok = <T = unknown>(data: T): Result<T> => {
return {type: "ok", data };
};
export const error = <T = unknown>(reason: string): Result<T> => {
return {type: "error", reason};
};
@themaxhero
themaxhero / rockman_x_legacy_collection_{1,2}.sh
Last active December 21, 2022 04:10
How to make Rockman X Legacy Collection {1,2} work just like in Windows.
#!/bin/sh
# Instructions
# Before running this:
# - Delete your ~/.local/share/Steam/steamapps/compatdata/$GAME_ID folder.
# - Then set your proton version to 5.0-10 for the game.
# - Run the game and close after it starts.
# - After that, you're good to go.
# If the game is Rockman X Legacy Collection 1, the ID should be 743890
# If the game is Rockman X Legacy Collection 2, the ID should be 743900
# Thanks to https://github.com/PedroHLC for Debbuging this thing and finding out how to solve.
@themaxhero
themaxhero / revert_subtraction.rb
Created December 9, 2020 05:39
Revert Subtraction using Percentage by adding percentage
require 'bigdecimal'
@percentages = [
BigDecimal("0.99"),
BigDecimal("0.98"),
BigDecimal("0.97"),
BigDecimal("0.96"),
BigDecimal("0.95"),
BigDecimal("0.94"),
BigDecimal("0.93"),
@themaxhero
themaxhero / config.sh
Last active May 10, 2021 02:01
Archlinux Install Script with Customizations
#!/bin/bash
aur_packages=(
aic94xx-firmware
wd719x-firmware
peazip-qt-bin
nordic-theme-git
nordic-theme-kde-git
)
system_base_packages=(
base-devel
@themaxhero
themaxhero / Html.hs
Last active June 14, 2020 23:41
Implementing elm-like to HTML
module Html (Html, div', text, render) where
type Reducer a b = (b -> a -> b)
type Tag =
String
type Attribute msg =
(String, String)
#!/usr/bin/env sh
set -o errexit
VOLUMES=($(lsblk -npo KNAME | grep -v 'loop\|sr'))
SIZES=($(lsblk -npo KNAME,SIZE | grep -v 'loop\|sr' | awk 'BEGIN {FS=" "}; {print $2}'))
COUNT=$(lsblk -n | grep -v 'loop\|sr' | wc -l)
RADIOLIST=()
for i in $(seq 0 $(expr $COUNT - 1));
do
@themaxhero
themaxhero / simple_math.rs
Created August 31, 2019 15:31
Crazy Stuff
use std::convert::{ Into, From };
enum Integer { I8(i8), I16(i16), I32(i32), U8(u8), U16(u16), U32(u32) }
enum Float { F32(f32), F64(f64) }
enum Number { F(Float), I(Integer) }
impl Into<f32> for Integer {