Skip to content

Instantly share code, notes, and snippets.

A-OK
AWOL
Aaronic
Aaronical
Abbevillian
Aberdeen
Abyssinian
Acadian
Accadian
Achaean
@theycallmemac
theycallmemac / configuration.nix
Last active January 12, 2021 00:42
Deafult NixOS configuration file I use for automation.
{ modulesPath, pkgs, ... }: {
imports = [
"${modulesPath}/virtualisation/amazon-image.nix"
];
ec2.hvm = true;
ec2.efi = true;
environment.systemPackages = [
pkgs.git
];
}
def main():
with open("/proc/meminfo", "r") as f:
lines = f.readlines()
with open("/proc/cpuinfo", "r") as f:
info = f.readlines()
cpuinfo = [x.strip().split(":")[1] for x in info if "model name" in x]
cpu = []
for index, item in enumerate(cpuinfo):
cpu.append(str(index) + ": " + item)
f=open("/root/stats.txt","a+")
@theycallmemac
theycallmemac / botinfo
Last active September 18, 2019 15:38
botinfo
echo -e "Author: $(jq -r ".author" package.json)\n"
echo -e "Version: $(jq -r ".version" package.json)\n"
echo -e "Description: $(jq -r ".description" package.json)\n"
echo -e "Code: $(jq -r ".homepage" package.json)\n"
@theycallmemac
theycallmemac / weatherByLocation.sh
Created September 11, 2019 10:03
weatherByLocation.sh
#!/bin/bash
curl "wttr.in/$*" 2>&1 | grep -A 6 "Weather report" | sed '1,2d' |sed "s,\x1B\[[0-9;]*[a-zA-Z],,g"| sed -E 's/^.{15}//' > weather.summary
if [[ $(curl "wttr.in/$*" 2>&1 | grep "Oymyakon") == "so we have brought you to Oymyakon," ]];then
echo -e "Weather report for Oymyakon:\n"
else
echo -e "Weather report for $*:\n"
fi
summary=$(head -1 weather.summary)
temp=$(head -2 weather.summary | tail -1)
winds=$(head -3 weather.summary | tail -1)
# Literally taken from https://github.com/cpssd-students/steely/blob/master/steely/plugins/roomcheck.py
# so Tom Doyle gets the credit for this one not me, I just modified it to work as a command line tool
import datetime
import sys
import requests
import bs4
COMMAND = 'room'
BASEURL = 'https://www101.dcu.ie/timetables/feed.php'
@theycallmemac
theycallmemac / discordbot-uptime.js
Last active August 16, 2019 11:59
discordbot-uptime.js
const [ , , ...args ] = process.argv;
let totalSeconds = args[0];
let days = Math.floor(totalSeconds / 86400);
let hours = Math.floor(totalSeconds / 3600) - (days * 24);
totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60);
let seconds = Math.round(totalSeconds % 60);
console.log(`${days} days, ${hours} hours, ${minutes} minutes and ${seconds}
@theycallmemac
theycallmemac / flip.sh
Created July 21, 2019 07:58
A short bash script to simulate a coinflip.
#!/bin/bash
FLIP=$(($(($RANDOM%10))%2))
if [ $FLIP -eq 1 ];then
echo "heads"
else
echo "tails"
fi
### Keybase proof
I hereby claim:
* I am theycallmemac on github.
* I am mctastic (https://keybase.io/mctastic) on keybase.
* I have a public key whose fingerprint is AE04 0A91 9BE9 B7A0 0F18 3FFD 11AA 690D 0B7F 1D3E
To claim this, I am signing this object:
@theycallmemac
theycallmemac / weechat-slack-setup.md
Created October 4, 2017 19:05
A markdown file detailing how to connect your slack workspace and subsequent channels to weechat.

How to set up your slack channels on weechat

Add your teams workspace using the /server command.

/server add slack myteam.irc.slack.com

Next you need to turn on ssl using the /set command.

/set irc.server.slack.ssl on