Skip to content

Instantly share code, notes, and snippets.

View gojimmypi's full-sized avatar

gojimmypi gojimmypi

View GitHub Profile
#! /bin/bash -x
if [ ! -d autoconf-2.71/root/bin ] ; then
wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
tar -xf autoconf-2.71.tar.xz
pushd autoconf-2.71
./configure --prefix=`pwd`/root
make && make install
popd
fi
@gojimmypi
gojimmypi / coding_standard.md
Created April 14, 2023 18:44
coding standard

checklist:

  • [] Emphasis on readability and understandability.
  • [] Limit lines to 80 characters long.
  • [] Proper indenting. Exactly 4 spaces, no tabs.
  • [] No double-slash comments. /* only */
  • [] Zero special characters, no unicode. Beware of PDF copy/paste.
  • [] See template for example CoolThing() function.
  • [] All functions should return a value. No void function returns.
  • [] Functions with no arguments must have (void) in arg list.
@gojimmypi
gojimmypi / commit_squash.sh
Last active December 28, 2022 16:33
git squash commit; refresh main/master from upstream, refresh current branch to upstream, squash commits then push force
#!/bin/bash
#
# this assumes there's already an upstream configured:
# git remote add upstream https://github.com/user/upstream_repo.git
#
# also assumes the main branch is still called the legacy "master"
#
# git clone https://github.com/gojimmypi/wolfssl.git wolfssl_configcheck_test --depth 1 --branch ConfigCheck
MAIN_BRANCH=master
@gojimmypi
gojimmypi / code.c
Created September 9, 2022 15:38
undesired implicit cast test
// undesired implicit cast test
unsigned int x = 1;
signed int y = -1;
if (x > y) {
ESP_LOGI(TAG, "correct!");
} else {
ESP_LOGI(TAG, "Oops");
}
@gojimmypi
gojimmypi / menuselect.sh
Last active May 22, 2022 00:22
Bash - Multiple choice, user input
#!/bin/bash
echo "Name? Use, alphabetic letter from multiple choice.
a)Donald
b)Alan
c)Brian"
THIS_SELECTION=
until [ "${THIS_SELECTION^}" == "A" ] || [ "${THIS_SELECTION^}" == "B" ] || [ "${THIS_SELECTION^}" == "C" ]; do
read -n1 -p "Insert appropriate letter a, b or c: " THIS_SELECTION
THIS_SELECTION=${THIS_SELECTION^}
@gojimmypi
gojimmypi / ca.md
Created April 1, 2022 17:35 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@gojimmypi
gojimmypi / git_uncommit.sh
Created September 12, 2021 20:10
Remove an unpushed outgoing commit in Visual Studio
# from https://stackoverflow.com/questions/47114113/how-to-remove-an-unpushed-outgoing-commit-in-visual-studio
git reset --soft HEAD~
@gojimmypi
gojimmypi / ipchicken.sh
Created March 14, 2021 17:14
commandline ipchicken cli what's my IP address
#!/bin/bash
# thanks stackoverflow for sed tip: https://stackoverflow.com/questions/19878056/sed-remove-tags-from-html-file/19878198
curl -v --silent https://www.ipchicken.com 2>&1 | grep -A 1 "Address:" \
| sed -e 's/<[^>]*>//g'
@gojimmypi
gojimmypi / wchown.bat
Created January 17, 2021 21:17
Take ownership and assign permissions in Windows
takeown /f "c:\files" /r
:: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-acl?view=powershell-7.1
::
:: get permissions from a sample file
$NewAcl = Get-Acl File0.txt
:: apply those permissions to other files
Get-ChildItem -Path "C:\files" -Recurse -Include "*.txt" -Force | Set-Acl -AclObject $NewAcl
@gojimmypi
gojimmypi / getLicenceKey.bat
Created May 2, 2020 15:47
View Windows License Activation Key
wmic path SoftwareLicensingService get OA3xOriginalProductKey