Skip to content

Instantly share code, notes, and snippets.

@Serpens
Serpens / pdf2csv.py
Created October 20, 2019 20:38
Get table from a PDF and save it as CSV
#!/usr/bin/env python3
import os
import sys
import re
import pandas as pd
from tabula import read_pdf
if __name__ == '__main__':
pdf_name = sys.argv[1]
if len(sys.argv) > 2:
@Serpens
Serpens / install_raspbernetes_master.sh
Created May 1, 2019 08:42
Kubernetes master node installation on Raspberry Pi 3
apt purge docker-ce
apt install docker-ce='18.06.3~ce~3-0~raspbian'
apt-mark hold docker-ce
apt install kubeadm kubelet kubectl
kubeadm init phase certs all
kubeadm init phase kubeconfig all
kubeadm init phase control-plane all --pod-network-cidr 10.244.0.0/16
sed -i 's/initialDelaySeconds: [0-9][0-9]/initialDelaySeconds: 240/g' /etc/kubernetes/manifests/kube-apiserver.yaml
sed -i 's/failureThreshold: [0-9]/failureThreshold: 40/g' /etc/kubernetes/manifests/kube-apiserver.yaml
sed -i 's/timeoutSeconds: [0-9][0-9]/timeoutSeconds: 2000/g' /etc/kubernetes/manifests/kube-apiserver.yaml
#!/usr/bin/env python3
import sys
import requests
from hashlib import sha1
checked_hash = sha1(sys.argv[1].encode()).hexdigest().upper()
prefix, suffix = checked_hash[:5], checked_hash[5:]
r = requests.get('https://api.pwnedpasswords.com/range/' + prefix)
if r.text.find(suffix) == -1:
@Serpens
Serpens / check_password_pwned.sh
Created May 29, 2018 15:09
Check if a password, given as command line argument, is pwned
#!/bin/bash
PASSWORD=$1
HASH=$(echo -n $1 | sha1sum | cut -f1 -d' ' | tr '[:lower:]' '[:upper:]')
HASH_START=$(echo $HASH | cut -c1-5)
HASH_END=$(echo $HASH | cut -c6-40)
curl -s https://api.pwnedpasswords.com/range/$HASH_START | grep $HASH_END &>/dev/null && echo 'weak password' || echo 'strong password'
@Serpens
Serpens / gist:04b2653d7da9796584f5cd59668ca2a5
Created March 15, 2018 13:19
BLAST+ with Boost 1.66 error
/software/easybuild/software/OpenMPI/2.1.2-GCC-6.4.0-2.28/bin/mpicxx -std=gnu++11 -c -Wall -Wno-format-y2k -m64 -pthread -fopenmp -O2 -march=native -fPIC -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I/software/easybuild/software/OpenBLAS/0.2.20-GCC-6.4.0-2.28/include -I/software/easybuild/software/ScaLAPACK/2.0.2-gompi-2018a-OpenBLAS-0.2.20/include -I/software/easybuild/software/FFTW/3.3.7-gompi-2018a/include -I/software/easybuild/software/zlib/1.2.11-GCCcore-6.4.0/include -I/software/easybuild/software/bzip2/1.0.6-GCCcore-6.4.0/include -I/software/easybuild/software/PCRE/8.41-GCCcore-6.4.0/include -I/software/easybuild/software/Python/2.7.14-foss-2018a/include -I/software/easybuild/software/Boost/1.66.0-foss-2018a-Python-2.7.14/include -I/software/easybuild/software/GMP/6.1.2-GCCcore-6.4.0/include -I/software/easybuild/software/libpng/1.6.34-GCCcore-6.4.0/include -I/software/easybuild/software/libjpeg-turbo/1.5.3-GCCcore-6.4.0/include -I/software/easybuild/software/LMDB/0.9
@Serpens
Serpens / keybase.md
Created March 7, 2018 21:54
Keybase proof

Keybase proof

I hereby claim:

  • I am Serpens on github.
  • I am serpens (https://keybase.io/serpens) on keybase.
  • I have a public key whose fingerprint is 2496 D0B5 A2F8 4EC8 978B 600B 866E 542C F742 41B1

To claim this, I am signing this object:

[Desktop Entry]
Type=Application
Icon=path.png
Name=
Comment=
Categories=Utility;Development;Internet;Game
Exec=command %U
StartupNotify=true
Terminal=false
#!/usr/bin/env python
import os, sys
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
if __name__ == '__main__':
with open(sys.argv[1]) as f:
xml_txt = f.read()
@Serpens
Serpens / pretty_git_log.sh
Created April 13, 2016 14:10
Pretty Git log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit
# make an alias
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit"
git lg
git lg -p
@Serpens
Serpens / uptime_robot.py
Last active December 8, 2015 15:29
Get server status from Uptime Robot
#!/usr/bin/env python
import urllib2
import json
API_KEY = '' # for a single monitor
API_QUERY = 'https://api.uptimerobot.com/getMonitors?apiKey={}&format=json&noJsonCallback=1'
def get_response():