Skip to content

Instantly share code, notes, and snippets.

View ahogen's full-sized avatar

Alex H ahogen

View GitHub Profile
#!/usr/bin/env python3
"""
The idea here is to have one demo of each common argparse format
type. This is useful for me to be able to copy/paste into a new
script and have something to quickly edit and trim down to get
the functionality I need.
Expect this file to grow/change as I need new options.
This is, however, a working example. I hate examples that don't
#!/bin/bash
#####################################################################
# Alex Hogen (https://github.com/ahogen)
#
# Run the command provided, redirecting STDERR to STDOUT, effectivly
# reducing all output to a single output pipe, hence the name "spipe".
# This script is also capable of capturing some common kill codes
# and forwarding them to the child process.
#
@ahogen
ahogen / pylint-exit-handler.sh
Created November 9, 2018 17:27
Parse and filter PyLint exit codes. Useful for Gitlab CI, Jenkins, or other continuous integration scripting which uses PyLint for Python.
#!/bin/bash
################################################################################
# Alex Hogen (code.ahogen@outlook.com)
# https://github.com/ahogen
#
# A basic script to inspect the return code from pylint, filter it based on our
# needs, and return with a non-zero exit code when appropriate.
#
# PyLint returns non-zero exit codes for things that aren't errors. For example,
# if a warning message was issued, 0x4 is OR'd into the exit code.
@ahogen
ahogen / get-gcc-arm-none-eabi.py
Last active October 30, 2019 19:23
Download latest GNU GCC compiler from ARM's website (for Cortex-M and Cortex-R processors).
#!/usr/bin/env python3
"""Download latest GNU Toolchain from ARM's website
Author: Alex Hogen (code.ahogen@outlook.com)
MIT License
Copyright (c) 2019 Alexander Hogen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
#!/usr/env python3
"""
Alex Hogen (code.ahogen@outlook.com)
Compare Anybadge to Sheilds.io SVG badges.
"""
import os
import sys
import shutil
@ahogen
ahogen / inject_crc32_lpc_boot_block.gdb
Last active June 10, 2019 23:15
Compute a CRC32 of an ELF image and insert it into the
###############################################################################
# Date: 2019-06-06
# Author: Alexander Hogen
# code.ahogen@outlook.com
# https://github.com/ahogen
#
# !! NOTE: This is currently just a scratchpad for my work. THIS IS NOT DONE YET!
#
# The NXP LPC(546xx) microcontroller's bootloader supports verifying the
# image by checking a CRC32 value before starting to execute it. This
@ahogen
ahogen / build-sys-img.jl
Created November 14, 2017 17:21
Build system-specific Julia image
# From: #7 http://www.stochasticlifestyle.com/7-julia-gotchas-handle/
Pkg.update()
if is_windows()
Pkg.add("WinRPM");
using WinRPM
WinRPM.install("gcc", yes=true)
WinRPM.install("winpthreads-devel", yes=true)
end
@ahogen
ahogen / usb-rescan-print.sh
Created July 25, 2018 05:54
Automatically scan and print dev list when USB device added or removed.
#!/bin/bash
###############################################################################
# Author: Alex Hogen <code.ahogen@outlook.com>
# https://github.com/ahogen
# Date Created: 2018-07-19
#
# Copyright (c) 2018, Alexander Hogen.
#
# Usage:
@ahogen
ahogen / win-hostnames-on-linux.md
Created July 12, 2018 17:56
How to enable Linux machines to resolve Windows hostnames

PlantUML Graph [link]

@startuml
INIT_BRIDGE : updateRoleDisabledTree()

ROLE_SELECTION : clearReselectTree()
ROLE_SELECTION : updateRolesTree()
ROLE_SELECTION : setSelectedTree()