Skip to content

Instantly share code, notes, and snippets.

View W-Floyd's full-sized avatar

William Floyd W-Floyd

View GitHub Profile
@yohhoy
yohhoy / binsem.cpp
Last active February 23, 2024 12:48
binary semaphore for C++11
#include <mutex>
#include <condition_variable>
// binary semaphore
class binsem {
public:
explicit binsem(int init_count = count_max)
: count_(init_count) {}
// P-operation / acquire
@jvhaarst
jvhaarst / movedigiphotos.bash
Last active December 12, 2022 22:02
Bash script to move images, based on exif data and file timestamp
#!/bin/bash
# Reads EXIF creation date from all .JPG files in the
# current directory and moves them carefully under
#
# $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
@laszukdawid
laszukdawid / theme_switcher.sh
Last active January 25, 2023 19:32
Set of commands and files to enable timed theme (dark/light) change
kretyn@meland:~/$ mkdir -p ~/.config/systemd/user
kretyn@meland:~/$ mkdir -p ~/.scripts
kretyn@meland:~/$ cd ~/.config/systemd/user
kretyn@meland:~/.config/systemd/user$ cat light.service
[Unit]
Description=Automatically change the "Window Theme" to "light" in the morning.
[Service]
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus