Skip to content

Instantly share code, notes, and snippets.

@adkinss
adkinss / RSWarehouse.lua
Last active May 1, 2024 12:01
Minecolonies + ComputerCraft (CC:Tweaked) + Refined Storage + Advanced Peripherals script to automatically fulfill open work requests
-- RSWarehouse.lua
-- Author: Scott Adkins <adkinss@gmail.com> (Zucanthor)
-- Published: 2021-09-21
--
-- This program monitors work requests for the Minecolonies Warehouse and
-- tries to fulfill requests from the Refined Storage network. If the
-- RS network doesn't have enough items and a crafting pattern exists, a
-- crafting job is scheduled to restock the items in order to fulfill the
-- work request. The script will continuously loop, monitoring for new
-- requests and checking on crafting jobs to fulfill previous requests.
@adkinss
adkinss / terminator
Created August 17, 2021 19:31
Terminator shell script on WSL that launches the real terminator with better support for 4k monitors
#!/bin/bash
# For font size and blurry issues on 4k monitors, read the following article:
# https://superuser.com/questions/1370361/blurry-fonts-on-using-windows-default-scaling-with-wsl-gui-applications-hidpi
# Place this script in $HOME/bin.
# Update your PATH to include $HOME/bin before /usr/bin.
# Make sure your X Server has been started before running this script.
export DISPLAY=:0
@adkinss
adkinss / upgrade_server.sh
Last active May 16, 2021 22:31
Valhelsia 3 Server Upgrade Script
#!/bin/bash
ZIP=~/Downloads/Valhelsia+3-3.3.2-SERVER.zip
OLD=Valhelsia-3.3.1
NEW=Valhelsia-3.3.2
if [[ ! -e $ZIP ]]; then
echo "$ZIP does not exist. Specify the correct zip file to use."
exit 0
@adkinss
adkinss / logger.sh
Created September 11, 2020 13:40
Method for logging to hourly and daily files, including symlinks to the latest log of each.
#!/bin/bash
# Technique:
#
# - Run the script via cron hourly. Be mindful to stagger cron jobs and not put them all at the top of the hour.
# - Whatever the current hour is (00 - 23), that is the log file that will be written too.
# - Run the log collection script and save it to the current hour log file.
# - Relink the latest hourly symlink file to the newly created current hour log file.
# - Check to see if the daily log exists. Reasons for it NOT existing include:
# - Current time crossed midnight and it is now a new day.

Keybase proof

I hereby claim:

  • I am adkinss on github.
  • I am zucan (https://keybase.io/zucan) on keybase.
  • I have a public key ASDRLpYkRnqSUYJySO8Yc6xblCgGy1iigZIcVneToty9jwo

To claim this, I am signing this object:

#!/bin/sh
# Have you ever wondered how to calculate the third column listed
# in the shadow password file? It is the date of the last change
# to that user's password. The field is calculated by looking at
# the number of days that have passed since January 1, 1970. The
# expiration fields all depend on a good value for that field.
# January 1, 1970 is 18000 in epoch time format in seconds
THAT_WAS_THEN=18000
#!/usr/bin/perl -w
use strict;
# Without parameters, this script display the current time in epoch and date
# format. Supplied parameters need to be epoch times, which is each displayed
# in epoch and date format. The following are example outputs of the script:
#
# $ ./ctime.pl
# 1471016994 = Fri Aug 12 11:49:54 2016
#!/usr/bin/perl -w
use strict;
###
## This demonstrates how you can include BEGIN and END blocks in
## a perl script, but they don't necessarily execute in the order
## that they appear in the script. Here is the output when run:
##
## $ ./begin_end_perl_test.pl
###
## Working bash_profile file.
###
# MacPorts
export PATH=/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:~/bin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
export PS1="[\u@\h \W]$ "
test $WINDOW && PS1="[\u@\h$$WINDOW \W]\$ "
#!/usr/bin/perl -w
## This script listens for UDP messages on a port and hexdumps them to the screen.
## The listener will not send any response back to the client. It receives only.
## Clients can send messages to this listener using netcat. The following works:
## echo hello | nc -4u -w1 <listener_hostname> <listener_port>
## Substitute the hostname and port for where this listener is running from.
## Keep in mind that ports less than 1024 will require the listener to run as root.
##
## The listener does not yet take any command line options.