Skip to content

Instantly share code, notes, and snippets.

View swharden's full-sized avatar

Scott W Harden swharden

View GitHub Profile
@swharden
swharden / GenerateColorPalettes.cs
Last active June 17, 2022 20:42
A C# .NET 6 app for generating XML color palettes
// This .NET 6 console app generates XML color palette files compatible with Adobe Illustrator and CorelDraw.
// Color palettes are sourced from the ScottPlot package.
foreach (var pal in ScottPlot.Palette.GetPalettes())
{
string xml = GetPaletteXml(pal);
string saveFolder = Path.GetFullPath("palettes");
if (!Directory.Exists(saveFolder))
Directory.CreateDirectory(saveFolder);
@swharden
swharden / pptx-to-html.py
Created January 31, 2023 17:20
Extract text from a folder of PPTX files and save the output in a HTML report
"""
This script finds text in a folder of PPT files and saves what is found
in a HMTL report that can be easily searched. It separates long phrases
from stray words to make important content easier to spot.
"""
import datetime
import collections
import collections.abc
// C code from the AD7705/AD7706 datasheet
// https://www.analog.com/media/en/technical-documentation/data-sheets/ad7705_7706.pdf
#include <math.h>
#include <io6811.h>
#define NUM_SAMPLES 1000 /* change the number of data samples */
#define MAX_REG_LENGTH 2 /* this says that the max length of a register is 2 bytes */
Writetoreg(int);
Read(int, char);
@swharden
swharden / lowercase.py
Created July 3, 2023 01:11
Python script to rename all files in a folder to lowercase
"""
This script renames all files in a folder to lowercase
"""
import pathlib
import shutil
folder = "./full/"
for path in pathlib.Path(folder).glob("*.*"):
path2 = path.parent.joinpath(str(path.name).lower())
@swharden
swharden / thumbnail.py
Created July 3, 2023 01:23
Resize every image in a folder to create small and medium versions
"""
Resize every image in a folder to create small and medium versions.
"""
import pathlib
from PIL import Image
def resize_width(path: pathlib.Path, out_folder: str, new_width: int):
"""Resize a image to use the given width."""