Skip to content

Instantly share code, notes, and snippets.

@endofline
endofline / example_presence.py
Created July 19, 2015 12:13
Hangoutsbot Watermark & Typing Fragment
import datetime, time
import hangups
import plugins
def _initialise(bot):
plugins.register_admin_command(["watermark", "typing"])
def watermark(bot, event, *args):
@endofline
endofline / unittest_memoryusage.py
Created July 26, 2015 11:25
Rough Memory Usage Estimate for Hangoutsbot
import logging, os, sys, resource
import psutil # pip3 install psutil
import plugins
logger = logging.getLogger(__name__)
@endofline
endofline / test_a.py
Created February 15, 2017 14:37
subverting imported libraries
# test_a.py
# in the bot, this represents the new hangups library
this_is_a_constant = 'ABCD'
def print_constant():
print(repr(this_is_a_constant))
@endofline
endofline / unittest_reportresource.py
Last active April 20, 2017 08:00
hangoutsbot cpu usage logger
import asyncio
import logging
import time
import os
logger = logging.getLogger(__name__)
import plugins
@endofline
endofline / rsws-banned.py
Last active July 24, 2017 02:46
really simple web server (rsws) serving singlepage.html
#!/usr/bin/python
import logging
logging.basicConfig(filename='rsws.log',level=logging.DEBUG)
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class S(BaseHTTPRequestHandler):
def _set_headers(self):