Skip to content

Instantly share code, notes, and snippets.

View carlosm3011's full-sized avatar
💭
Mining Internet and RPKI routing data

Carlos Martinez-Cagnazzo carlosm3011

💭
Mining Internet and RPKI routing data
View GitHub Profile
@carlosm3011
carlosm3011 / db.training.lacnic.net
Created April 19, 2012 09:31
IPv6 HandsOn LACNIC - Zone File para DNS
$ORIGIN training.lacnic.net.
$TTL 15 ; 1 minute
@ IN SOA training.lacnic.net. root.localhost. (
2011092606 ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604800 ; minimum (1 week)
)
@carlosm3011
carlosm3011 / mongodb_date_to_timestamp.py
Created July 1, 2015 18:10
Convert MongoDB Date() to Unix TS in Python
import datetime
import time
a="Date(2015,6,0,23,58,0)"
b=a[5:-1]
c=[int(x) for x in b.split(",")]
d=datetime.datetime(c[0],c[1]+1,c[2]+1,c[3],c[4],c[5])
timestamp = time.mktime(d.timetuple())
print d
print timestamp
@carlosm3011
carlosm3011 / run.sh
Created November 19, 2015 21:07
run.sh for setting env variables for python apps
#!/bin/bash
####################################################################
# Python wrapper - sets env variables appropiately
# v2 - 20151109
####################################################################
# change this PYTHON variable if using an alternative python
# interpreter
PYTHON="/usr/bin/python"
export SRCHOME=$(pwd)

Keybase proof

I hereby claim:

  • I am carlosm3011 on github.
  • I am carlosm3011 (https://keybase.io/carlosm3011) on keybase.
  • I have a public key whose fingerprint is AF6B 67E1 B238 3FB0 568D 1913 A43E 4A71 41AE B744

To claim this, I am signing this object:

@carlosm3011
carlosm3011 / keen_write.py
Created March 18, 2016 15:45
keen_write.py: Simple script to upload events to keen.io
import string
keen.project_id = "56eae5a3d2eaaa4d7181e9de"
keen.write_key = "3ce6df1a63b8aa1fbb9c7a929f192e93e8ea5d4fad19fa75c026b4d32b5ff22a53fb6bd3f9fa5ccb81abfae65edb6735fa1f6615a5863666c7ae14aa75a9740d3d8ab7a183a720d720d6fb0121b67ffea11974107a018dd02c03b1c19d5bf6ab"
keen.read_key = "05fdaa87631ae5b783cd24c516e9acfcecdc50e1f20a7c77928a378962dc05d1c9ac90a6f9394dc93298b14128fe7429b32cb7faa9b625ba6e617ca1f4ddf2bf9bda86ea4ce5e78d6fae3870a1b1fdc6821cea2f9cce4594bd5a816279100527"
keen.master_key = "F361F6CC3751F727226F0E371CA39A0376AAA6B212DF709E501F0FA8A91041BE"
# get parameters, use field_name field_value ...
evp = []
#!/opt/local/bin/python2.7
######
# gen letters
######
import smtplib
from email.mime.text import MIMEText
import sys
import string
import csv
@carlosm3011
carlosm3011 / hedns_updater.sh
Created July 11, 2016 04:58
Updating hostnames on Hurricane Electric's free DNS service
#!/bin/bash
#
# Usage: hedns_updater.sh 4|6 hos.na.me passwd
af=$1
hname=$2
ukey=$3
# get my ip address
ipaddr=$(curl -ks -$af https://wtfismyip.com/text)
@carlosm3011
carlosm3011 / key2keytag.py
Last active November 16, 2016 01:34
Get a DNSKEY key tag from base64 raw public key rdata (DNSKEY record)
def key2keytag(flags, alg1, alg2, keydata):
# first parameter of struct.pack is a fortmat string
data = struct.pack('!HBB', flags, alg1, alg2)
data += base64.b64decode(keydata)
# data += keydata
v = 0
for i in range(len(data)):
if i & 1:
v += ord(data[i])
else:
@carlosm3011
carlosm3011 / ssh_config_osx_sierra
Last active June 20, 2018 19:59
ssh config tweaks for macOS Sierra
# macOS Sierra ssh config tweaks
# This file (or something similar) should go in $HOME/.ssh/config
# Permissions should be set to 0600
#
# Comments:
# UseKeychain: allow ssh-agent to read keys from macOS's keychain (avoiding the need to re-input passphrases all the time)
#
#
# PubKeyAccecptedKeyTypes: accept old pubkey types (needed for accesing older ssh implementations)
# KexAlgorithms: accept old style key exchanges
@carlosm3011
carlosm3011 / named.log.config
Created June 16, 2017 13:34
bind9 logging config
logging{
channel simple_log {
file "/var/log/named/bind.log" versions 3 size 5m;
severity warning;
print-time yes;
print-severity yes;
print-category yes;
};
channel queries_log {