Skip to content

Instantly share code, notes, and snippets.

View DazWorrall's full-sized avatar

Darren Worrall DazWorrall

  • UK
  • 21:28 (UTC +01:00)
View GitHub Profile
@DazWorrall
DazWorrall / webtest.plug
Created January 30, 2014 17:34
Just a quick play getting messages into chatrooms over HTTP user errbot (https://github.com/gbin/err)
[Core]
Name = WebTest
Module = webtest
[Documentation]
Description = Testing!
@DazWorrall
DazWorrall / foo.lua
Created March 21, 2014 16:42
Hacking prosody mod_post_msg to support announcing to MUC
if message and message.attr.type == "groupchat" then
local m = hosts[module.host].modules;
local mu = m.muc;
local room = mu.rooms[message.attr.to];
if not room then return 414; end -- better code here. 404?
message.attr.from = message.attr.to;
module:log("debug", "Sending %s", tostring(message));
room:broadcast_message(message);
return 201;
@DazWorrall
DazWorrall / magento.diff
Created May 16, 2014 13:40
Magento 1.9.0.0/1.9.0.1 diff
diff -ur magento-1.9.0.0/app/Mage.php magento-1.9.0.1/app/Mage.php
--- magento-1.9.0.0/app/Mage.php 2014-05-07 15:58:51.000000000 +0100
+++ magento-1.9.0.1/app/Mage.php 2014-05-14 17:03:36.000000000 +0100
@@ -171,7 +171,7 @@
'major' => '1',
'minor' => '9',
'revision' => '0',
- 'patch' => '0',
+ 'patch' => '1',
'stability' => '',
@DazWorrall
DazWorrall / local_decoder.xml
Created August 13, 2014 15:00
OSSEC decoder for the apache vhost_combined_plus log format (debianism?)
<decoder name="vhost-accesslog">
<type>web-log</type>
<prematch>^\S+:\d+ </prematch>
<regex offset="after_prematch">(\d+.\d+.\d+.\d+) \S+ \S+ [\S+ \S\d+] </regex>
<regex>"\w+ (\S+) HTTP\S+ (\d+) </regex>
<order>srcip, url, id</order>
</decoder>
@DazWorrall
DazWorrall / console.log
Created November 11, 2014 20:43
Connectivity issues...
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.2.0-60-virtual (buildd@toyol) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #91-Ubuntu SMP Wed Feb 19 04:13:28 UTC 2014 (Ubuntu 3.2.0-60.91-virtual 3.2.55)
[ 0.000000] Command line: LABEL=cirros-rootfs ro console=tty1 console=ttyS0
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
@DazWorrall
DazWorrall / run.py
Last active August 29, 2015 14:09
get_instance_disk_info behaviour changes breaks live migration
from lxml import etree
import logging
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)
LOG.addHandler(logging.StreamHandler())
_ = lambda x: x
def juno(xml):
instance_name = 'instance-00000001'
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> last_christmas = datetime(2014,12,25)
>>> next_christmas = datetime(2015,12,25)
>>> today = datetime.today()
>>> (today - last_christmas).days
181
Thu Jul 23 20:59:08 2015 UTC - Dongle firmware /home/steam/.local/share/Steam/ubuntu12_32/../controller_base/d0ggle.bin loaded, version 1435869091.
Thu Jul 23 20:59:09 2015 UTC - Refresh rate: 60.00
Thu Jul 23 20:59:09 2015 UTC - Effective rate: 59.75
Thu Jul 23 20:59:09 2015 UTC - Video size: 1920x1080, output size: 1920x1080
Thu Jul 23 20:59:09 2015 UTC - Server available at address: 172.17.0.13:27031
Thu Jul 23 20:59:09 2015 UTC - Connecting to server at address: 172.17.0.13:27031
Thu Jul 23 20:59:09 2015 UTC - Session state Idle -> Connecting
Thu Jul 23 20:59:09 2015 UTC - Session state Connecting -> Authenticating
Thu Jul 23 20:59:09 2015 UTC - Video size: 1920x1080, output size: 1920x1080
Thu Jul 23 20:59:09 2015 UTC - Session state Authenticating -> Negotiating
@DazWorrall
DazWorrall / test.yml
Created August 10, 2015 15:31
cs_ip_address tests
---
- hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Setup account
local_action:
module: cs_account
name: Jane Bloggs
username: jbloggs
- hosts: localhost
gather_facts: false
connection: local
vars:
network_name: My Network
tasks:
- name: Create network
local_action:
module: cs_network
name: "{{ network_name }}"