Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
why is this a thing

Ben Harris benharri

💭
why is this a thing
View GitHub Profile
@benharri
benharri / Program.cs
Last active Apr 4, 2022
ircpuzzles 2021 08
View Program.cs
namespace morse;
public enum Morse
{
Dot,
Dash,
Space,
WordSeparator,
None
}
View gist:bc67840cca9b76ecc38acd1d8b0b074c
### Keybase proof
I hereby claim:
* I am benharri on github.
* I am bharris (https://keybase.io/bharris) on keybase.
* I have a public key ASC-5TnEOCQ1QLf9A9p_sH4_G2VPj20VjXuLQCx4Y9uhwwo
To claim this, I am signing this object:
View migrate-machine.sh
#!/bin/bash
rsync -aHxv --numeric-ids \
--exclude=/etc/fstab \
--exclude=/etc/network/* \
--exclude=/proc/* \
--exclude=/tmp/* \
--exclude=/sys/* \
--exclude=/dev/* \
--exclude=/mnt/* \
View get_new_users.sh
#!/usr/bin/env bash
ssh tilde.team -- unshadow /etc/passwd /etc/shadow \
| awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", $1,$2,$3,$4,$5,$6,$7); }' > new_passwd
last_user=$(tail -n1 /etc/passwd | cut -f1 -d:)
sed -i "" "1,/^${last_user}/d" new_passwd
if [[ $(wc -l < new_passwd) -lt 1 ]]; then
echo no new users
View bsd-users.sh
# on tilde.team as root
unshadow /etc/passwd /etc/shadow > linux_passwd
cat linux_passwd | awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", $1,$2,$3,$4,$5,$6,$7); }' > new_passwd
# edit new_passwd to include only new users
# now on bsd box, switch to root shell
scp tilde.team:/root/new_passwd .
cat new_passwd >> /etc/master.passwd
pwd_mkdb -p /etc/master.passwd
View bsd-from-tilde.sh
#!/bin/bash
ssh tilde.team "awk -F: '($3>=500) && ($3!=65534)' /etc/passwd" > /tmp/passwd.new
ssh tilde.team "awk -F: '($3==100) && ($3!=65534)' /etc/group" > /tmp/group.new
ssh tilde.team "awk -F: '($3>=500) && ($3!=65534)' /etc/passwd | grep -f - /etc/shadow" > /tmp/shadow.new
cat /tmp/passwd.new | awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", $1,$2,$3,$4,$5,$6,$7); }' > /tmp/masterpasswd.new
cat /tmp/passwd.new >> /etc/passwd && sort -u /etc/passwd > /etc/passwd
cat /tmp/group.new >> /etc/group && sort -u /etc/group > /etc/group
cat /tmp/shadow.new >> /etc/shadow && sort -u /etc/shadow > /etc/shadow
View scr.fish
function scr
set -l filename ~/Pictures/scr_(date +%s).png
maim -s $filename
scp $filename thor:pub/screenies/. >/dev/null
echo -n "https://bhh.sh/pub/screenies/"(basename $filename) | xclip -selection clipboard
xclip -selection clipboard -o
end
View 2018-04-09_14-38-09.txt
[Unit]
Description=The Lounge IRC client
After=thelounge.service
[Service]
Type=simple
ExecStart=/home/ben/workspace/thelounge/index.js start
User=ben
Group=ben
Restart=always
View thelounge_custom.css
@import url('https://fonts.googleapis.com/css?family=IBM+Plex+Mono');
* {
font-family: 'IBM Plex Mono', monospace;
font-size: 15px;
}
#chat .from .user::before,
#chat .from .user::after,
#sidebar .chan.query::before,
View oragono-run.stdout
2018-03-28T17:58:54Z : info : startup : Oragono v0.10.3 starting
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x6d2ea2]
goroutine 1 [running]:
github.com/oragono/oragono/irc.(*Config).TLSListeners(0xc420152380, 0xc4201651c8)
/home/dan/goenv/src/github.com/oragono/oragono/irc/config.go:333 +0x102
github.com/oragono/oragono/irc.(*Server).setupListeners(0xc420097680, 0xc420152380)
/home/dan/goenv/src/github.com/oragono/oragono/irc/server.go:1466 +0x43
github.com/oragono/oragono/irc.(*Server).applyConfig(0xc420097680, 0xc420152380, 0x1, 0xc420153180, 0x65)