Skip to content

Instantly share code, notes, and snippets.

@tjbenator
tjbenator / zfs-load-key@.service
Last active February 3, 2023 02:34
Mount encrypted ZFS home partition on boot.
# https://wiki.archlinux.org/title/ZFS#Unlock/Mount_at_boot_time:_systemd
[Unit]
Description=Load %I encryption keys
Before=systemd-user-sessions.service zfs-mount.service
After=zfs-import.target
Requires=zfs-import.target
DefaultDependencies=no
[Service]
Type=oneshot
# generated by PrusaSlicer 2.0.0+linux64 on 2019-09-13 at 08:47:34
bed_temperature = 90
bridge_fan_speed = 50
compatible_printers =
compatible_printers_condition =
compatible_prints =
compatible_prints_condition =
cooling = 1
disable_fan_first_layers = 3
end_filament_gcode = "; Filament-specific end gcode"
@tjbenator
tjbenator / distribute_github_ssh_keys.yml
Created April 19, 2019 14:31
Distribute SSH keys from your Github Account
- hosts: all
tasks:
- name: Get SSH Keys
uri:
url: https://api.github.com/users/tjbenator/keys
method: GET
return_content: yes
register: ssh_keys
- name: Add keys to authorized_keys file
@tjbenator
tjbenator / scptarget
Last active August 29, 2015 14:24
Generates a scp command for the given file.
#!/bin/bash
if [ ! -f "$@" ]; then
echo 'No valid file path given.'
echo
echo 'Usage: '
echo "./$(basename $0) pathtofile"
exit 0
fi
path_to_file=$(realpath "$@")
### Keybase proof
I hereby claim:
* I am tjbenator on github.
* I am tjbenator (https://keybase.io/tjbenator) on keybase.
* I have a public key ASDhLRc4Vzzh7E_GQb3SEdMHpbDzNdw3ZvatOXSSdnWm9go
To claim this, I am signing this object:
@tjbenator
tjbenator / gist:1fc3225f20fc3d41f976
Created February 27, 2015 20:19
Stop duplicate processes
PowerShell.exe -ExecutionPolicy Bypass -Command "& { get-process PROCESSNAME -ErrorAction SilentlyContinue | Sort-Object StartTime -descending | select Id, StartTime -skip 1 | stop-process }"
@tjbenator
tjbenator / add_favorite
Last active August 29, 2015 14:13
For use with keybind so that you know for sure that the current wallpaper has been favorited
#!/bin/bash
#Where Variety is located
VARIETY=/opt/extras.ubuntu.com/variety/bin/variety
FAVORITES=~/.config/variety/Favorites
#Get current wallpaper's name
FAV=$(basename $($VARIETY --show-current| sed -n 2p))
#Check if the favorite already exists
if [ -f $FAVORITES/$FAV ]; then
@echo off
echo %%0 %0
echo %%~0 %~0
echo %%n0 %n0
echo %%x0 %x0
echo %%~n0 %~n0
echo %%dp0 %dp0
echo %%~dp0 %~dp0
pause
public class ColorConvert {
public static String Convert(String sentence) {
sentence = sentence.replaceAll("&0", "§0");
sentence = sentence.replaceAll("&1", "§1");
sentence = sentence.replaceAll("&2", "§2");
sentence = sentence.replaceAll("&3", "§3");
sentence = sentence.replaceAll("&4", "§4");
sentence = sentence.replaceAll("&5", "§5");
sentence = sentence.replaceAll("&6", "§6");
sentence = sentence.replaceAll("&7", "§7");
@tjbenator
tjbenator / LyncToggle.ps1
Last active August 29, 2015 14:00
Enable/Disable Microsoft Lync (per user)
<#
.SYNOPSIS
Enable/Disable Microsoft Lync
.DESCRIPTION
Enable/Disable Microsoft Lync's "Auto Run When Logon To Windows" and "Auto Open Main Window When Startup".
.NOTES
Author : Travis Beck
Last Modified : 2014/05/01
#>