Skip to content

Instantly share code, notes, and snippets.

View lpsantil's full-sized avatar

lpsantil

  • Thousand Oaks, CA
View GitHub Profile
@lpsantil
lpsantil / pcode.c
Created March 15, 2016 00:31 — forked from r-lyeh-archived/pcode.c
pcode interpreter
/*
P-code for PL/0 machine
[ref] https://en.wikipedia.org/wiki/P-code_machine
[ref] http://blackmesatech.com/2011/12/pl0/pl0.xhtml
The PL/0 virtual machine was originally specified by Nicklaus Wirth in his book
Algorithms + Data Structures = Programs; it's used as the target machine for a
PL/0 compiler.
@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 / boot.asm
Last active September 3, 2021 13:46
; src/boot/boot.asm
; Bootloader to load kernel, switch to 32-bit protected mode and execute kernel
[BITS 16] ; 16-bit real mode
[ORG 0x7C00] ; Loaded into memory at 0x7C00
MOV [bootDrive], DL ; Store DL (boot drive number) in memory
MOV BP, 0x9000 ; Move Base Pointer in free memory space
MOV SP, BP ; Move Stack Pointer to base of stack
@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