Skip to content

Instantly share code, notes, and snippets.

View mtrimarchi's full-sized avatar
🍕
Pizza Driven Code

Manuele Trimarchi mtrimarchi

🍕
Pizza Driven Code
View GitHub Profile
Verifying that +mtrimarchi is my blockchain ID. https://onename.com/mtrimarchi

Keybase proof

I hereby claim:

  • I am mtrimarchi on github.
  • I am mtrimarchi (https://keybase.io/mtrimarchi) on keybase.
  • I have a public key ASC0bKswvvtpyABcGRV7cI8869hG5R1yn4bVfq1Y1OPMwAo

To claim this, I am signing this object:

@mtrimarchi
mtrimarchi / PinDecrypt.php
Created February 23, 2017 14:39
PinDecrypt - Convert encrypted data with DES_ECB using a key
<?php
/**
*
* PinDecrypt - Convert encrypted data with DES_ECB using a key
*
* @param String $Key - The key with which the data was encrypted.
* If the provided key size is not supported by the cipher,
* the function will emit a warning and return FALSE
* @param String $Data - The data that will be decrypted with the given cipher and mode.
@mtrimarchi
mtrimarchi / mips_toolchain.sh
Created March 4, 2017 17:27 — forked from Lochnair/mips_toolchain.sh
Debian wheezy mips(el) toolchain
#!/bin/sh
# Debian 7 MIPS Toolchain
ARCH=${ARCH:-mips}
# Update
mkdir /usr/src/$ARCH-toolchain && cd /usr/src/$ARCH-toolchain
apt-get update
apt-get upgrade
@mtrimarchi
mtrimarchi / README.md
Created April 24, 2017 17:18
Start keepalived over VLAN at boot

Enable systemd-networkd-wait-online systemctl enable systemd-networkd-wait-online.service

And modify /usr/lib/systemd/system/keepalived.service

@mtrimarchi
mtrimarchi / README.md
Created April 26, 2017 09:56
sed replace foo with bar on all .conf files

find . -type f -name "*.conf" -print0 | xargs -0 sed -i "s/foo/bar/g"

@mtrimarchi
mtrimarchi / alertPapertrail.php
Created November 14, 2017 11:36
Wrapper from Papertrail to Telegram using webhooks
<?php
/**
* alertPapertrail.php
*/
// Require https://github.com/Eleirbag89/TelegramBotPHP
include 'Telegram.php';
// Set the bot TOKEN
@mtrimarchi
mtrimarchi / tgbot_msg_with_emoji.ps1
Created October 3, 2018 16:19
Telegram Bot send message with Emoji
function U
{
param
(
[int] $Code
)
if ((0 -le $Code) -and ($Code -le 0xFFFF))
{
return [char] $Code
@mtrimarchi
mtrimarchi / jq_examples.md
Created April 20, 2020 13:05 — forked from johntoups/jq_examples.md
aws-cli + jq
@mtrimarchi
mtrimarchi / .zshrc
Created May 30, 2020 14:00
MikroTik add AS prefixes in routing table with a specific gateway
# request all prefixes for a specific AS
# ARGS: AS
# example: $ prefixes AS123
function prefixes() {
curl -sS https://stat.ripe.net/data/announced-prefixes/data.json\?resource\=$1 | TODAY_DATE=$(date -u +"%Y-%m-%d") jq --raw-output --arg v "$TODAY_DATE" '.data | .prefixes[] | select(.timelines[].endtime | startswith($v)) | select(.prefix|test(":")|not) | .prefix'
}
# aggregate prefixes for a specific AS
# dependency: from https://github.com/lamehost/aggregate-prefixes/