Skip to content

Instantly share code, notes, and snippets.

View amirkdv's full-sized avatar

Amir Kadivar amirkdv

View GitHub Profile
#!/bin/bash
#
# Usage:
# $ inspect-tls-cert.sh facebook.com
set -eux
server=${1:-"stripe.com"}
certfile=/tmp/${server}.cert
openssl_client_connect="openssl s_client -connect ${server}:443 -servername ${server}"
@amirkdv
amirkdv / lv_rsync_backup.sh
Last active October 31, 2023 07:58
Backup an LVM logical volume via Rsync
#!/bin/bash
# Backup an entire LVM logical volume via a snapshot LV and rsync
[[ $( whoami ) != 'root' ]] && echo "sudo please" && exit 1
set -o errexit
set -o nounset
# LVM logical volume to backup
lv=book01
@amirkdv
amirkdv / django_behavioral.md
Last active October 5, 2023 09:48
Behavioral Tests for Django Apps with Behave
@amirkdv
amirkdv / php_mdb.rst
Last active August 25, 2023 13:14
How to handle MS Access MDB files in Linux with PHP5 PDO and ODBC

To be able to use PHP5 PDO with MS Access mdb files the following is required (the same applies for the PHP4 style of using odbc_X except for the obviously PDO specific requirements):

PHP ODBC module

In Linux this is achieved by intalling the php5-odbc package:

@amirkdv
amirkdv / oop.md
Last active December 15, 2022 22:56
Object Oriented Programming in Python, A Graded Knowledge Check
@amirkdv
amirkdv / questions_to_ask.md
Last active November 15, 2022 13:46
Questions to Ask Your Technical Interviewers

Questions to Ask Your Technical Interviewers

Questions marked as (HM) are best suited for the hiring manager.

Area: Alignment

  • Why are you working at this company? What motivates you to stay?
  • What’s something that if your team/org achieves this year, the entire company/leadership would notice?
  • If you had a magic wand, what’s one thing you’d change about the company?
  • (HM) If you had filled this role 2 months ago, what would they be doing now?
@amirkdv
amirkdv / 0_notes.md
Created April 18, 2022 12:22
This is a toy example of XML-RPC in Python and Nodejs.

XML-RPC Example

This is a toy example of XML-RPC in Python and Nodejs.

Usage:

$ python server.py

In a separate shell:

@amirkdv
amirkdv / Transparent Proxy to docker containers.md
Last active August 22, 2020 02:14
Transparent Proxy to docker containers

This is an example of using Linux Kernel's Transparent Proxy to route all TCP traffic to docker containers without having to resort to PROXY protocol which is not supported by some applications (e.g. sshd). To get the demo to work you only need vagrant installed:

git clone [this-gist] tproxy-demo
cd tproxy-demo
vagrant up
@amirkdv
amirkdv / .gitignore
Last active May 7, 2020 21:00
Binary Classification, a visual refresher
venv
pos.txt
neg.txt
plot.png
@amirkdv
amirkdv / git_clean_branch.py
Created March 6, 2020 00:09
Clean git branches and stale references
#!/usr/bin/env python
import sys
import argparse
import subprocess
REMOTE = 'origin'
class CmdError(RuntimeError):