Skip to content

Instantly share code, notes, and snippets.

View lovemycodesnippets's full-sized avatar

The New Stack lovemycodesnippets

View GitHub Profile
@lovemycodesnippets
lovemycodesnippets / gist:6df4ec05c8f5af5123569cef2d415112
Created April 10, 2025 16:27
Updated yaml file in Vacuum with new rules applied
extends: [[spectral:oas, off]]
rules:
oas3-schema: true
operation-operationId: true
operation-operationId-unique: true
operation-tag-defined: true
tag-description: true
operation-description: true
@lovemycodesnippets
lovemycodesnippets / gist:85975b282a94339969432bac65811b39
Created April 10, 2025 16:25
Turn off default rules in Vacuum
extends: [[spectral:oas, off]]
rules:
oas3-schema: true
@lovemycodesnippets
lovemycodesnippets / gist:9ebcbbb9f972805da6caec27c7ab8874
Created April 7, 2025 20:37
OpenAPI file management newsletter example
├── components
│ ├── parameters
│ │ └── EmailParameter.yaml
│ └── schemas
│ ├── NewsletterType.yaml
│ └── Subscription.yaml
├── openapi.yaml
└── paths
├── subscriptions_{email}.yaml
└── subscriptions.yaml
@lovemycodesnippets
lovemycodesnippets / crontab-01.sh
Created April 4, 2025 15:33
From the post "Unsure How to Schedule with Cron on Linux? Try one of these GUIs"
0 0 * * * /home/jack/Documents/rsync.sh > /dev/null 2>&1
@lovemycodesnippets
lovemycodesnippets / gist:58a8b4f7c86d854fa3630ddba4c0c9e0
Created March 24, 2025 15:49
From "Tutorial: Set up a Cloud Native GPU Testbed with nvKind Kubernetes"
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: cuda-vectoradd
spec:
restartPolicy: OnFailure
containers:
- name: cuda-vectoradd
image: "nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda11.7.1-ubuntu20.04"
import csv
def get_user_input():
# Prompting for user input
age = int(input("Enter your age: "))
height = float(input("Enter your height (in meters): "))
weight = float(input("Enter your weight (in kilograms): "))
gender_expression = input("Please enter your gender expression: ")
return age, height, weight, gender_expression
def append_to_file(data):
# File name
Password 1: JU9LYMJbjFucdXRm
Password 2: hVBHXpmcc3ciKYee
Password 3: Pmx5tuJAauEICoDt
Password 4: ZH9sDZsB7J5c27l8
Password 5: aOaYqOLt5s307GFD
Using lowercase letters only:
Password1:baeraesughaipesi
Password2:yiayeishieleyohx
Using numbers and special characters:
Password1:Sineu4oolu9aetha
./pw3.sh: line 47: syntax error near unexpected token `)'
./pw3.sh: line 47: ` PASSWD=$(pwgen -c --custom-charset "!@#$%^&*()_-=+{}[]|;:,.<>?/~`" $LENGTH)'
#!/bin/bash
# Define the length of the password
LENGTH=16
# Generate strong and complex passwords using pwgen
for i in {1..5}; do
PASSWD=$(pwgen -s $LENGTH)
echo "Password $i: $PASSWD"
done
# Use specific character sets with pwgen
echo ""
@lovemycodesnippets
lovemycodesnippets / trap_free.c
Created March 11, 2025 14:40
From the TNS post on TrapC
int main()
{ int* p = malloc(sizeof(int));
free(p);//TrapC ignores free, p not freed yet
*p = 10;//UB in C, no problem in TrapC
return 0;//Leaving Scope, TrapC now frees p automatically
}