Skip to content

Instantly share code, notes, and snippets.

View RhubarbSin's full-sized avatar

Rhubarb Sin RhubarbSin

View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::SSL;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(ssl_opts => {
verify_hostname => 0,
@RhubarbSin
RhubarbSin / blb-confluence.el
Last active November 11, 2021 04:36
Function for replacing contents of an Emacs Confluence buffer with text exported by org-confluence-export-as-confluence
(setq blb/confluence-page-sig "~/doc/confluence-rd-snippet.xml")
(defun blb/confluence-org-get-export ()
(interactive)
(confluence-toggle-page-content-type)
(let ((export-buffer (get-buffer "*org CONFLUENCE Export*")))
(buffer-swap-text export-buffer)
(kill-buffer export-buffer))
(confluence-toggle-page-content-type)
(save-excursion
(goto-char (point-max))
@RhubarbSin
RhubarbSin / rsyslog.conf
Created July 17, 2014 14:53
Example rsyslog.conf for rsyslog 3.22
$ModLoad imuxsock
$ModLoad imklog
#
# Set up queue to buffer messages if server goes down.
#
$WorkDirectory /var/spool/rsyslog
$ActionQueueType LinkedList
$ActionQueueFileName 192.168.0.42
$ActionResumeRetryCount -1
@RhubarbSin
RhubarbSin / my_grouped_dropdown.py
Created July 9, 2014 15:31
Subclass of web.py's GroupedDropdown that allows mixing option groups with plain options
import web
class MyGroupedDropdown (web.form.GroupedDropdown):
"""Subclass of GroupedDropdown that allows mixing option groups
with plain options, i.e. accepts tuples of strings as well as
tuples of tuples of strings.
>>> MyGroupedDropdown(name='example', args=(('Swedish Cars',
(('v', 'Volvo'), ('s', 'Saab'))), ('German Cars', (('m', 'Mercedes'),
@RhubarbSin
RhubarbSin / pg-update-seq.py
Created May 2, 2014 14:50
Update PostgreSQL's table sequences after importing data
#!/usr/bin/env python
"""Update PostgreSQL's table sequences after importing data from MySQL."""
import sqlobject
import psycopg2
uri = 'postgres://username:password@localhost/dbname'
connection = sqlobject.connectionForURI(uri)
@RhubarbSin
RhubarbSin / gist:8507377
Created January 19, 2014 16:46
An attempt to rewrite author/comitter name/email for all commits in a git repo
#!/bin/sh
git filter-branch --env-filter '
cn="Rhubarb Sin"
cm="rhubarbsin@gmail.com"
an="Rhubarb Sin"
am="rhubarbsin@gmail.com"
export GIT_AUTHOR_NAME="$an"
@RhubarbSin
RhubarbSin / sqlobject_foreignkey_id.py
Last active December 18, 2015 12:48
SQLObject foreign_keyID vs. foreign_key_ID
#!/usr/bin/env python
"""Demonstrate use of underscore in foreign key "q" attribute with Outer."""
from sqlobject import *
from sqlobject.sqlbuilder import *
class Foo(SQLObject):
bars = MultipleJoin('Bar')
@RhubarbSin
RhubarbSin / org-syntax-cheatsheet.org
Created September 6, 2012 18:33 — forked from wdkrnls/org-syntax-cheatsheet.org
Org-mode Syntax Cheat sheet

Markup Cheat sheet for Org-mode

Heading 1

Heading 2: Set a deadline and a schedule

[66%] Heading 3: a list with checkboxes

  1. [X] task 1
  2. [X] task 2
  3. [ ] task 3 (C-c C-c to toggle status of checkbox)