Skip to content

Instantly share code, notes, and snippets.

View geky's full-sized avatar
🗃️
v3-alpha

Christopher Haster geky

🗃️
v3-alpha
View GitHub Profile
@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);
@geky
geky / mbed_wait_api_coru.c
Last active May 28, 2019 22:11
Hacky coru Mbed OS integration
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
git checkout upstream/master
git merge theotherjimmy/components
git subtree add --prefix=components/storage/blockdevice/COMPONENT_SD sd-driver/master
git subtree add --prefix=components/storage/blockdevice/COMPONENT_SPIF spif-driver/master
git subtree add --prefix=components/storage/blockdevice/COMPONENT_DATAFLASH dataflash-driver/master
git subtree add --prefix=components/storage/blockdevice/COMPONENT_FLASHIAP flashiap-driver/master
git cherry-pick COMMIT_AFTER_SUBTREE_MERGES~..LAST_COMMIT
@geky
geky / bdanalyze.py
Created August 19, 2018 18:47
Analyzing script for logs of block device/cache operations
#!/usr/bin/env python2
import re
from PIL import Image, ImageDraw
COLORS = {
'lfs_bd_read': '#23ff19',
'lfs_bd_prog': '#17fff8',
'lfs_bd_erase': '#ff1800',
'lfs_cache_read': '#e8c658',
#!/bin/bash
set -o pipefail
while true
do
# Compile small sized for ARM
make -Cbuildsize CC="arm-linux-gnueabi-gcc --static -mthumb" \
OBJ=lfs.o clean size \
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
#!/bin/bash
PANE=$TMUX_PANE
while true
do
inotifywait -rqqe modify "$@" >/dev/null
sleep 0.1
tmux send -t $PANE Escape Escape ":sil e!" Enter
done &
@geky
geky / test.md
Last active October 16, 2017 20:18

Long story long, the minimum block size needed to store all ctz pointers in a filesystem can be found with this formula:

 B = (w/8)log2(2^w / (B - 2(w/8)))

where: B = block size in bytes w = pointer width in bits

#!/usr/bin/env python
import sys
import re
import argparse
import json
import os.path
import itertools
# args