Skip to content

Instantly share code, notes, and snippets.

View sassman's full-sized avatar
🦀
rust ❤️

Sven Kanoldt sassman

🦀
rust ❤️
View GitHub Profile
@sassman
sassman / database
Created September 21, 2010 10:49
vhosts examples and snippets
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => ':user',
'password' => ':password',
'database' => ':database',
@sassman
sassman / vhost-zend
Created April 12, 2011 15:29
vhost default universal template
<VirtualHost *:80>
ServerName :servername
ServerAlias :serveralias
DocumentRoot /var/www/:appname/public
# Possible values include: debug, info, notice, warn, error, crit,
LogLevel warn
ErrorLog /var/www/:appname/log/apache-error.log
CustomLog /var/www/:appname/log/apache-access.log combined
@sassman
sassman / trac-component-report
Created January 10, 2012 12:58
trac related stuff
SELECT p.value AS __color__,
'Component '||component AS __group__,
id AS ticket, summary, milestone, version, t.type AS type,
owner, status,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE status <> 'closed'
@sassman
sassman / print.desktop
Created December 7, 2012 19:43
KDE4 Dolphin/Konquerer Actions Menu >> "Print this file" as service menu entry under "Actions"
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/pdf;application/ps;
Version=1.0.0
Encoding=UTF-8
Actions=Print
[Desktop Action Print]
Name=Print this file
@sassman
sassman / mount-me
Created December 8, 2012 12:41
mount-me: can be places in a folder that is mountable then dolphin gets refresh after mounting
#!/bin/bash
mount $PWD
dbus="qdbus"
reload="/dolphin/Dolphin_1/actions/reload org.qtproject.Qt.QAction.trigger"
# sample
# qdbus org.kde.dolphin-3696 /dolphin/Dolphin_1/actions/reload org.qtproject.Qt.QAction.trigger
for i in $(pgrep dolphin); do
$($dbus "org.kde.dolphin-$i" $reload)
done
@sassman
sassman / settings-logging.py
Last active December 10, 2015 07:08
some useful django snippets for a smooth project start
# this is an extract of only loggin related stuff
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
PATH_DATA = os.path.join(ROOT_PATH, 'data')
PATH_LOG = os.path.join(PATH_DATA, 'logs')
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
@sassman
sassman / url-shortener.py
Created April 12, 2013 22:09
a small tiny cli wrapper to goole url shortener api
#!/usr/bin/python
import json, sys, urllib2
url = sys.argv[1]
apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
data = {
'longUrl' : url
}
req = urllib2.Request('https://www.googleapis.com/urlshortener/v1/url?key='+apiKey)
@sassman
sassman / post_list.html
Last active January 2, 2016 05:39
Filter by "q" get parameter as mixin for CBV
{% extends 'layouts/backend.html' %}
{% load i18n %}
{% block body %}
<div class="row">
<div class="col-md-6">
<form id="omni-form" action="{% url 'post_list' %}" method="GET" class="form-inline" role="form">
<div class="input-group">
<label class="sr-only" for="omnisearch">{% trans 'Search for posts' %}</label>
<input type="text" name="q" class="form-control" id="omnisearch"
@sassman
sassman / install-setuptools.sh
Created February 9, 2014 15:56
install setuptools for jython 2.7 manually
#!/bin/bash
set -e
cd /tmp
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-2.2.tar.gz
tar -xzf setuptools-2.2.tar.gz
cd setuptools-2.2
sudo jython27 setup.py install --prefix=/opt/jython27
@sassman
sassman / jquery.csrf.js
Created March 1, 2014 23:19
django csrftoken ajax support for jquery usage: $.csrfAjaxSupport(); on load
(function ($) {
var cookieName = 'csrftoken';
var xHeaderName = 'X-CSRFToken';
var csrfSafeMethod = function (method) {
return /^(GET|HEAD|OPTIONS|TRACE)$/.test(method);
};
var getCookie = function (cookie) {