Skip to content

Instantly share code, notes, and snippets.

View benthayer's full-sized avatar

Ben Thayer benthayer

View GitHub Profile
@benthayer
benthayer / i3-config
Created August 26, 2021 02:07
Custom i3bar Python
# ...
bar {
# status_command i3status
status_command exec /path/to/my-i3-bar
}
# ...
@benthayer
benthayer / i3-config
Last active August 26, 2021 02:02
Convert key presses into audible morse code. Note: this is basically a keylogger
# ...
bindsym $mod+Shift+m mode "morse" ; exec sleep 1.5 && i3-msg mode default
set $morse /home/ben/.bin/ben/morse
mode "morse" {
bindsym o mode "morse-o"
bindsym b exec /home/ben/.bin/ben/morse clear
}
@benthayer
benthayer / workers.cpp
Last active October 5, 2020 06:48
A group of worker threads that start and stop at the same time.
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <random>
#include <chrono>
using namespace std;
mutex coutMutex;
@benthayer
benthayer / 70-mouse-speed.sh
Last active April 28, 2020 18:37
Get the mouse/trackpad devices and set the speed. Use get-device to find the id for your device then. Put in /etc/X11/xinit/xinitrc.d to have it load on x startup
#must be two digits: x.y
mousespeed=1.0
trackpadspeed=2.7
function get-device {
echo $(xinput list | awk "/$1/" | awk '{for(i=1;i<=NF;i++){ if(match($i,"^id=[0-9]{1,2}")){print $i} } }' | cut -d= -f2)
}
function get-prop {
@benthayer
benthayer / backup.sh
Created April 28, 2020 14:42
Easy Minecraft world backups using AWS S3, requires AWS CLI set up on your host. The host doesn't need to be on AWS
#!/bin/sh
backup_dir=/root/minecraft/backups
backup_file=$( date +%Y-%m-%d.tar.gz )
backup_path=$backup_dir/$backup_file
world_path=/root/minecraft/world
s3_bucket=benthayer
s3_dir=mcbackups

Keybase proof

I hereby claim:

  • I am benthayer on github.
  • I am benthayer (https://keybase.io/benthayer) on keybase.
  • I have a public key ASBcuXd6aKnLrmf1QOtP8Mqc0KnYcwzx_FyFhMRCy4DvXQo

To claim this, I am signing this object:

@benthayer
benthayer / nothing.cpp
Created September 23, 2019 20:22
Pretend you're doing nothing in C++, but actually do something
#include <iostream>
using namespace std;
int fakeOut() {
return 10;
}
int nothing() {
@benthayer
benthayer / nothing.c
Last active October 18, 2021 03:49
Pretend you're doing nothing in C, but actually do something
#include <stdio.h>
int fakeOut() {
return 10;
}
int nothing() {
}
@benthayer
benthayer / addgitnothing
Created September 23, 2019 20:18
Create git alias that does nothing
git config alias.donothing "! :"
git donothing