Skip to content

Instantly share code, notes, and snippets.

View alem0lars's full-sized avatar
💭
corrupting memory

Alessandro Molari alem0lars

💭
corrupting memory
View GitHub Profile

Keybase proof

I hereby claim:

  • I am alem0lars on github.
  • I am alem0lars (https://keybase.io/alem0lars) on keybase.
  • I have a public key whose fingerprint is 1BD5 6E0B C2F0 6CFE DD2C 2A3C F828 B1A4 F1E0 99AB

To claim this, I am signing this object:

def _compare_equality(x, y):
if is_number:
return x == y
else:
regex = re.compile(y.replace("*", ".*"), re.IGNORECASE)
return regex.search(x)
def compare_equality(data, query, col, is_number):
return filter_data(_compare_equality, data, query, col, is_number)
@alem0lars
alem0lars / gist:9c6e8075df458eaf3db5d79245b54252
Created January 21, 2018 12:32
blockstack-id-verification
Verifying my Blockstack ID is secured with the address 1HxTppzFioUCsJecEaHS9VnCyKNxpT6uRD https://explorer.blockstack.org/address/1HxTppzFioUCsJecEaHS9VnCyKNxpT6uRD
@alem0lars
alem0lars / trsync.rb
Created December 26, 2017 20:54
Trello two-way sync (WIP)
#!/usr/bin/env ruby
require "net/http"
require "json"
require "pathname"
require "date"
module TRSync
module Model
@alem0lars
alem0lars / zone-diet.rb
Created December 19, 2017 10:14
Utilities for zone diet
def gr2blk(p, g, c) "P=#{(p / 7.0).round(2)}\u00b5B | G=#{(g / 3.0).round(2)}\u00b5B | C=#{(c / 9.0).round(2)}\u00b5B"; end
@alem0lars
alem0lars / pcap-remove-payload.py
Created July 26, 2017 15:16
Remove payload from a pcap (useful to fully anonymize a pcap)
#! /usr/bin/env python2
from scapy.all import *
import sys
INFILE = sys.argv[1]
OUTFILE = sys.argv[2]
with PcapWriter(OUTFILE) as dest:
with PcapReader(INFILE) as infile:
@alem0lars
alem0lars / backup-solutions-comparison.md
Last active July 26, 2017 15:17
Backup solutions compared

Important notes

The underlying document tries to group comparisons/opinions for the available backup solutions.

The generic guidelines being used are:

  • Easy-to-use: life is too short to lose time with Amanda-like brain-dead solutions.
  • Open format: solutions tend to become obsolete, we don't want to throw backups away just for changing the backup software.
  • No SSH communication, for security reasons. In addition, SSH protocol isn't natural and shaped for file transfers; FTP (FILE TRANSFER protocol) is instead the right protocol. Yes, people tend to be dumb using wrong protocols for wrong reasons (this-over-this-over-this sucks!, in fact it comes from the shitty web world).
  • Data encryption (real backups almost always contain sensitive data).
  • Incremental and space-saving backups.
#!/bin/sh
mkdir -p /mnt/gentoo
cryptsetup luksOpen /dev/sda2 primary
cryptsetup luksOpen /dev/sdb1 secondary
swapon /dev/primary/swap
mount /dev/primary/root /mnt/gentoo
pres="${1:-mypresentation}" # Replace with the presentation name
remote="${2:-git@github.com:$(whoami)/${pres}}" # Replace with the presentation repo url
git clone "git@github.com:alem0lars/presentation-skeleton.git" "${pres}"
cd "${pres}"
./scripts/init "${remote}"
@alem0lars
alem0lars / migrate.zsh
Last active August 29, 2015 14:12 — forked from LMolr/migrate
Perform filesystem migration to a destination server (via rsync)
#!/usr/bin/env zsh
# parse arguments {{{
zparseopts -A _opts -user: -dstsrv: -dstpath:
if [[ $? -ne 0 ]]; then
echo 'invalid arguments'
exit -1