Skip to content

Instantly share code, notes, and snippets.

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

Andrey Moskalenko andrulik

🏠
Working from home
View GitHub Profile
# Geany's snippets configuration file
[Python]
for=for i in xrange(%cursor%):\n\t
doc=""" %cursor% """\n
elif=elif %cursor%:\n\t
else=else:\n\t%cursor%
if=if %cursor%:\n\t
from=from %cursor% import \n
main=if __name__ == '__main__':\n\t%cursor%
class=class %cursor%(object):\n\t""" Class doc """\n\t\n\tdef __init__ (self):\n\t\t""" Class initialiser """\n\t\tpass
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the
"Europe/Andorra",
"Asia/Dubai",
"Asia/Kabul",
"America/Antigua",
"America/Anguilla",
"Europe/Tirane",
"Asia/Yerevan",
"America/Curacao",
"Africa/Luanda",
"Antarctica/McMurdo",
@andrulik
andrulik / dropbox_client.sh
Created April 4, 2010 07:57
These are two scripts that enable you to remote control a PC using Dropbox
#!/bin/bash
touch input.txt
touch output.txt
echo -n "Enter Command: "
read INCOM
echo "$INCOM" > input.txt
while [ -f input.txt ];do
import sys
from time import time
from collections import defaultdict
t = time()
w = defaultdict(set)
[w["".join(sorted(s.strip().lower()))].add(s) for s in open(sys.argv[1])]
for i, l in w.iteritems():
print "".join(l)
print time()-t,'s'
#!/bin/zsh
# Copyleft 2010 paradoxxxzero All wrongs reserved
# With contribution from James Ahlborn
# https://gist.github.com/752727
# Fork of https://gist.github.com/586698 by nicoulaj / dingram / roylzuo ...
# From http://www.zsh.org/mla/users/2010/msg00692.html
# Token types styles.
# See http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@andrulik
andrulik / async_psycopg2.py
Created January 23, 2012 22:35 — forked from FSX/async_psycopg2.py
A module for asynchronous PostgreSQL queries in Tornado.
#!/usr/bin/env python
__author__ = 'Frank Smit <frank@61924.nl>'
__version__ = '0.1.0'
import functools
import psycopg2
from tornado.ioloop import IOLoop, PeriodicCallback
@andrulik
andrulik / get-packages.ps1
Created February 22, 2012 19:10 — forked from vansha/get-packages.ps1
Download all packages for the solution via NuGet
$scriptDir = split-path $script:MyInvocation.MyCommand.Path
$nuget = "$scriptDir\tools\NuGet.exe"
$packagesDir = "$scriptDir\src\Packages"
$packagesConfigs = get-content "$packagesDir\repositories.config" `
| select-string -pattern "<repository path=" `
| foreach { $_ -replace "\s*<repository path=""", """$packagesDir\" } `
| foreach { $_ -replace "\s*/>" }
foreach ($pathToPackagesConfig in $packagesConfigs)