Skip to content

Instantly share code, notes, and snippets.

🐈
Scratching your code.

Adrian ThiefMaster

🐈
Scratching your code.
Block or report user

Report or block ThiefMaster

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View indico.conf
# vim: ft=python
SQLALCHEMY_DATABASE_URI = 'postgresql:///indico'
BASE_URL = 'https://YOURHOSTNAME.cern.ch'
DEBUG = True
# DISABLE_CELERY_CHECK = False
DB_LOG = True
SMTP_USE_CELERY = False
ROUTE_OLD_URLS = True
View flask-multipass_instructions.md

Thank you for helping us test the new LDAP provider for Indico.

Below you will find instructions on how to install and use the example application for testing. While this is a very simple application, it uses the same code as Indico 2.0 to perform LDAP operations.

Testing this application with the LDAP server you use for Indico will allow us to catch LDAP related bugs before we release Indico 2.0 or Flask-Multipass.

Prerequisites

Flask-Multipass requires Python 2.7 or newer. You can test it using:

python --version
View indico-1.9.9-1.9.10.sh
# use your actual postgres/zodb connection details here
export PG=postgresql:///indico
export ZODB=zeo://127.0.0.1:9675
# use the id of your "system" user. create one first if you have none
export JANITOR_UID=123
# specify the path to your indico archive dir
export ARCHIVE=/opt/indico/archive
# specify the name of the StorageBackends indico.conf entry pointing to fs:$ARCHIVE
export ARCHIVE_BACKEND=default
@ThiefMaster
ThiefMaster / indico_awesome_themes***__init__.py
Last active Jun 19, 2017
the `***` in the filenames are placeholders for `/` (which are not possible in gists)
@ThiefMaster
ThiefMaster / tmux-smartsplit.sh
Last active Apr 27, 2017
Automatically ssh to the current pane's target if applicable
View tmux-smartsplit.sh
#!/bin/bash
# tmux-smartsplit
# open a new tmux (split-)window which will automatically
# continue the existing ssh session if one exists
PID=$(tmux display-message -p -F "#{pane_pid}")
if [[ $(readlink /proc/$PID/exe) == $(which ssh) ]]; then
CHILD=$PID
else
CHILD=$(cat /proc/[0-9]*/stat | awk '$4 == '$PID' {print $1; exit}')
View delete_orphaned.sql
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);
@ThiefMaster
ThiefMaster / bash-to-zsh.py
Created Mar 19, 2015
simple script that converts a non-timestamped bash history to an extended zsh history
View bash-to-zsh.py
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()))
View dump_sql_stuff.py
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]
View indico-readonly.sql
-- All these commands must be executed as the owner of the object!
GRANT CONNECT ON DATABASE indico TO indico_ro;
ALTER DEFAULT PRIVILEGES GRANT SELECT ON TABLES TO indico_ro;
ALTER DEFAULT PRIVILEGES GRANT SELECT ON SEQUENCES TO indico_ro;
GRANT USAGE ON SCHEMA public TO indico_ro;
GRANT USAGE ON SCHEMA attachments TO indico_ro;
GRANT USAGE ON SCHEMA categories TO indico_ro;
GRANT USAGE ON SCHEMA indico TO indico_ro;
GRANT USAGE ON SCHEMA event_abstracts TO indico_ro;
GRANT USAGE ON SCHEMA event_paper_reviewing TO indico_ro;
@ThiefMaster
ThiefMaster / python.post-checkout.sh
Last active Aug 29, 2015
post-checkout githook which cleans up all pyc/pyc/__pycache__ files/folders. to enable, save as post-checkout in .git/hooks and chmod +x
View python.post-checkout.sh
#!/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)"
You can’t perform that action at this time.