Skip to content

Instantly share code, notes, and snippets.

View markstos's full-sized avatar

Mark Stosberg markstos

View GitHub Profile
@vbatts
vbatts / Dockerfile
Last active February 5, 2023 16:34
buildah: quick deep dive
FROM buildpack-deps:stretch-scm
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
@DonaldKellett
DonaldKellett / 90-logitech-c930e.rules
Last active February 16, 2023 02:54
Disable autofocus and specify absolute focus for Logitech c930e with udev and systemd (Fedora 35 Workstation)
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0843", TAG+="systemd", ENV{SYSTEMD_WANTS}="logitech-c930e@$env{MINOR}.service"
@kppullin
kppullin / config.fish
Created May 16, 2020 03:51
Fish shell + WSL2 + gnome-keyring / secret-tool
#
# This fish config sets up a working `gnome-keyring` on WSL2.
# I imagine it will work with WSL1 as well, perhaps after adjusting the `DISPLAY` value.
#
# Based off this bash script: https://askubuntu.com/questions/815327/running-gnome-keyring-on-wsl-windows-subsystem-for-linux
# Tested and working with `aws-vault` and `jetbrains-toolbox`.
#
# Be sure your x server is running!!!
set -x DISPLAY (cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
@ortango
ortango / lsvisible.jq
Created October 27, 2021 17:03
wmfocus quick n' dirty stdin support
#!/bin/jq -rf
.monitors[] |
.focusedDesktopId as $d |
.desktops[] |
select(.id==$d) |
.focusedNodeId as $fw |
getpath(paths(.client?!=null and .hidden==false)) |
.id as $w |
.client |
@westonruter
westonruter / README.md
Last active November 10, 2023 22:24
Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember the Milk

Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember The Milk, transforming the transcribed speech into Smart Add syntax, and then archiving the thread in Gmail. Create a new script in Google Drive for Gmail, paste this JS into it, customize the rtm_email variable to your own, and customize the transformations to rtm_task for Smart Add to fit your style, and then set up a trigger to invoke the function every minute. Within approximately a minute after sending yourself a note via Google Now, the reminder will be added to your RTM account!

Example dictation: Note to self to look up article about widgets for work priority 1
Smart Add transformation: Look up article about widgets #work !1

Resources

@dAnjou
dAnjou / _.md
Last active November 14, 2023 11:49
Automatically unlock KeePass database with GNOME Keyring

(Tested with KeePassXC on Fedora 25)

By default when using GNOME Keyring you have a keyring that is unlocked when you log in (usually called "Login"). You can make use of that by storing a KeePass database password in this keyring and using it to automatically unlock your KeePass database.

Store the KeePass database password in GNOME Keyring. You'll have to set a label and at least one attribute/value pair. The label is displayed in a GNOME keyring manager (e.g. Seahorse), the attribute/value pair should be a unique identifier because it's needed for the lookup. I suggest to use keepass as attribute and the database name as value (make sure it doesn't contain any spaces).

secret-tool store --label="KeePass <database_name>" keepass <database_name>

Then create a script to launch and immediately unlock your KeePass database.

@SidharthArya
SidharthArya / alttab
Last active November 17, 2023 22:50
Sway Windows Manager Alt Tab behavior
#!/usr/bin/env python3
import sys
import json
import subprocess
direction=bool(sys.argv[1] == 't' or sys.argv[1] == 'T')
swaymsg = subprocess.run(['swaymsg', '-t', 'get_tree'], stdout=subprocess.PIPE)
data = json.loads(swaymsg.stdout)
current = data["nodes"][1]["current_workspace"]
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@trestletech
trestletech / instance-types.sh
Created June 15, 2016 16:41
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do