Skip to content

Instantly share code, notes, and snippets.

@stevommmm
stevommmm / mcServ.py
Created November 1, 2012 00:03
Minecraft server list ping handler
#!/usr/bin/python
import asyncore, socket, pickle
class Server(asyncore.dispatcher):
def __init__(self, host, port):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.bind(('', port))
self.listen(1)
@stevommmm
stevommmm / addrs.py
Created January 16, 2013 10:33
v6 lovebots
import array
import socket
import fcntl
import struct
import re
def getArchitecture():
return __import__("platform").architecture()[0]
def __get_ip_address(ifname):
@stevommmm
stevommmm / check_many_ports.py
Created April 15, 2013 23:11
Check if one in multiple ports are active
#!/usr/bin/env python
import logging
import socket
import sys
logging.basicConfig(level=logging.INFO)
def portcheck(host, port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@stevommmm
stevommmm / munin-apache.conf
Last active December 17, 2015 04:29
Munin conf
# Enable this for template generation
Alias /munin /var/www/munin
# Enable this for cgi-based templates
Alias /munin-cgi/static /var/www/munin/static
ScriptAlias /munin-cgi /usr/lib/cgi-bin/munin-cgi-html
#ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/cgi-bin/munin-cgi-graph
ScriptAlias /cgi-bin/munin-cgi-graph /usr/lib/cgi-bin/munin-cgi-graph
#Alias /munin-cgi/static /var/cache/munin/www/static
@stevommmm
stevommmm / check_mds_log.py
Created May 13, 2013 06:28
Check cisco mds log files on remote switches
#!/usr/bin/python
from datetime import datetime, timedelta
import logging
import subprocess
import sys
import re
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARN)
# '(year ) (Month) (day ) (timestamp ) (sch) (err): (ed)
@stevommmm
stevommmm / gist:5770048
Created June 12, 2013 23:32
pygmentme.py
#!/usr/bin/env python
import logging
import os
from pygments.util import ClassNotFound
from pygments import highlight
from pygments.lexers import guess_lexer_for_filename
from pygments.formatters import HtmlFormatter
logging.basicConfig(level=logging.DEBUG)
@stevommmm
stevommmm / config.yml
Created June 13, 2013 07:23
config.yml
vanished: []
fullvanished: []
modmode: []
allow:
flight: true
bperms:
enabled: false
modgroup: Moderators
modmodegroup: ModMode
@stevommmm
stevommmm / BlockEventNotice.java
Created August 28, 2013 20:32
Old slow block rollback code
package com.c45y.slowblock;
import org.bukkit.Material;
import org.bukkit.block.Block;
/**
*
* @author c45y
*/
public class BlockEventNotice {
@stevommmm
stevommmm / gist:8857493
Created February 7, 2014 04:48
creative resolve durations
[1281, 1276, 1772, 1528, 2174, 5676, 5759, 9910, 40545, 35680, 89565, 99986, 119149, 12379, 3887, 9921, 30199, 38191, 28001, 37986, 7241, 5834, 1491, 97940, 102724, 6135, 1443, 608, 5814, 4417, 1111, 7239, 31675, 26012, 1772, 5565, 5257, 11019, 711, 1229, 5234, 563, 138417, 11306, 62774, 12509, 55030, 19385, 23992, 1289, 7151, 71954, 1978, 7197, 9858, 9462, 8535, 4389, 274, 611, 1526, 11666, 3954, 26049, 55283, 2318, 8312, 144246, 37897, 2705, 14232, 548, 2327, 2561, 480, 38242, 2414, 68837, 76649, 65425, 375, 554, 1557, 18938, 7135, 1336, 5156, 451, 558, 169094, 718, 814, 5514, 5000, 1728, 2553, 15185, 628, 8269, 25990, 37099, 6688, 10292, 21680, 3328, 2666, 1582, 1399, 64631, 10770, 1208, 1052, 6363, 1465, 22170, 36736, 83726, 83041, 89638, 20629, 20793, 32786, 31910, 78582, 6454, 154339, 60411, 91382, 5111, 2665, 764, 1301, 5708, 8142, 600, 3557, 8705, 3503, 15823, 17153, 18590, 18890, 24681, 1189, 547, 302, 6792, 1697, 7245, 39529, 40033, 43813, 1810, 571, 15326, 2472, 5279, 10317, 12855, 25590, 32359, 32
@stevommmm
stevommmm / reflectOutBackend.php
Last active August 29, 2015 13:57
Remove ability to set passwords via authentication backends in OwnCloud
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
$myClassReflection = new ReflectionClass(get_class(OC::$server->getUserManager()));
$secret = $myClassReflection->getProperty('backends');
$secret->setAccessible(true);
foreach($secret->getValue(OC::$server->getUserManager()) as $bkend) {
// var_dump($bkend);
$lclrefclass = new ReflectionClass($bkend);
$s = $lclrefclass->getProperty('possibleActions');
$s->setAccessible(true);