Skip to content

Instantly share code, notes, and snippets.

View stecman's full-sized avatar

Stephen Holdaway stecman

View GitHub Profile
@stecman
stecman / config
Last active October 15, 2023 21:34
Scripts to make i3 more natural to use
# Move workspace left and right (swap if conflicting)
bindsym $mod+Ctrl+Shift+Left exec $HOME/.i3/i3-swap.py left
bindsym $mod+Ctrl+Shift+Right exec $HOME/.i3/i3-swap.py right
# Make the next free workspace number, whatever that is
bindsym $mod+Ctrl+Return exec $HOME/.i3/i3-makews.py
# Rotate focus through visible workspaces on different monitors
bindsym $mod+x exec $HOME/.i3/i3-nextoutput.py
@stecman
stecman / SConscript
Last active September 29, 2023 09:57
STM8 WS2812 hacked together demo
import os
# Device definition for the stm8s.h header
# This enables available features of the device library.
STM8_DEVICE_DEFINE = "STM8S003"
# Programmer argument for stm8flash (stlink or stlinkv2)
STM8_PROGRAMMER = "stlinkv2"
# Target device argument for stm8flash
@stecman
stecman / embedding_files_in_firmware.md
Last active September 5, 2023 00:07
Basics of embedding a file in firmware with GCC

Basics of embedding files in firmware

This is an appendix item for Unicode Input Terminal.

With gcc, the linker can can happily create an object file from arbitrary input files. This is useful for embedding images, fonts, etc into firmware. Full CMake code at the end, but the important parts are:

# Create object file
@stecman
stecman / Bake_codepoints_python.md
Last active September 5, 2023 00:07
Render glyphs to file with Python

Bake glyphs from fonts to image files (Python)

This is an appendix item for Unicode Input Terminal.

Protoype code to pre-render 240x240 screens, each with a glyph and codepoint metadata.

# Download Unicode metadata
wget https://unicode.org/Public/UNIDATA/UnicodeData.txt
wget https://unicode.org/Public/UNIDATA/Blocks.txt
@stecman
stecman / Bake_codepoints_rust.md
Last active September 5, 2023 00:06
Render glyphs to image with Rust

Bake glyphs from fonts to image files (Rust)

This is an appendix item for Unicode Input Terminal.

Find all of the Unicode codepoints a font can represent and renders them to invidiaul image files. Note the output directory is hard-coded to /tmp/rendered.

cargo run <font-file, ...>
@stecman
stecman / Readme.md
Last active July 10, 2023 00:37
Steam auto trader

Maximum Hax

Automates the UI actions (clicks, typing) to sell Steam trading cards from the Steam web interface. To use this:

  1. Log into your Steam account in Chrome
  2. Go to [Username] -> Inventory
  3. Open the Javascript console (View -> Developer -> Javascript Console)
  4. Paste in the entire script below and press enter
  5. To start selling all trading cards in your inventory, type doHax() in the console and press enter
  6. ...
@stecman
stecman / _README.md
Last active March 6, 2023 11:42
bash-completion extract for dealing with colons

Extract from bash-completion for working with stecman/symfony-console-completion

This is an example extract of the minimum amount of the bash-completion project required to use these two functions:

  • __ltrim_colon_completions
  • _get_comp_words_by_ref

The functions here are copied verbatim from the bash_completion source. I recommend not using this extract unless there are no other alternatives. Instead, prefer installing the bash-completion package from your package manager, or install bash-completion from source.

@stecman
stecman / README.md
Last active January 2, 2023 18:33
SCons build script for STM8 / STM8S with SDCC

SCons + SDCC for STM8S

Setting up SCons to build using SDCC was fairly time consuming for someone new to SCons, so here's a basic working config to get you started.

With some tweaking this should also work for other architectures that SDCC supports (z80, z180, mcs51, r2k, etc).

Required software

SCons (build tool)

@stecman
stecman / ffmpeg_hls.md
Last active December 21, 2022 20:23
ffmpeg streaming examples

FFmpeg streaming

These are some ffmpeg command lines used when developing VHS dubbing controller.

HLS Stream (on Linux)

#!/bin/bash

# Stream a PAL 50i capture, cropped and de-interlaced using ffmpeg
@stecman
stecman / RestController.php
Last active August 17, 2022 15:20
Generic REST controller for use in the Phalcon PHP framework
<?php
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\DispatcherInterface;
use Phalcon\Mvc\Model\CriteriaInterface;
use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\View;
abstract class RestController extends Controller