Skip to content

Instantly share code, notes, and snippets.

View btgoodwin's full-sized avatar

Thomas Goodwin btgoodwin

View GitHub Profile
@btgoodwin
btgoodwin / launch.json
Created October 17, 2023 12:57
VSCode GDB Launch Settings for GStreamer's "gcheck" test framework
{
"configurations": [
{
"name": "Debug GCheck Test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/path/to/executable",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
@btgoodwin
btgoodwin / vivado-on-m1-mac.md
Created June 21, 2023 12:56 — forked from sohnryang/vivado-on-m1-mac.md
Vivado on ARM64 Mac using Rosetta 2

Running Vivado on ARM64 Mac using Rosetta 2

macOS Ventura supports running x86-64 binaries on Linux VMs. However, even with Rosetta installing Vivado is not a simple one-click process. This guide covers some workarounds and tricks to get Vivado up and running on ARM64 Mac.

  1. Make sure you're running macOS Ventura or higher.
  2. Install UTM and create a Debian VM with Rosetta according to their guide.
    • Other distributions should also work, but commands will be different.
  3. Install x86-64 version of java and libtinfo. Vivado depends on them.
@btgoodwin
btgoodwin / configure_nat_bridge.sh
Created July 23, 2020 13:23
CentOS 7 NAT configuration
#!/usr/bin/env bash
# In this configuration, there are two networks:
# eth0 -> a "WAN" into the office network
# eno1 -> a "LAN" of attached vendor hardware on network 192.168.0.0/24
# this interface's IP is 192.168.0.1, and attached hardware use
# that address as their GATEWAY.
WAN_INT="eth0"
LAN_INT="eno1"
LAN_NET="192.168.0.0/24"
@btgoodwin
btgoodwin / statuses.xml
Created June 22, 2019 16:15
REDHAWK 2.2.x Programmable Device properties
<structsequence id="hw_load_statuses" mode="readwrite" name="hw_load_statuses">
<description>The representation of received and valid hw_load_requests.</description>
<struct id="hw_load_status" name="hw_load_status">
<description>A request to load a specific file to a specific piece of hardware</description>
<simple id="hw_load_status::request_id" name="request_id" type="string">
<description>A unique ID representing a new request that is used to differentiate hw_loads from one another</description>
</simple>
<simple id="hw_load_status::requester_id" name="requester_id" type="string">
<description>The ID (typically device identifier()) that is attempting to request a hw load. This is required so the programmable device knows which device has requested and should be given full control of the hardware.</description>
</simple>
@btgoodwin
btgoodwin / find_replace_example.py
Created May 1, 2019 11:42
Python find-replace
import re
output_file_path = 'whatever'
content = None
with open(out_file_path, 'r') as f:
content = f.read()
# Regex find, replace pairs
FINDREPLACE_LIST = [
( re.compile(r'FIND', re.M), r'REPLACE' )
@btgoodwin
btgoodwin / erase_all_jobs.sh
Last active March 20, 2019 13:07
GitLab EE/CE V4 API: Erase all jobs for project
#!/usr/bin/env bash
# Author: Thomas Goodwin
# Company: Geon Technologies
# Purpose: Erase all jobs for a given GitLab project.
# Arguments:
# 1) URL of gitlab project (https://some.server.com/group/[group/]project)
# 2) private token (personal access token, impersonation token, etc.)
#
# Requirements: bash > 4.0, jq
@btgoodwin
btgoodwin / time_patch.sh
Created December 13, 2017 13:40
Script for correcting the Racoon configuration of macOS/OS X so IPSec VPNs do not time out.
#!/bin/bash
# There currently (12/13/17) is no way to update the Racoon template configuraiton
# of macOS or OS X...and there hasn't been despite this lingering issue where
# VPN tunnels will "collapse" silently just shy of an hour. The below patching
# will correct the timeout issue so that your tunnel will remain useful for hours
# (really, days).
#
# Usage:
# Start your VPN connection.
# Copy the "/var/run/racoon/[filename].conf" to /etc/racoon/config
@btgoodwin
btgoodwin / uEnv.txt
Created January 19, 2017 14:23
MicroZed Target
kernel_image=uImage
devicetree_image=microzed-zynq7.dtb
bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk
uenvcmd=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000
modeboot=uenvcmd
@btgoodwin
btgoodwin / frontend_gps_idl
Created April 22, 2015 17:56
Simple set of frontend GPS definitions in Python since the code generator doesn't support it right now.
'''
This can be pasted at the head of your implementation class file. In your implementation
initialize() method, replace the port with this new one and add 2 private members attached
to two public properties:
def initialize(self):
baseclass.initialize()
self.port_port_name = self.My_PortFRONTENDGPSIn(self, 'port_name')
self._GPSInfo = GPSInfo()
self._GpsTimePos = GpsTimePos()
@btgoodwin
btgoodwin / debug-python-device.txt
Last active August 29, 2015 14:18
Debug a Python REDHAWK Device on a running domain
In this case, I'm suggesting using `winpdb` because it should be available to you in the CentOS 6.x EPEL repos (which gets around some issues of what software can be used, where).
1) Find the `entrypoint` tag entry in your SPD.XML file, duplicate it
2) Comment the original `entrypoint` line
3) Edit the new entry to use a shell script instead, e.g.: `<entrypoint>python/debug.sh</entrypoint>`
4) Create `python/debug.sh`: