Skip to content

Instantly share code, notes, and snippets.

View mzpqnxow's full-sized avatar

AG mzpqnxow

View GitHub Profile
@mzpqnxow
mzpqnxow / sources.list
Last active April 30, 2022 13:11
EdgeRouter 1.x firmware APT source configurations (4/2022)
#
# APT Configuration for EdgeRouter/EdgeOS 2.x
#
# Vanilla APT configuration can be problematic since VyattaOS is a fork
# of Debian with enhancements, but is not aggressively kept up to date
# with Debian releases. Not all mirrors have "old" packages and not all
# mirrors have all architectures (e.g. very few have older MIPS architecture
# platforms
#
# - AG
@mzpqnxow
mzpqnxow / idapython_cheatsheet.md
Created April 19, 2022 21:56 — forked from icecr4ck/idapython_cheatsheet.md
Cheatsheet for IDAPython
@mzpqnxow
mzpqnxow / install_quartus17.sh
Created March 27, 2022 22:06 — forked from arthurbeggs/install_quartus17.sh
Install Quartus Prime Lite 17.0 in Ubuntu
#!/bin/bash
################################################################################
### Install Quartus and ModelSim ###
################################################################################
# Source code at https://github.com/arthurbeggs/scripts #
################################################################################
# #
# Based on https://github.com/jessebarreto/ConfigureWorkspace script. #
# #
@mzpqnxow
mzpqnxow / template.manifest
Last active March 14, 2022 17:59
Using rsync --exclude-from / --include-from / --backup-dir to facilitate safely and fully templating "projects"
# For very basic cases, you shouldn't need to worry about such an extensive / granular
# inclusion file, unless you're actually *using* the "template"; if you are, you should
# probably stop doing that :>
- __pycache__
- *.py[cod]
- *$py.class
- *.pyc
- .git
- README.md
# Exclude template script itself...
@mzpqnxow
mzpqnxow / roll.sh
Created January 26, 2022 15:40
Bash function to roll log files (or any other file) with a maximum keep
#!/bin/bash
#
# Function to roll files in the way that logrotate rolls log files
# Keeps up to the specified amount of files
#
#
# (C) 2022, AG
#
set -eu
# Globals, optional
@mzpqnxow
mzpqnxow / README.md
Last active October 18, 2023 04:27
Patch to statically link OpenSSL into Python3.8

Statically Linking OpenSSL Into Python3.8

EDIT/NOTE: Please see the comment below from @oferchen, this is supported properly in the build system now

Get the patch file (python3-static-link-openssl.patch) and put it in your working directory

$ wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz
$ tar -xvf Python-3.8.12.tar.xz && cd Python-3.8.12
$ patch -p1 < ../python3-static-link-openssl.patch
@mzpqnxow
mzpqnxow / update_mozilla_firefox.sh
Created December 5, 2021 18:09
Install/Update Mozilla release of Firefox on Debian and other Linux distributions, can be run from cron
#!/bin/bash
#
# Install/Update Mozilla Firefox conveniently and repeatably, allowing version selection
# The ESR Firefox that ships with Debian 10/11 (and probably Ubuntu, etc) doesn't support
# containers, so I found myself installing the Mozilla distribution of Firefox. That had
# me a little concerned about keeping it up to date, so I run this out of cron. Maybe it's
# useful for someone ...
#
# This is intended for use with XFCE but I think most window managers use the .desktop style
# metadata files for launchers/menus/etc. Check /usr/share/applications/ on your system to
@mzpqnxow
mzpqnxow / pandas_cheat.py
Created November 25, 2021 23:01 — forked from pohzipohzi/pandas_cheat.py
Cheat sheet for the python pandas library
import numpy as np
import pandas as pd
#### creating dataframes, adding and dropping columns
df = pd.DataFrame(np.arange(1,10).reshape(3,3),['A','B','C'],['w','x','y'])
df.columns = ['W','X','Y'] # change column names
df['Z']=df['X']+df['Y'] # new column with values X+Y
df['XX']=df.apply(lambda row: row['X']*2, axis=1) # new column with values twice of column X
df['YY']=1 # new column of ones
@mzpqnxow
mzpqnxow / build-nmap-debian.sh
Created October 2, 2021 16:51
Build nmap on Debian/Ubuntu without zenmap, ncat (+ install dependencies)
#!/bin/bash
#
# How many times I've had to do this... this saves the trouble, especially of one-by-one
# recalling what the dependencies are by reading the output of ./configure ...
#
# - AG
#
set -eu
declare -r BUILD_DIR=~/nmap-build
declare -r NMAP_VERSION="7.92"
@mzpqnxow
mzpqnxow / verifyblobsession.py
Created September 4, 2021 00:26
Provide a PEM blob as the verify / CA value to a requests Session instead of a file
"""An extension of requests.Session that provides an interface for specifying a PEM blob
This was created as a workaround for https://github.com/psf/requests/issues/4032
This is really only useful if you have a sprawling application and/or many sessions
and you don't want to handle the NamedTemporaryFile solution outside of the Session
yourself
It's surprising at first that requests.Session doesn't provide the ability to specify
a StringIO (or other file stream like object) but when you see the OpenSSL interface