Skip to content

Instantly share code, notes, and snippets.

@Soulflare3
Soulflare3 / commit.sh
Created September 29, 2015 01:08
Quick commit script I wrote to save time
#! /bin/sh
echo "" > /home/commitmessage
nano /home/commitmessage
cd /home/ChronalRobot
git add .
git commit -F /home/commitmessage
git push --repo=http://github.com/Soulflare3/ChronalRobot
@Soulflare3
Soulflare3 / noDonate.user.js
Last active September 15, 2015 20:41 — forked from maybecryptic/noDonate.user.js
noDonate
// ==UserScript==
// @name noDonate
// @namespace 9000
// @description Removes donate button from plug.dj
// @include https://plug.dj/*
// @version 1
// @grant none
// ==/UserScript==
var url = document.location.href;
[core]
nick = [botname]
user = [bot username]
host = [irc network]
use_ssl = False
port = 6667
owner = [used for !owner]
channels = [comma separated channel list]
server_password = [serverpass]
prefix = \!
@Soulflare3
Soulflare3 / README.md
Created August 19, 2015 19:44
hmh_bot management scripts | These are all the scripts I use to run hmh_bot for http://twitch.tv/handmade_hero

update.sh - is the main "startup" script. It simply tells the bot to run a backup, check for updates via git, and then start

backup.sh - does what it says on the tin. It backs up all .db and .cfg files (the only important files, the rest can be re-obtained via git). I also have this line in crontab for it: @daily /home/backup.sh >/home/logs/hmhbackup.log 2>/home/logs/hmhbackuperror.log so backup.sh runs whenever the bot gets updated, as well as once a day. I have not yet set a limit on how many backups to retain.

willie.sh - This is a heavily modified script that I've had for a few years, and it's sort of "evolved" as requirements appeared. I never really added "graceful" stopping. As of now it makes sure python has permission to read and write to the db (perms overkill, I was lazy) and then starts 2 copies of willie, first making sure their previous copies are no longer running.

startwillie.sh startwilliequake.sh

@Soulflare3
Soulflare3 / backup.sh
Last active August 29, 2015 14:27
Heavily revised backup script
#! /bin/bash
echo Backing up HMH_bot
today=$(date +%Y-%m-%d);
time=$(date +%k%M);
backupfolder="/home/backups/hmhbot/$today/$time"
set -f
backupfolder=$(printf '%s' $backupfolder)
set +f
# http://stackoverflow.com/a/13661348
@Soulflare3
Soulflare3 / bot.php
Created August 13, 2015 02:26
Partial of Bot.php | DB Query
$db = new SQLite3('/home/ChronalRobot/handmade.db');
if(!$db)
{
echo $db->lastErrorMsg();
}
$prerender .= "</section><table cellpadding=\"5\" class=\"heavyTable\"><thead><tr><th width=\"10%\">ID</th><th width=\"80%\">Quote</th><th width=\"10%\">Timestamp</th></tr></thead><tbody>";
$results = $db->query('SELECT id, text, timestamp FROM quote');
while ($row = $results->fetchArray())
{
@Soulflare3
Soulflare3 / pep8 complaints
Created June 25, 2015 04:33
And this is why I made the .pep8 gist
λ pep8 xstream.py
xstream.py:14:1: W191 indentation contains tabs
xstream.py:15:1: W191 indentation contains tabs
xstream.py:16:1: W191 indentation contains tabs
xstream.py:17:1: W191 indentation contains tabs
xstream.py:18:1: W191 indentation contains tabs
xstream.py:19:1: W191 indentation contains tabs
xstream.py:20:1: W191 indentation contains tabs
xstream.py:21:1: W191 indentation contains tabs
xstream.py:22:1: W191 indentation contains tabs
@Soulflare3
Soulflare3 / .pep8
Last active August 29, 2015 14:23
~/.config/.pep8 || /home/.pep8
[pep8]
ignore=W191,E302,E501
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import xchat, urllib
__module_name__ = "pyLmgtfy"
__module_version__ = "0.1"
__module_description__ = "Make an \"Let me Google That For You\" url and send it to current channel"
__module_author__ = "initbrain"
@Soulflare3
Soulflare3 / startup.bat
Last active August 29, 2015 14:23
Windows Startup File
@echo off
echo Executing startup tasks
echo Loading virtual drives
subst Z: C:\Users\Robert\Documents\spawncamping-octo-bugfixes
subst Y: C:\CMD
subst X: C:\Users\Robert
elevate64 subst Z: C:\Users\Robert\Documents\spawncamping-octo-bugfixes
elevate64 subst Y: C:\CMD
elevate64 subst X: C:\Users\Robert