Skip to content

Instantly share code, notes, and snippets.

View kogakure's full-sized avatar
🏠
Working from home

Stefan Imhoff kogakure

🏠
Working from home
View GitHub Profile
@kogakure
kogakure / fabfile.py
Created December 9, 2008 17:50
Python: Fabric (< 0.9) – Server-Backup
#!/usr/bin/python
# -*- coding: utf-8 -*-
from time import *
lt = localtime()
config.fab_hosts = ['server.com'],
config.fab_host = 'server.com',
config.fab_user = 'user',
config.postgres_bin = '/usr/local/pgsql/bin',
@kogakure
kogakure / fabfile.py
Created December 9, 2008 17:58
Python: Fabric (< 0.9) – SVN-Project
#!/usr/bin/python
# -*- coding: utf-8 -*-
config.project = 'domain.de' # Name des Projektes
config.project_type = 'websites' # websites, intern, previews, user/username
config.svn_repos = '/server/svn/repos/online' # Pfad zu den Repositorys
config.svn_url = 'svn://server.admin/online' # SVN-URL
config.svn_passwd = '/server/svn/repos/online/passwd' # Pfad zur passwd
config.working_dir = '$HOME/Projekte/Kunden' # Pfad zum lokalen Arbeitsordner
config.fab_hosts = ['server.admin'] # Host
@kogakure
kogakure / gist:54469
Created January 29, 2009 08:34
PHP: Typolight Form-Widget-Änderungen
<?php if ($this->hasError): ?>
<h3 class="error"><?php echo $this->getErrorAsString(); ?></h3>
<?php endif; ?>
<p>
<?php echo $this->generateLabel(); ?>
<?php echo $this->generate(); ?>
</p>
@kogakure
kogakure / git_fsck.py
Created February 4, 2009 15:13
Python: Git maintenance scripts
#!/usr/bin/python
import os
import os.path
from subprocess import call
if __name__ == "__main__":
apps_dir = os.path.abspath('.')
for app_name in os.listdir(apps_dir):
app_dir = os.path.abspath(os.path.join(apps_dir, app_name))
git_path = os.path.join(app_dir, '.git')
@kogakure
kogakure / fabfile.py
Created February 18, 2009 16:23
Python: Fabric (0.9+) – Deploying a Django-Project
#!/usr/bin/python
# -*- coding: utf-8 -*-
from fabric.api import env
env.hosts = ['host.com']
env.user = 'user' # Can also be written in ~/.fabricrc (user = <username>)
env.server_path = '/home/user/django/apache2/bin'
env.project_path = '/home/user/django/project'
env.memcached_ip = 'IP'
@kogakure
kogakure / git-repo.sh
Created February 22, 2009 09:25
Bash: Create an exportable bare git repository
#!/bin/bash
mkdir $1.git
cd $1.git
git --bare init --shared
touch GITWEB_EXPORT_OK
touch git-daemon-export-ok
git --bare update-server-info
chmod a+x hooks/post-update
@kogakure
kogakure / gist:70735
Created February 26, 2009 08:19
Bash: Install GetBundles for TextMate
mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
osascript -e 'tell app "TextMate" to reload bundles'
@kogakure
kogakure / vhost.sh
Created March 4, 2009 10:09 — forked from trey/vhost.sh
Bash: Create virtual hosts with `sudo vhost site-name` (Mac OSX Leopard). By Jason Tan.
#!/bin/sh
ME=your-username
DIR=/Users/$ME/Sites/$1
if [ ! -d $DIR ]
then
sudo -u $ME mkdir $DIR
sudo -u $ME touch $DIR/index.php
echo "<h1>$1</h1>" >> $DIR/index.php
fi
@kogakure
kogakure / fontsize.py
Created March 4, 2009 10:38
Python: Simple calculator for target font-size (CSS) with em
#!/usr/bin/python
# -*- coding: utf-8 -*-
def fontsize(base_fontsize, target_fontsize, lineheight):
lineheight_px = base_fontsize * lineheight
target_lineheight = lineheight_px / target_fontsize
target_fontsize_em = 1.0 / base_fontsize * target_fontsize
target_lineheight = round(target_lineheight, 4)
target_fontsize_em = round(target_fontsize_em, 4)
return "###################\nfont-size: %sem\nline-height: %s\nmargin-bottom: %s\n###################" % (target_fontsize_em, target_lineheight, target_lineheight)
@kogakure
kogakure / gist:79851
Created March 16, 2009 12:01
Bash: Get rid of those nasty files from Frontpage, WSFTP, etc.
#!/bin/bash
find . -name _vti_cnf -exec rm -rf {} \;
find . -name _borders -exec rm -rf {} \;
find . -name _private -exec rm -rf {} \;
find . -name _vti_pvt -exec rm -rf {} \;
find . -name _vti_txt -exec rm -rf {} \;
find . -name _vti_script -exec rm -rf {} \;
find . -name .DS_Store -exec rm -rf {} \;
find . -name WS_FTP.LOG -exec rm -rf {} \;