Skip to content

Instantly share code, notes, and snippets.

ELF -> H[0,128]
for i = 0 to H.e_shnum in (SH[H.e_shoff+i*H.e_shentsize, H.e_shoff+(i+1)*H.e_shentsize])
for i = 1 to H.e_shnum in (Sec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size])
where Sec ->
switch(SH(i).sh_type = 6 -> DynSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
/ SH(i).sh_type = 3 -> StrSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
/ (SH(i).sh_type = 11) || (SH(i).sh_type = 2) -> DynSymSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
/ SH(i).sh_type = 7 -> NoteSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
/ SH(i).sh_type = 9 -> RelSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
/ SH(i).sh_type = 4 -> RelAddEndSec[SH(i).sh_offset, SH(i).sh_offset+SH(i).sh_size]
@mdaniel
mdaniel / awslocal
Created August 18, 2023 21:48
awslocal upgraded to understand various static credential types plus the endpoint override mechanisms
#!/usr/bin/env bash
set -euo pipefail
# we never want it to contact IMDS since that's just log noise
export AWS_EC2_METADATA_DISABLED=true
if [[ -z "${AWS_CONFIG_FILE:-}" ]]; then
AWS_CONFIG_FILE=$HOME/.aws/config_awslocal
if [[ ! -e "$AWS_CONFIG_FILE" ]]; then
unset AWS_CONFIG_FILE
else
export AWS_CONFIG_FILE
@mdaniel
mdaniel / op-pinentry
Created December 19, 2022 20:52
Implement the pinentry Assuan protocol backed by the 1Password op binary
#!/usr/bin/env bash
__log=$HOME/op-pinentry.$$.txt
# { set; printenv; echo "ARGV=$*"; } &>"$__log"
# exec 2>>"$__log"
# set -x
# if we are not running under gpg-agent, that is fatal
if [[ -z "$_assuan_pipe_connect_pid" ]]; then
exit 143
fi
set -ex
hostname -f > /etc/hostname
hostname -F /etc/hostname
depmod -a || true
modprobe -v ip6_tables
for i in ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh; do
modprobe -v $i
done
if ! type docker >/dev/null 2>&1; then
@mdaniel
mdaniel / .ci__script__cd.sh
Created September 18, 2018 07:06
Atomwise
#! /usr/bin/env bash
image_name="get the ECR image name through tomfoolery"
export JOB_Q='arn:our-ci-cd-queue'
python -u queue_worker.py &
worker_pid=$!
trap "kill -INT $worker_pid" EXIT
export TASK_ARN='arn:a-ci-cd-specific-task'
python -u queue_submit.py -<<DOIT
@mdaniel
mdaniel / CMakeLists.txt
Created January 1, 2018 14:22
CMake descriptor for PuTTY so CLion can work with it; It's not perfect, but it builds working executables, so there's that
CMAKE_MINIMUM_REQUIRED(VERSION 3.9.0)
CMAKE_POLICY(VERSION 3.9)
SET(PUTTY_VERSION "0.70.20180101")
PROJECT(putty VERSION ${PUTTY_VERSION} LANGUAGES C)
FIND_PROGRAM(PERL_EXE
NAMES perl perl.exe
DOC "location of an executable Perl used to generate files within the project")
OPTION(NO_IPV6 [=[
@mdaniel
mdaniel / Vagrantfile
Last active December 22, 2017 07:10
Build [asuswrt-merlin](https://github.com/RMerl/asuswrt-merlin#readme) using Vagrant. This is just works-for-me, and not an officially supported mechanism
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# the resulting image won't be 64 bit,
# so adding that into the mix just makes life painful
config.vm.box = "ubuntu/trusty32"
config.vm.boot_timeout = 3600
config.vm.provider "virtualbox" do |vb|
@mdaniel
mdaniel / glide.yaml
Created December 6, 2017 17:50
Issue daemon-reload and install systemd unit files from golang
package: systemd-installer
import:
- package: github.com/coreos/go-systemd
version: v15
- package: github.com/godbus/dbus
version: v4.0.0
@mdaniel
mdaniel / docker2rc.py
Created January 29, 2016 22:26
Mostly convert the output of "docker inspect" into a Kubernetes ReplicationController
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import json
import re
import sys
import yaml