Skip to content

Instantly share code, notes, and snippets.

View mcrmonkey's full-sized avatar

ant Kenworthy mcrmonkey

  • Manchester, UK
  • 16:44 (UTC +01:00)
View GitHub Profile
@mcrmonkey
mcrmonkey / tinycore-regen
Created July 11, 2016 16:37
Rough process for re-gen'ing tinycore ISO image
##### EXTRACT: zcat ../change/boot/core.gz |cpio -i -H newc -d
######
## CREATE
cd fs
rm ../new.gz
find | cpio -o -H newc |gzip -9 > ../new.gz
@mcrmonkey
mcrmonkey / renamefiles.sh
Last active September 4, 2016 00:45
oneliner - Rename bunch of files for archiving
for I in *; do MD=$(sha512sum $I|awk -F\ '{print $1}'); EXT=$(echo $I|awk -F\. '{print $2}'); FIN="$MD.$EXT"; mv $I $FIN; done
@mcrmonkey
mcrmonkey / latency.txt
Created September 4, 2016 16:00 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Keybase proof

I hereby claim:

  • I am mcrmonkey on github.
  • I am mcrmonkey (https://keybase.io/mcrmonkey) on keybase.
  • I have a public key whose fingerprint is F66F D745 2872 457D 943C DB36 EED7 D121 9CA3 4EFD

To claim this, I am signing this object:

@mcrmonkey
mcrmonkey / slackmap.sh
Last active February 4, 2018 23:49 — forked from jgamblin/slackmap.sh
Script to NMAP a network and Post Differences to Slack
#!/bin/sh
TARGETS=${TARGETS:="192.168.1.0/24"}
OPTIONS=${NMAPOPS:="-v -T4 -F -sV"}
DATE=$(date +%Y-%m-%d-%H-%M-%S)
cd /nmap/diffs
nmap $OPTIONS $TARGETS -oA scan-$DATE > /dev/null
slack(){
curl -F file=@diff-$DATE -F initial_comment="Internal Port Change Detected" -F channels=#$SLACKCHAN -F token=$SLACKTOKEN https://slack.com/api/files.upload
}
openssl genrsa -out <KEY FILE> 4096
openssl req -new -key <KEY FILE> -sha256 -out <CSR File>
___________________________________
cat <CSR File> | openssl req -pubkey | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64
_________________________
@mcrmonkey
mcrmonkey / wannacry-vaccine.reg
Created May 12, 2017 22:45 — forked from Neo23x0/wannacry-vaccine.reg
WannaCrypt Ransomware Immunisation
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskdl.exe]
"Debugger"="taskkill /IM /F taskdl.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskse.exe]
"Debugger"="taskkill /IM /F taskse.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\wannacry.exe]
"Debugger"="taskkill.exe /IM /F wannacry.exe"
@mcrmonkey
mcrmonkey / backup.sh
Last active February 16, 2018 00:33
quick-n-dirty regular backup script
#!/bin/bash
## Doesn't copy already existing files if they are in the previous backup
## First do echo "initial" > LASTBACKUP.dat then mkdir Backup-initial && cd Backup-initial && rsync -a --progress /source/path . && cd ..
DATE=`date +"%Y%m%d"`
LASTD=`cat LASTBACKUP.dat`
echo -ne "\n\nBackup script\n ========="
echo -ne "\n\nBacking up to: Backup-$DATE\n"
echo -ne "Previous Backup: Backup-$LASTD\n\n"
@mcrmonkey
mcrmonkey / shotgun-nat.sh
Last active August 11, 2018 00:14
do nat stuff quickly
#!/bin/bash
echo -ne "\n\n\n Your interfaces: \n\n"
ip link sh
echo -ne "\n---------------------\n\n"
echo -ne "\n Enter interface name:\n"
read -r -p "Internet Interface: " INET
@mcrmonkey
mcrmonkey / update-repos.sh
Created October 31, 2017 23:22
cycle through a bunch of repos and update them
#!/bin/bash
BLUE="\033[01;34m"
GREEN="\033[01;32m"
RED="\033[01;31m"
YELLO="\033[01;33m"
NORM="\033[00m"
for R in $(find * -maxdepth 0 -type d)
do