Skip to content

Instantly share code, notes, and snippets.

@rage311
rage311 / zen_kernel_version_pin.hook
Last active February 27, 2024 00:16
Arch Linux zen kernel minor version pinning
# /etc/pacman.d/hooks/zen_kernel_version_pin.hook
[Trigger]
Operation = Upgrade
Type = Package
Target = linux-zen
Target = linux-zen-headers
[Action]
Description = Prevent zen kernel from upgrading past X.Y major.minor version
When = PreTransaction
@rage311
rage311 / patch_netssleay_openbsd.sh
Created December 1, 2023 07:07
Patch Perl 5 Net::SSLeay 1.92 for Openbsd
#!/bin/sh
curl -O https://cpan.metacpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.92.tar.gz \
&& tar xzvf Net-SSLeay-1.92.tar.gz \
&& cd Net-SSLeay-1.92 \
&& curl -O https://raw.githubusercontent.com/openbsd/ports/master/security/p5-Net-SSLeay/patches/patch-SSLeay_xs \
&& patch < patch-SSLeay_xs \
&& perl Makefile.PL \
&& make install
@rage311
rage311 / StevenBlack_hosts_unbound.sh
Created August 27, 2021 17:33
Get Steven Black's hosts list and convert it to Unbound's format for blocking at the DNS level
#!/bin/sh
# This has some OpenBSD specifics in it ("ftp" and the unbound paths).
# Run the download and convert as a non-privileged user (in a cron job)
BLACKLIST_PATH_TEMP="/tmp/blacklist.conf"
# Change "ftp" to whichever HTTP client you prefer
/usr/bin/ftp -o - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | \
awk '{if (/^0\.0\.0\.0/) print "local-zone: \""$2"\" redirect\nlocal-data: \""$2" A 0.0.0.0\""}' \
> "$BLACKLIST_PATH_TEMP" \
@rage311
rage311 / archive_reddit_images.pl
Created April 4, 2019 05:03
Download top images from specific subreddits
#!/usr/bin/env perl
use 5.024;
use Mojo::Base -strict;
use Mojo::UserAgent;
use Mojo::Util 'dumper';
binmode STDOUT, ':encoding(UTF-8)';
say '[[ ', scalar localtime, ' ]]';
@rage311
rage311 / takp_puppeteer_express.js
Created August 7, 2018 22:03
Small Node Express app that uses puppeteer to screenshot and return the item stats DOM of a requested TAKProject item ID
const express = require('express');
const puppeteer = require('puppeteer');
const app = express();
app.get('/:id', async (req, res) => {
const itemId = req.params.id;
console.log('Request itemId: ' + itemId);
const browser = await puppeteer.launch({args:['--no-sandbox']});
@rage311
rage311 / init.vim
Created April 24, 2018 19:06
Neovim vimrc (~/.config/neovim/init.vim)
" vim-plug stuff
call plug#begin('~/.local/share/nvim/plugged')
"Plug 'VundleVim/Vundle.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tommcdo/vim-lion'
@rage311
rage311 / i3blocks_comcast.pl
Created February 23, 2018 17:46
Get your Comcast data usage stats for the month and (optionally) display it in i3blocks
#!/usr/bin/env perl
use strict;
use warnings;
use 5.024;
use Mojo::UserAgent;
use DateTime;
@rage311
rage311 / freshports.pl
Created February 12, 2018 21:34
Script to query freshports.org for ports by name
#!/usr/bin/env perl
use strict;
use warnings;
use 5.024;
use Mojo::UserAgent;
use Data::Dumper;
die 'Need port name as argument'
@rage311
rage311 / csgo_tweaks.sh
Last active July 6, 2021 12:38
Some tweaks to run when starting and stopping CSGO in Linux
#!/usr/bin/env bash
# Also requires perl
# This is especially useful to launch automatically when you run CS:GO
# by adding it to CS:GO's "Launch Options" in Steam.
# (Right-click the game in the library list, click "Properties",
# click "Set Launch Options...". eg:
# $HOME/bin/csgo_tweaks.sh start; %command%; $HOME/bin/csgo_tweaks.sh stop
# (make sure to chmod +x csgo_tweaks.sh before you try that)
@rage311
rage311 / takp_3box.sh
Created November 12, 2016 22:49
Launch 3 instances of the EQ client for TAKP (The Al'kabor Project)
#!/usr/bin/env bash
# Command to run on dedicated GPU (optirun, primusrun, DRI_PRIME=1)
#OPTIMUS_CMD="optirun"
# Array of PlayOnLinux shortcut names
POL_SHORTCUT[0]='eqgame (takp_64_1)'
POL_SHORTCUT[1]='eqgame (takp_64_2)'
POL_SHORTCUT[2]='eqgame (takp_64_3)'