Skip to content

Instantly share code, notes, and snippets.

@jftuga
jftuga / Markdown_Note_How_To.md
Last active September 29, 2025 06:23
Markdown Note How To

Outside of Note

Note

This is an inlined note. It has automatic line wrapping. It has automatic line wrapping. It has automatic line wrapping. It has automatic line wrapping.

Outside of Note

Note

This inlined note has >

@jftuga
jftuga / npm_npx_cheat_sheet.md
Last active August 19, 2025 15:45
npm + npx Cheat Sheet

📦 npm + npx Cheat Sheet

A quick reference for common npm and npx commands.


🔍 Checking Versions

npm -v          # Show npm version
node -v # Show Node.js version
@jftuga
jftuga / chomp.c
Created June 2, 2025 21:34
chomp
/*
* A C implementation that mimics Perl's 'chomp' functionality.
* Reads from standard input and outputs all characters except the trailing newline.
* Preserves internal newlines but removes only the final newline if present.
* Compile with: gcc -O2 -o chomp chomp.c
*/
#include <stdio.h>
int main(void) {
@jftuga
jftuga / README.md
Last active September 26, 2025 19:10
whisper.cpp on MacOS
@jftuga
jftuga / https-server.sh
Last active April 30, 2025 22:20
https server
#!/bin/bash
# https-server
# 2025-04-30
#
# This script starts a one-off HTTPS server using OpenSSL.
# It generates a temporary self-signed SSL certificate and private key,
# then uses OpenSSL's s_server command to serve files from the current directory
# over an encrypted HTTPS connection on port 4443.
#
# The script also handles cleanup:
@jftuga
jftuga / python-logging.py
Created February 22, 2025 19:46
Python Logging
# python logging for AWS Lambda function
import logging
# boto3 internally uses DEBUG and INFO; therefore start with WARNING level
logging.basicConfig(level=logging.WARNING)
def lambda_handler(event, context):
logging.warning(f"{event=}")
@jftuga
jftuga / SingleFile_Extension.md
Created February 18, 2025 01:05
SingleFile_Extension

Open SingleFile extension preferences...

For the File Name field use this:

SingleFile/%if-empty<%replace<{page-title}| |_>|no_title>--{year-locale}{month-locale}{day-locale}.{hours-locale}{minutes-locale}{seconds-locale}.{filename-extension}

Example file (uses local time):

@jftuga
jftuga / batt-info.sh
Created October 17, 2024 11:44
batt-info
# to be placed in .zshrc or .bashrc on MacOS
function batt-info() {
echo
system_profiler SPPowerDataType | grep Wattage | cut -c 7-
echo
pmset -g batt
}
@jftuga
jftuga / a-description.md
Last active January 11, 2025 14:50
Python insert_lines function

Line Insertion Utility

This Python utility provides two functions for inserting lines into configuration files:

  • insert_lines
  • regex_insert_lines

These functions allow for precise and flexible modification of text files, particularly useful for updating configuration files in networking and system administration tasks.

  • insert_lines: Inserts specified lines into a file before or after a line that starts with a given string.
@jftuga
jftuga / zsh-prompt.md
Last active June 15, 2024 00:52
My zsh prompt with current working directory, git branch name, and current time