Skip to content

Instantly share code, notes, and snippets.

View stwalkerster's full-sized avatar

Simon Walker stwalkerster

View GitHub Profile
@stwalkerster
stwalkerster / sfnet2github.sh
Created May 17, 2011 17:18
SourceForge.net svn repo to github git repo import script

Licence (MIT Licence)

Copyright (c) 2011 Simon Walker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@stwalkerster
stwalkerster / deploy.sh
Created July 15, 2012 20:52
stwalkerster.net deploy script
#!/bin/bash
DEPLOY_HOSTNAME="metapod"
DEPLOY_CLUSTER="lon"
apt-get update
apt-get install puppet -q -y
hostname $DEPLOY_HOSTNAME
echo "domain $DEPLOY_CLUSTER.stwalkerster.net" > /etc/resolv.conf
echo "search $DEPLOY_CLUSTER.stwalkerster.net" >> /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
puppet agent -t --server puppet.srv.stwalkerster.net --certname $DEPLOY_HOSTNAME.$DEPLOY_CLUSTER.stwalkerster.net --waitforcert 60
-rw-r----- 1 root root 2629 Nov 25 06:26 eyeinthesky.log.7.gz
-rw-r----- 1 root root 2230542 Dec 2 03:12 helpmebot.log
-rw-r----- 1 root root 482161 Dec 1 06:51 helpmebot.log.1.gz
-rw-r----- 1 root root 523830 Nov 30 06:30 helpmebot.log.2.gz
-rw-r----- 1 root root 520576 Nov 29 06:32 helpmebot.log.3.gz
-rw-r----- 1 root root 530640 Nov 28 06:31 helpmebot.log.4.gz
-rw-r----- 1 root root 524881 Nov 27 06:38 helpmebot.log.5.gz
-rw-r----- 1 root root 518958 Nov 26 06:51 helpmebot.log.6.gz
-rw-r----- 1 root root 594351 Nov 25 06:28 helpmebot.log.7.gz
-rw-r----- 1 root root 131 Oct 15 13:31 hwclock-save.log.1.gz
public function hasright($username, $checkright) {
global $tsSQL;
if(isCheckuser($username) && $checkright == "Admin") {
return true;
}
$username = $tsSQL->escape($username);
$query = "SELECT * FROM acc_user WHERE user_name = '$username';";
$result = $tsSQL->query($query);
@stwalkerster
stwalkerster / gist:4282852
Created December 14, 2012 05:16
Helpmebot v3 :o Dragged out of the archives
Module Module1
#Region "constants and variables"
'get the connection stuff
Const server As String = "kubrick.freenode.net"
Dim client As New System.Net.Sockets.TcpClient(server, 8001)
Dim streamreader As New System.IO.StreamReader(client.GetStream)
Dim streamwriter As New System.IO.StreamWriter(client.GetStream)
CREATE
ALGORITHM=UNDEFINED
DEFINER=`acc`@`%.toolserver.org`
SQL SECURITY DEFINER
VIEW `closes` AS
select
concat('Closed ',`acc_emails`.`mail_id`) AS `CONCAT("Closed ",mail_id)`,
`acc_emails`.`mail_desc` AS `mail_desc`
from `acc_emails`
where
@stwalkerster
stwalkerster / postmanage.sh
Created December 28, 2012 22:30
Postfix queue management script
#!/bin/bash
app="whiptail --backtitle 'Postfix Queue Manager - stwalkerster.net Cluster' --clear --nocancel"
while true; do
queue=`ls /var/spool/postfix/hold/`
menulist=""
for i in $queue; do
Jan 30 16:42:15 metapod slapd[20445]: @(#) $OpenLDAP: slapd (Oct 17 2012 19:48:49) $#012#011buildd@panlong:/build/buildd/openldap-2.4.28/debian/build/servers/slapd
Jan 30 16:42:15 metapod slapd[20445]: ldif_read_file: checksum error on "/etc/ldap/slapd.d/cn=config/olcDatabase={0}config.ldif"
Jan 30 16:42:15 metapod slapd[20445]: ldif_read_file: checksum error on "/etc/ldap/slapd.d/cn=config/olcDatabase={1}hdb.ldif"
Jan 30 16:42:15 metapod slapd[20446]: hdb_db_open: database "dc=stwalkerster,dc=net": unclean shutdown detected; attempting recovery.
Jan 30 16:42:15 metapod slapd[20446]: slapd starting
Jan 30 16:42:15 metapod puppet-agent[17716]: (/Stage[main]/Ldap::Server/Service[ldap]/ensure) ensure changed 'stopped' to 'running'
Jan 30 16:42:27 metapod puppet-agent[17716]: Finished catalog run in 21.07 seconds
Jan 30 16:42:49 metapod kernel: slapd[20448]: segfault at 70 ip b76c0e79 sp b5df9820 error 4 in slapd[b7640000+12f000]
@stwalkerster
stwalkerster / create.sh
Created March 5, 2013 03:08
ACC stats graph
#!/bin/bash
STEP=300
HB=600
rrdtool create acc.rrd --start `date +%s` --step $STEP DS:open:GAUGE:$HB:0:U DS:admin:GAUGE:$HB:0:U DS:checkuser:GAUGE:$HB:0:U DS:hold:GAUGE:$HB:0:U RRA:AVERAGE:0.5:1:288 #RRA:AVERAGE:0.5:12:24 RRA:AVERAGE:0.5:288:31
#!/usr/bin/php
<?php
$cmd = "/usr/lib/update-notifier/update-motd-reboot-required";
$out = array();
$returnvar = 0;
$return = exec($cmd, $out, $returnvar);