Skip to content

Instantly share code, notes, and snippets.

View gil-obradors's full-sized avatar

Gil Obradors gil-obradors

View GitHub Profile
@gil-obradors
gil-obradors / disaster_recovery.txt
Created May 11, 2021 10:46
Disaster recovery from my pc
# Unhash ~/.ssh/known_hosts
HashKnownHosts
if $(grep -q "HashKnownHosts" /etc/ssh/ssh_config 2>&1 > /dev/null ) ; then
##########################3333
SD Card RPI microSDHC EVO PLUS 32GB Class 10
gil@gil-NUC10i7FNH:/media/gil/9016-4EF8$ fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_read_write.fio --bs=4k --iodepth=64 --size=1G --readwrite=randrw --rwmixread=75
test: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.16
Starting 1 process
test: Laying out IO file (1 file / 1024MiB)
Jobs: 1 (f=1): [m(1)][100.0%][r=4688KiB/s,w=1445KiB/s][r=1172,w=361 IOPS][eta 00m:00s]
test: (groupid=0, jobs=1): err= 0: pid=562556: Thu Jul 2 20:35:30 2020
@gil-obradors
gil-obradors / gist:91c93e6e00f24b4d603b97f8570c19f3
Created September 29, 2019 18:11
Automated PPTP-CLient Devian creater
#!/bin/bash
# Inspired from https://www.prado.lt/how-to-set-up-pptp-client-on-debian-9
#apt-get install pptp-linux
if dpkg -l | grep pptp-linux ; then echo "No instalarem paquet" ; else apt-get install pptp-linux ; fi
echo "Ip del servidor de tunel?"
read server
@gil-obradors
gil-obradors / tmux.md
Created July 4, 2019 06:05 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@gil-obradors
gil-obradors / editExistingPdf.py
Created April 17, 2019 18:59 — forked from kzim44/editExistingPdf.py
Edit an existing PDF using Python
from pyPdf import PdfFileWriter, PdfFileReader
import StringIO
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
packet = StringIO.StringIO()
# create a new PDF with Reportlab
can = canvas.Canvas(packet, pagesize=letter)
can.drawString(100,100, "Hello world")
can.save()
@gil-obradors
gil-obradors / check-auth.py
Created April 17, 2019 18:59 — forked from 62mkv/check-auth.py
Python script to calculate SIP REGISTER Digest authentication (in order to check password validity)
from md5 import md5
# header from 401 response on REGISTER
# Authorization: Digest username="883140776410950", realm="gw_youmagic", algorithm=MD5, uri="sip:GW_Youmagic", nonce="1476157437:0a1418a40f8ee1c9a55f1587ab931c14", response="3ff479ccc24874f66aae45dac889d099"
login = '883140776410950'
uri = 'sip:GW_Youmagic'
nonce = '1476157437:0a1418a40f8ee1c9a55f1587ab931c14'
realm = 'gw_youmagic'
password = '----------'
@gil-obradors
gil-obradors / csv.py
Created January 8, 2019 17:25
Play python3 csv ipaddress
#!/usr/bin/python3
import csv,ipaddress
with open('IPv4Address.csv', newline='') as csvfile:
data = list(csv.reader(csvfile))
print(data[1][0])
print(type(data))
print(str(ipaddress.IPv4Address(3232235521)))
@gil-obradors
gil-obradors / mikrotik.yml
Created December 23, 2018 19:29
Mikrotik Playbook
---
- name: prova routers_commands
hosts: mikrotik
connection: network_cli
remote_user: guifibages
gather_facts: false
tasks:
- name: run command on remote devices
routeros_command:
commands: /system routerboard print
### Protocl CDP i LLDP
tcpdump '(ether[12:2]=0x88cc or ether[20:2]=0x2000)'
@gil-obradors
gil-obradors / ubnt-discovery
Created December 3, 2018 11:11
ubnt-discovery link
sudo apt install openjdk-8-jdk openjdk-11-jdk snap
wget https://www.ubnt.com/downloads/tools/beta/discovery-tool/ubnt-discovery.zip
mkdir -p /opt/ubnt-discovery
sudo unzip ubnt-discovery.zip -d /opt/ubnt-discovery/
touch /usr/bin/ubnt-discovery
echo -e "#!/bin/bash \n /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /opt/ubnt-discovery/ubnt-discovery-v2.5.1.jar " > /usr/bin/ubnt-discovery