Skip to content

Instantly share code, notes, and snippets.

@joaoceron
joaoceron / mu4e.md
Created July 23, 2021 20:28 — forked from A6GibKm/mu4e.md
Read your emails with mu4e

Connecting emacs and Protonmail Bridge

This guide will cover the basics on how to integrate emacs with protonmail-bridge using

Configuring mbsync

@joaoceron
joaoceron / levenshtein
Created July 14, 2020 08:25
levenshtein
def levenshtein(seq1, seq2):
size_x = len(seq1) + 1
size_y = len(seq2) + 1
matrix = np.zeros ((size_x, size_y))
for x in range(size_x):
matrix [x, 0] = x
for y in range(size_y):
matrix [0, y] = y
for x in range(1, size_x):
# https://github.com/hadiasghari/pyasn
# pyasn_util_download.py --latest
# pyasn_util_convert.py --single <Downloaded RIB File> <ipasn_db_file_name>
# load database
asndb = pyasn.pyasn('ipasn.dat')
# convert one ip to asn
def pyasn(ip,asndb):
asn, prefix = asndb.lookup(ip)
#!/usr/bin/env python3.6
'''
Pihole is great, but the admin interface only displays device details
by IP address which can be confusing. This script changes the display
from IP address to a more recognizable hostname. And as a bonus, attaches
the profile (from fingerbank.org) of the device to the hostname as well -
so instead of something like 192.168.1.101, you see galaxys6-samsung.
Shweet.
Usage notes
tshark -r input_file.pcap -2R "< Wireshark Filter >" -T fields -e < Wireshark Field > -e <Wireshark Field>
## By using combination of "-T fields" and "-e" options, tshark will only print the fields you're interested in.
ip.src
ip.dst
tcp.srcport (udp.srcport)
tcp.dstport (udp.dstport)
## I want to check the number of TCP streams in the packet.
@joaoceron
joaoceron / yaf-notes.MD
Last active March 18, 2020 15:54 — forked from adulau/yaf-notes.MD
yaf notes
@joaoceron
joaoceron / gist:43d150b9cac415eae2bfc963760511ea
Created September 16, 2019 08:51
pandas IPv4 address anon
df_flows.dst_ip.replace({r'(\d+)\.(\d+)\.(\d+)\.(\d+)': r'\1.X.X.\4'}, regex=True)
!apt install proj-bin libproj-dev libgeos-dev
!pip install --upgrade plotly
!pip install --upgrade geopandas
!pip install --upgrade pyshp
!pip install --upgrade shapely
!pip install --upgrade geoplot
!pip3 install maxminddb-geolite2 --user
@joaoceron
joaoceron / mongodb.txt
Last active June 8, 2019 10:44
mongodb notes
# create database
mongo admin --host localhost -u admin -p admin --eval "db.getSiblingDB('mydb');"
use mydb
db.createUser( { user: "user1", pwd: "pass", roles: [ "readWrite", "dbAdmin" ], passwordDigestor:"server" } )
db.createCollection("log", { capped : true, size : 5242880, max : 5000 } )