Skip to content

Instantly share code, notes, and snippets.

View geky's full-sized avatar
🚏
Temporarily disconnected

Christopher Haster geky

🚏
Temporarily disconnected
View GitHub Profile
@geky
geky / thumbsize.sh
Last active June 5, 2024 03:17
Watch littlefs cross-compiled thumb sizes easily
#!/bin/bash
set -eu -o pipefail
# run in watch mode?
if [[ "$@" == *-w* ]]
then
./scripts/watch.py \
$([[ "$@" == *-z* ]] && echo -z || echo -n4) \
@geky
geky / mboxfilter.py
Created October 30, 2022 01:17
Filter/count/find culprits for emails in .mbox format
#!/usr/bin/env python3
#
# Filter/count/find culprits for emails in .mbox format
#
# To find number of emails from an address:
# ./mboxfilter.py mail-2022.mbox --from=@github.com
#
# To separate these out into their own .mbox:
# ./mboxfilter.py mail-2022.mbox --from=@github.com -omail-github-2022.mbox
#
#!/bin/bash
set -uo pipefail
SRC=(lfs.c lfs_util.c)
HDR=(${SRC[@]/%.c/.h})
export CC='arm-none-eabi-gcc -mthumb'
export CFLAGS='-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR'
export BUILDDIR=watch
@geky
geky / tmux-fixh.sh
Last active December 8, 2021 23:44
Fixed the height of panes even when the window resizes
#!/bin/bash
#
# example:
# ./tmux-fixh.sh -g top-right 7
if [ "$#" -lt 2 ] && [ "$1" != "-u" ]
then
echo "usage: $0 [-gu] <pane> <height>"
exit 1
fi
@geky
geky / runmd.sh
Last active April 7, 2022 15:40
Runs the given markdown file as a bash script, with any failing commands resulting in an error
#!/bin/bash
# Runs the given markdown file as a bash script, with any failing commands
# resulting in an error
#
set -euo pipefail
if [ "$#" -lt 1 ]
then
@geky
geky / find-costs.py
Created February 25, 2020 03:10
Finds the costs of functions/files in an mbed project and creates a spreadsheet
#!/usr/bin/env python
import subprocess
import os
import re
import collections
import itertools
import csv
import argparse
@geky
geky / newlib-pico.bash
Last active January 9, 2020 16:34
Build newlib-nano with -Os and -DPREFER_SIZE_OVER_SPEED (defaults to -O2)
#!/bin/bash
mkdir newlib-pico
PREFIX=$(pwd)/newlib-pico
cd newlib-pico
echo "Created $(pwd)"
git clone git://sourceware.org/git/newlib-cygwin.git newlib-source
cd newlib-source
echo "Created $(pwd)"
@geky
geky / mark.bash
Created September 23, 2019 16:37
creates a line to find your place
alias mark='printf "\e[3$((1+RANDOM%5))m%$(tput cols)s\e[0m" | tr " " "="'
#include "lfs.h"
#include "emubd/lfs_emubd.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// test stuff
static void test_log(const char *s, uintmax_t v) {
printf("%s: %jd\n", s, v);
#include "lfs.h"
#include "emubd/lfs_emubd.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// test stuff
static void test_log(const char *s, uintmax_t v) {
printf("%s: %jd\n", s, v);