This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
prev_head=$1 | |
new_head=$2 | |
checkout_type=$3 | |
[[ $checkout_type == '1' ]] || exit 0 | |
[[ $prev_head == $new_head ]] && exit 0 | |
cd "./$(git rev-parse --show-cdup)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from indico.util.console import cformat | |
colors = { | |
'fk': 'yellow!', | |
'pk': 'red!', | |
'ix': 'green!', | |
'ck': 'cyan!', | |
'uq': 'blue!' | |
} | |
def print_stuff(table): | |
t = db.Model.metadata.tables[table] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import sys | |
from time import time | |
def main(): | |
ts = int(time()) | |
for line in sys.stdin: | |
print(': {0}:0;{1}'.format(ts, line.rstrip())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMP TABLE orphaned_note_ids ON COMMIT DROP AS | |
(SELECT id FROM events.notes x WHERE x.event_id IS NOT NULL and NOT EXISTS | |
(SELECT 1 FROM events.events WHERE id = x.event_id)); | |
UPDATE events.notes SET current_revision_id = NULL WHERE id IN (SELECT id FROM orphaned_note_ids); | |
DELETE FROM events.note_revisions WHERE note_id IN (SELECT id FROM orphaned_note_ids); | |
DELETE FROM events.notes WHERE id IN (SELECT id FROM orphaned_note_ids); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"suc": true, | |
"data": { | |
"cityView": { | |
"name": "Metropolis", | |
"money": 673511, | |
"stone": 750, | |
"stone_capacity_percent": 75, | |
"food": 735, | |
"food_capacity_percent": 73, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class vRecur(icalendar.vRecur): | |
"""Fix vRecur so the frequency comes first""" | |
def ical(self): | |
# SequenceTypes | |
result = ['FREQ=%s' % self.types['FREQ'](self['FREQ']).ical()] | |
for key, vals in self.items(): | |
if key == 'FREQ': | |
continue | |
typ = self.types[key] | |
if not type(vals) in icalendar.prop.SequenceTypes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
import re | |
import sys | |
from errno import ENOENT, EINVAL | |
from stat import S_IFDIR, S_IFLNK | |
from fuse import FUSE, Operations, LoggingMixIn, FuseOSError | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AutoReviewComments | |
// @namespace benjol | |
// @version 1.2.0 | |
// @description Add pro-forma comments dialog for reviewing (pre-flag) | |
// @include http://*stackoverflow.com/questions* | |
// @include http://*stackoverflow.com/review* | |
// @include http://*stackoverflow.com/admin/dashboard* | |
// @include http://*serverfault.com/questions* | |
// @include http://*serverfault.com/review* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommandStorage(object): | |
"""Stores multi-part commands. | |
Performs fast lookups returning the command and any arguments which were | |
not part of the command. | |
>>> cs = CommandStorage() | |
>>> cs | |
<CommandStorage([])> | |
>>> cs['playlist off'] = 'func_playlist_off' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: fileencoding=utf8 | |
"""Privilege system. | |
Stores boolean privileges which can be put in nested groups. | |
By default all privileges "bubble", i.e. they enable all (bubbling) parent | |
groups. When a group is set in a privilege set all children are set to the | |
same state. Basically a group is considered active when it has at least one | |
bubbling privilege/group that is active. |