Skip to content

Instantly share code, notes, and snippets.

View marchrius's full-sized avatar
:octocat:

Matteo Gaggiano marchrius

:octocat:
View GitHub Profile
@marchrius
marchrius / base64.zsh
Last active November 7, 2025 10:11
Base64 fast encode / decode util
## Base64 fast encode / decode util
function __base64_decode() {
if [ "$#" > 1 ];then
for arg in "$@";do
echo "'$arg'"" => '"`echo "$arg" | base64 -D`"'"
done
else
echo "$1" | base64 -D
fi
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
const fs = require('fs');
/**
* This script transfers bash history to zsh history
* Change bash and zsh history files, if you don't use defaults
*
* Usage: node bash_to_zsh_history.js
*
* Author: Matteo Gaggiano
*/
import * as ion from 'ionicons/icons';
import {NbIcons} from "@nebular/theme/components/icon/icon-pack";
function map(icon: string) {
return icon.replace('data:image/svg+xml;utf8,', '');
}
export const NbIonIcons: NbIcons = {
'add': map(ion.add),
'add-circle': map(ion.addCircle),
@marchrius
marchrius / Example.java
Last active July 28, 2020 09:55
Maps builder utility
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.marchirus.utils.Maps;
public class Example { public static void main(String[] args) {
Maps.Builder<String, String> builder = Maps.builder();
builder.pair("Key1", "Value1")
.key("Key2").value("Value2")
@marchrius
marchrius / keybase.md
Created December 9, 2020 09:03
Keybase proof

Keybase proof

I hereby claim:

  • I am marchrius on github.
  • I am marchrius (https://keybase.io/marchrius) on keybase.
  • I have a public key whose fingerprint is 4D58 6729 4E67 8AC7 B0C5 CA9C BC90 5688 7987 1E01

To claim this, I am signing this object:

#!/usr/bin/env bash
DATABASE_URL="postgres://MyPostgresUser:MyPostgresPassword@192.168.0.1:5432/MyPostgresDB"
# `cut` is used to cut out the separators (:, @, /) that come matched with the groups.
DATABASE_USER=$(echo $DATABASE_URL | grep -oP "postgres://\K(.+?):" | cut -d: -f1)
DATABASE_PASSWORD=$(echo $DATABASE_URL | grep -oP "postgres://.*:\K(.+?)@" | cut -d@ -f1)
DATABASE_HOST=$(echo $DATABASE_URL | grep -oP "postgres://.*@\K(.+?):" | cut -d: -f1)
DATABASE_PORT=$(echo $DATABASE_URL | grep -oP "postgres://.*@.*:\K(\d+)/" | cut -d/ -f1)
@marchrius
marchrius / default_terminal.zsh
Created November 7, 2025 10:10
Custom Alias for ZSH to change defaul terminal in GIO / XDG
# Custom Alias for ZSH to change defaul terminal in GIO / XDG
function __default_terminal() {
## Default values
TERMINAL_ARGS=new-window
TERMINAL=com.gexperts.Tilix
system=false
check_only=False