Skip to content

Instantly share code, notes, and snippets.

View angstyloop's full-sized avatar

Sean Allen angstyloop

View GitHub Profile
@angstyloop
angstyloop / bitap.c
Created May 23, 2023 09:22
Find the first match of a pattern string in a target string with a given maximum allowed number of substitution errors. Written in C. Stolen from Wikipedia's article on the Bitap algorithm.
/*
COMPILE
gcc -o bitapp bitapp.c
RUN
./bitap
@angstyloop
angstyloop / metadata-columnview.c
Last active May 14, 2023 04:44
Example of how to show metadata with VIPS in a GTK4 GtkColumnView widget.
/*
ABOUT
Example of how to show metadata with VIPS in a GTK4 GtkColumnView widget.
Also supports css.
COMPILE
gcc `pkg-config --cflags gtk4 vips` -o metadata-columnview metadata-columnview.c `pkg-config --libs gtk4 vips`
@angstyloop
angstyloop / columnview.c
Last active May 14, 2023 03:05
An example of how to use GtkColumnView with GtkSignalListItemFactory for each column, where each list item in each column is a GtkLabel. This is basically a table with headers.
/*
ABOUT
An example of how to use GtkColumnView with GtkSignalListItemFactory for each
column, where each list item in each column is a GtkLabel. This is basically
a table with headers.
COMPILE
@angstyloop
angstyloop / metadata-popover.c
Last active May 12, 2023 09:39
Use VIPS to show the metadata of a test image in a non-editable GTK4 4 popover text view.
/*
Use VIPS to show the metadata of a test image in a non-editable GTK4
popover text view.
COMPILE
gcc `pkg-config --cflags gtk4 vips` -o metadata-popover metadata-popover.c `pkg-config --libs gtk4 vips`
RUN
@angstyloop
angstyloop / popover.c
Created May 12, 2023 07:14
GTK4 Example: Popover containing a TextView
/** popover.c
*
* COMPILE
*
* gcc `pkg-config --cflags gtk4` -o popover popover.c `pkg-config --libs gtk4`
*
* RUN
*
* ./popover
*/
@angstyloop
angstyloop / metadata.c
Last active May 12, 2023 09:15
Print all image metadata with VIPS
/*
Print metadata with VIPS
COMPILE
gcc -o metadata metadata.c `pkg-config --libs --cflags vips`
RUN
@angstyloop
angstyloop / infobar.c
Last active May 4, 2023 05:09
Basic usage of ( now deprecated, but still incredibly useful, in GTK 4 ) GtkInfoBar widget as a "toast".
/** infobar.c
*
* COMPILE
*
* gcc `pkg-config --cflags gtk4` -o infobar infobar.c `pkg-config --libs gtk4`
*
* RUN
*
* ./infobar
*
@angstyloop
angstyloop / scrolledwindow.c
Created March 31, 2023 00:28
Example of putting a widget ( specifically a GtkLabel ) in a GtkScrolledWindow.
/* scrolledwindow.c
*
* Example of putting a GtkLabel in a GtkScrolledWindow.
*
* COMPILE
*
* gcc `pkg-config --cflags gtk4` -o scrolledwindow scrolledwindow.c `pkg-config --libs gtk4`
*
* RUN
*
@angstyloop
angstyloop / create-windows-enterprise-vm-from-iso.sh
Created March 30, 2023 11:39
Use VBoxManage to create a VirtualBox VM from an evaluation copy of Windows 10 Enterprise ISO.
#!/bin/sh
# create-windows-enterprise-vm-from-iso.sh
# Use VBoxManage to create a VirtualBox VM from an evaluation copy of Windows 10
# Enterprise ISO.
# Follow the download instructions for your region at
#
# https://www.microsoft.com/en-us/evalcenter/download-windows-10-enterprise
@angstyloop
angstyloop / install_virtualbox_on_debian_based_linux.sh
Created March 30, 2023 11:24
Install VirtualBox Version 7.0 on Debian-based Linux
#!/bin/bash
# install_virtualbox_on_debian_based_linux.sh
# Install VirtualBox Version 7.0 on Debian-based Linux
# Add a line for the oracle virtualbox debian package to /etc/apt/sources.list
# (you can use echo/append). Replace "jammy" with your distribution name.
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list