Skip to content

Instantly share code, notes, and snippets.

View lpsantil's full-sized avatar

lpsantil

  • Thousand Oaks, CA
View GitHub Profile
@lpsantil
lpsantil / embeddedPayload.sh
Created July 7, 2025 05:14 — forked from ChrisCarini/embeddedPayload.sh
Embed TAR file in a shell script
#!/bin/bash
# Instructions:
# 1) Create your TAR archive
# tar -czpf file.tar <file1> <file2> ... <fileN>
# 2) Append the TAR file contents to the script
# cat file.tar >> embeddedPayload.sh
# 3) Run script. (./embeddedPayload.sh)

Setup with TinyCore Linux (RAM only OS) on Raspberry Pi Zero W on Windows

These are the steps taken to setup piCore 14 on a Raspberry Pi with only Wi-Fi (no ethernet)
Newer version might work as well (or maybe even better), but have not been tested.

Set up piCore

  1. Download the piCore image
  2. Unpack the .zip file and write the .img file to the SD-Card (using Raspberry Pi Imager for example)
  3. Move the SD-Card to the Pi, plug in a keyboard and a screen, plug in the power source
  4. Execute backup shell command after the first boot to save generated unique SSH keys which will be used during next boots.
@lpsantil
lpsantil / bash_aws_jq_cheatsheet.sh
Created November 2, 2023 01:53 — forked from lukeplausin/bash_aws_jq_cheatsheet.sh
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@lpsantil
lpsantil / gist:a5da8e8eb984f9d543f662c9166c2b4a
Created May 13, 2020 06:08
u-boot recovery attempt 02
U-Boot 2009.08-00088-g121cddc (Nov 17 2014 - 05:50:46) Avocent (0.0.3) EVB, Build: jenkins-idrac-yocto-release-505
CPU: SH-4A
BOARD: R0P7757LC00xxRL (C0 step) board
BOOT: Secure, HRK not generated
DRAM: 240MB
(240MB of 256MB total DRAM is available on U-Boot)
ENV: Using primary env area.
In: serial
Out: serial
@lpsantil
lpsantil / gist:e17253a768fcb22dc8b5c72ec2f55787
Last active May 13, 2020 06:08
u-boot recovery attempt 01
U-Boot 2009.08-00088-g121cddc (Nov 17 2014 - 05:50:46) Avocent (0.0.3) EVB, Build: jenkins-idrac-yocto-release-505
CPU: SH-4A
BOARD: R0P7757LC00xxRL (C0 step) board
BOOT: Secure, HRK not generated
DRAM: 240MB
(240MB of 256MB total DRAM is available on U-Boot)
ENV: Using primary env area.
In: serial
Out: serial
[SH7757 /flash]$ reboot
/etc/sysapps_script/avct_reboot.sh: line 44: can't create /flash/data0/date_tmp: Read-only file system
Wait for pending config changes ...
Done
cp: can't stat '/flash/data0/cv/avctpasswd': No such file or directory
cp: can't stat '/flash/data0/cv/avctpasswd_new_done': No such file or directory
/etc/sysapps_script/avct_reboot.sh: line 80: can't create /flash/data0/aim/persistent/os_str_main_cert_path: nonexistent directory
/etc/sysapps_script/avct_reboot.sh: line 81: can't create /flash/data0/aim/persistent/os_str_main_key_path: nonexistent directory
watchdog_shutdown2 SIGINT ..killall: AppMonitor: no process killed
U-Boot 2009.08-00088-g121cddc (Nov 17 2014 - 05:50:46) Avocent (0.0.3) EVB, Build: jenkins-idrac-yocto-release-505
CPU: SH-4A
BOARD: R0P7757LC00xxRL (C0 step) board
BOOT: Secure, HRK not generated
DRAM: 240MB
(240MB of 256MB total DRAM is available on U-Boot)
ENV: Using primary env area.
In: serial
Out: serial
@lpsantil
lpsantil / generate.c
Created March 5, 2019 20:12 — forked from munificent/generate.c
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@lpsantil
lpsantil / Makefile
Created June 18, 2018 19:25 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@lpsantil
lpsantil / openshift-cheatsheet.md
Created April 2, 2018 23:49 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet
  • Binary Builds
oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
oc start-build ola2 --from-file=./target/ola.jar --follow
oc new-app 
  • Turn off/on DC triggers to do a batch of changes without spam many deployments