Skip to content

Instantly share code, notes, and snippets.

Avatar
💙
Fedora Linux

Carl Bennett carlbennett

💙
Fedora Linux
View GitHub Profile
View Dark UPS Tracker.css
/**
* Dark UPS Tracker v0.1
* <https://gist.github.com/carlbennett/5569ae5c5217eb51f1dbd0d5ff848cfa>
*
* Written by Carl Bennett <carl@carlbennett.me>
* You are hereby free to use this code under the MIT license.
* 14 August 2020
*
* Official UPS Orange Color: #f7be00
*/
@carlbennett
carlbennett / certgen.sh
Last active May 27, 2020
Place this file in its own directory and run it. It generates the certificate files in its current directory.
View certgen.sh
#!/usr/bin/env bash
# vim: set colorcolumn=:
set -e -o pipefail
[ -z "${TERM}" ] && echo 'Error: TERM not set, this script is exclusively interactive!' 1>&2 && exit 1
echo -e '\e[1;32mCertificate Generator\e[0m'
HOSTNAMES=()
@carlbennett
carlbennett / email-to-discord.php
Last active Sep 27, 2019
A php script that takes an email formatted as a POST form and turns it into a Discord webhook
View email-to-discord.php
<?php
namespace CarlBennett;
use \DateTime;
use \DateTimeZone;
use \Exception;
use \StdClass;
const GRAVATAR_BASE = 'https://secure.gravatar.com/avatar/';
@carlbennett
carlbennett / php-syntax-pre-commit.sh
Created Oct 24, 2018
Checks for PHP syntax errors in a git pre-commit hook
View php-syntax-pre-commit.sh
#!/bin/bash
# Load the PHP environment so we can use php.
source /opt/remi/php72/enable
if [ -z "$PHP_BIN" ]
then
PHP_BIN=php
fi
@carlbennett
carlbennett / discordwebhookrelay.service
Created Oct 13, 2018
Discord Webhook Relay for Grafana (deprecated now that Grafana has this built-in)
View discordwebhookrelay.service
[Unit]
Description=webhookRelay.js - a Slack to Discord webhook relay for Grafana
Documentation=https://gist.github.com/brussell98/a865ecc2284e958226596accc852ee28
After=network.target
[Service]
Type=simple
User=nobody
ExecStart=/usr/bin/node /opt/discordWebhookRelay/webhookRelay.js
Restart=on-failure
@carlbennett
carlbennett / system-update.sh
Created Jul 21, 2018
Updates the system using either dnf or yum (whichever's available)
View system-update.sh
#!/bin/sh
/usr/bin/yum --version | /usr/bin/grep dnf >/dev/null 2>&1
[ $? -eq 0 ] && DNF=1 || DNF=0
if [ $DNF -eq 0 ]; then
/usr/bin/yum update -y
else
/usr/bin/dnf update -y --refresh
fi
View ciphertest.sh
#!/usr/bin/env bash
# Credit: https://superuser.com/a/224263
# OpenSSL requires the port number.
SERVER=$1
DELAY=0.2
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
@carlbennett
carlbennett / dtconvert.php
Created Apr 23, 2018
Usage: ./dtconvert.php <timestamp> <to-timezone>
View dtconvert.php
#!/usr/bin/env php
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
if (php_sapi_name() !== "cli") {
http_response_code(500);
exit("Must be ran by php-cli");
}
if ($argc < 3) {
exit(
View kernel-optimizations-for-network.txt
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
@carlbennett
carlbennett / resolv.conf
Created Jul 26, 2016
A list of nameservers to use in case of emergency
View resolv.conf
; Google DNS:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
; OpenDNS:
nameserver 208.67.222.222
nameserver 208.67.222.220
nameserver 2620:0:ccc::2
nameserver 2620:0:ccd::2