Skip to content

Instantly share code, notes, and snippets.

Avatar

gojimmypi gojimmypi

View GitHub Profile
@gojimmypi
gojimmypi / menuselect.sh
Last active May 22, 2022
Bash - Multiple choice, user input
View menuselect.sh
#!/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 Apr 1, 2022 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

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 Sep 12, 2021
Remove an unpushed outgoing commit in Visual Studio
View git_uncommit.sh
# 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 Mar 14, 2021
commandline ipchicken cli what's my IP address
View ipchicken.sh
#!/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 Jan 17, 2021
Take ownership and assign permissions in Windows
View wchown.bat
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
View Windows License Activation Key
View getLicenceKey.bat
wmic path SoftwareLicensingService get OA3xOriginalProductKey
@gojimmypi
gojimmypi / ForcedAscii.cs
Created Jul 31, 2019
Force a string to ASCII encoding - remove all Unicode
View ForcedAscii.cs
//***********************************************************************************************************************************
// ForcedASCII we'll never allow Unicode that does not match to ASCII
// see https://www.cl.cam.ac.uk/~mgk25/ucs/examples/quickbrown.txt for sample text to test
//***********************************************************************************************************************************
private string ForcedASCII(string fromString)
{
string res = "";
try
{
Byte[] bytes;
@gojimmypi
gojimmypi / GitHashCheck.sh
Last active Mar 7, 2020
Is the specified file the same file found in GitHub repo?
View GitHashCheck.sh
#!/bin/bash
#"***************************************************************************************************"
# CheckForGitFileChange() bash function. Compare hash of local file to one on GitHub
#
# The MIT License (MIT)
#
# Copyright (c) 2020 gojimmypi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@gojimmypi
gojimmypi / Makefile
Last active Mar 24, 2019
Makefile gtkwave sim and xserver recipes for WSL FPGA programming
View Makefile
PROJ = ulx3s_adda
sim:
rm -f $(PROJ).vcd
iverilog -o $(PROJ).vvp $(PROJ).v $(PROJ)_tb.v
vvp $(PROJ).vvp
export DISPLAY=:0
## if we are running in WSL, we need a bit of help for GUI XWindows
## and sometimes the WSL username is not the same as the Windows username & we need the *windows* user path.
## this is the Windows %USER% environment variable when called from makefile: $(shell cmd.exe /c "echo $$USER")
View myfile.asc
This file has been truncated, but you can view the full file.
.comment arachne-pnr 0.1+325+0 (git sha1 840bdfd, g++ 7.3.0-27ubuntu1~18.04 -O2)
.device 8k
.io_tile 1 0
000000000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000
000000000000000000