Skip to content

Instantly share code, notes, and snippets.

@apfelchips
apfelchips / cdm_fio.sh
Last active February 5, 2024 23:48 — forked from snizovtsev/cdm_fio.sh
Reproducing CrystalDiskMark tests with fio - fixes for https://unix.stackexchange.com/revisions/480191/9
View cdm_fio.sh
#!/usr/bin/env bash
## This script is based on https://unix.stackexchange.com/revisions/480191/9 and https://gist.github.com/snizovtsev/1e57da4bf1cdae16599d59619600ee07
LOOPS=1 #How many times to run each test
SIZE=32 #Size of each test, multiples of 32 recommended for Q32 tests to give the most accurate results.
WRITEZERO=0 #Set whether to write zeroes or randoms to testfile (random is the default for both fio and crystaldiskmark); dd benchmarks typically only write zeroes which is why there can be a speed difference.
QSIZE=$(($SIZE / 32)) #Size of Q32Seq tests
SIZE+=m
View simple-https-server.py
#!/usr/bin/env python3
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.pem with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:8443
import http.server
@apfelchips
apfelchips / serv.py
Last active December 15, 2022 16:11 — forked from phrawzty/2serv.py
simple python http server to dump request headers
View serv.py
#!/usr/bin/env python3
"""
inspiration:
https://gist.github.com/phrawzty/62540f146ee5e74ea1ab?permalink_comment_id=2358615
https://gist.github.com/nitaku/10d0662536f37a087e1b#file-server-py
example:
curl -s -H "X-Something: yeah" localhost:8080
curl --data "{\"this\":\"is a test\"}" localhost:8080
@apfelchips
apfelchips / add-ssh-keys.yml
Created March 29, 2022 21:04 — forked from EntropyWorks/add-ssh-keys.yml
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
View add-ssh-keys.yml
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
@apfelchips
apfelchips / ghidra_processor_docs_downloader.py
Last active October 16, 2023 15:06 — forked from ckuethe/ghidra_processor_docs_downloader.py
Ghidra Processor Documentation Downloader
View ghidra_processor_docs_downloader.py
#!/usr/bin/env python3
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab:
import os
import sys
import requests
docs = {
'68000': {
'M68000PRM.pdf': 'https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf',