Skip to content

Instantly share code, notes, and snippets.

@lukepearson
lukepearson / save_images.py
Created April 10, 2024 08:19
Mitmproxy image download script
from mitmproxy import http
import os
import hashlib
def response(flow: http.HTTPFlow) -> None:
save_dir = "downloaded_images"
os.makedirs(save_dir, exist_ok=True)
content_type = flow.response.headers.get("Content-Type", "")
@lukepearson
lukepearson / licences.js
Created December 22, 2022 11:39
Generate a csv containing a list of all of the licences used in nodejs projects in a subdirectories
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const startingDir = __dirname
const walkSync = (dir) => {
fs.readdirSync(dir).forEach(file => {
if (fs.statSync(path.join(dir, file)).isDirectory()) {
if (file === 'node_modules') return
@lukepearson
lukepearson / clone.js
Last active August 10, 2022 13:31
Clone all git repositories within an Azure DevOps Organisation
const { execSync } = require('child_process');
const { existsSync } = require('fs');
const { escape } = require('querystring');
const accessToken="PERSONAL_ACCESS_TOKEN";
const organisation="ORG_NAME";
const headers = {
Authorization: `Basic ${btoa(`:${accessToken}`)}`,
'Content-Type': 'application/json',
};
@lukepearson
lukepearson / windows_10_bootable_iso.sh
Last active March 15, 2022 15:57
Create a bootable Windows 10 USB on MacOS
# Download the Windows 10 ISO
wget -O ~/Downloads/Windows10.iso https://software-download.microsoft.com/db/Win10_20H2_English_x64.iso?t=5f918d78-0088-47d5-adf9-8ccab64f2d3d&e=1604157841&h=675f0ae3a5a95da69c777d0d7031b8ec
# Mount the downloaded Windows 10 ISO
hdiutil mount ~/Downloads/Windows10.iso
# /dev/disk2 /Volumes/CCCOMA_X64FRE_EN-US_DV9
# Insert the USB stick (Minimum 8GB)
# Find the USB volume
@lukepearson
lukepearson / nuke_docker.sh
Last active July 17, 2018 14:06
Nuke docker. Destroy all image, volumes
#!/bin/bash
docker stop `docker ps -q`
docker rm `docker ps -aq`
docker rmi `docker images -q` -f
docker rmi `docker images -q` -f # because it doesnt always work the first time
y | docker system prune
y | docker image prune
y | docker volume prune