Skip to content

Instantly share code, notes, and snippets.

unbound_lambda( ({'item, 'dest}),
({#'?,
({#',, ({#'=, 'origin, ({#'environment, 'item}) }),
({#'=, 'mover, ({#'previous_object, 0}) }),
0
}),
0,
({#'?,
({#'call_other, 'item, "query_move_ok", 'dest, 'mover
/*({#'previous_object, 1})*/ }),
@rjsalts
rjsalts / EOTL4X.md
Last active September 14, 2018 07:05

Ideas for a turn based strategy component on the mud.

Turns

  • Would twice daily/daily be too frequent?
  • Variable length turns? Once all players have submitted orders resolve the next turn.
  • Allow late joiners to a game?
  • Multiple instances with different turn durations (could become a chore in itself, or leave certain intervals fallow)
  • Adjust slowly by percentage intervals?

Setting

  • Fantasy/Medieval - You're given a writ from the King as a new Baron in a wilderness kingdom
@rjsalts
rjsalts / acme_auth_sock
Created March 28, 2018 05:26
update-policy authentication helper for acme-challenge inside kerberos realm
#!/usr/bin/perl
use strict;
use IO::Socket::UNIX;
use Net::DNS;
my $path = '/tmp/acme.sock';
my $realm = 'EXAMPLE.ORG';
# m h dom mon dow command
55 23 28-31 * * [ "$(date --date=tomorrow +\%d)" == "01" ] && /root/bin/generate_dkim
@rjsalts
rjsalts / newzone
Last active December 20, 2019 08:05
Add a new zone with rndc addzone on master an slave
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# primary name server ips
primary=(192.0.2.2 2001:db8:1::53)
# secondary name server ips
secondary=(192.0.2.3 2001:db8:2::53)
#salt for NSEC3
salt=$(head -c 512 /dev/urandom | sha1sum | cut -b 1-16)
@rjsalts
rjsalts / gist:4dc37ab46e943f890c41ef12b34b4915
Created September 13, 2016 13:14
when you update passwd/group/shadow
for user in $(getent passwd | sort -t : -k 3 -n | cut -d : -f 1,3);do if [[ $(grep ${user%%:*} passwd | cut -d : -f 1,3) == ${user} ]];then echo $user is the same;else find / -xdev -user ${user%%:*} -print0 > change_owner/${user%%:*};fi ;done
for group in $(getent group | sort -t : -k 3 -n | cut -d : -f 1,3);do if [[ $(grep ${group%%:*} group | cut -d : -f 1,3) == ${group} ]];then echo $group is the same;else find / -xdev -group ${group%%:*} -print0 > change_group/${group%%:*};fi ;done
cd change_owner;for file in *;do cat $file | xargs -0 -I '{}' chown $file {};done;cd ..
cd change_group;for file in *;do cat $file | xargs -0 -I '{}' chgrp $file {};done;cd ..
@rjsalts
rjsalts / add_host
Created September 12, 2016 12:46
add_host example
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
hostname=${1:-}
global=${2:-}
private=${3:-}
ttl=${4:-86400}
echo -e "$hostname $ttl IN AAAA $global\nsend" | nsupdate -k /path/to/global.key #add key to match-clients for global view
set event-options policy lower-metric events vrrpd_new_master
set event-options policy lower-metric then change-configuration commands "delete policy-options policy-statement foo_subnet_export term 1 then metric add"
set event-options policy raise-metric events vrrpd_new_backup
set event-options policy raise-metric then change-configuration commands "set policy-options policy-statement foo_subnet_export term 1 then metric add 100"
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
TMP=$(mktemp -d )
function finish {
openssl smime -encrypt -aes128 -in "$TMP/content" -to "${RECIPIENTS%,}" -subject "Root password change" -from "root <root@$(hostname -f)>" "$TMP"/cert* | sendmail -ti
rm -rf "$TMP"
}
trap finish EXIT
---
- name: Change the swap to given size in gigabytes
hosts: all
user: root
vars:
size: 4
tasks:
- name: find existing swap size
shell: lvs --noheadings --separator , --units g | grep swap_1 | cut -f 4 -d ,