Skip to content

Instantly share code, notes, and snippets.

include "/usr/share/X11/locale/en_US.UTF-8/Compose"
# Punctuation
# знаки препинания, необходимые в русском, которых нет в en_US.UTF-8/Compose
<Multi_key> <period> <minus> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <period> <space> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <?> <!> : "⁈" U2048 # QUESTION EXCLAMATION, ?!
<Multi_key> <period> <colon> : "…" # ELLIPSIS
# №: набирается в русской раскладке без ухищрений,
@while0pass
while0pass / piratebay_index.py
Created December 6, 2012 06:30 — forked from maxpert/piratebay_index.py
Quick and dirty Whoosh Redis storage
"""
Copyright (c) 2012 Zohaib Sibte Hassan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
@while0pass
while0pass / gist:3120262
Created July 16, 2012 03:27
Converting images to pdfs and combining multiple pdfs into a single one in Linux
# converting image to pdf
sudo apt-get install imagemagick
convert cover.png cover.pdf
# combining multiple pdfs into a single one
sudo apt-get install gs pdftk
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combinedpdf.pdf -dBATCH cover.pdf ch1.pdf ch2.pdf ch3.pdf ix.pdf
@media print {
/* Append the address of the link */
a[href]:after {
content: " (" attr(href) ")";
/* break long urls that don't fit the page width [http://www.w3.org/TR/css3-text/] */
word-break: break-all;
overflow-wrap: break-word;
}
a[href^="javascript:"]:after,
a[href^="#"]:after { content: "" }
@while0pass
while0pass / gist:3072929
Created July 8, 2012 21:34
list al the logins for svn repo committers
svn log --quiet | grep "^r[0-9]" | awk '{print $3}' | sort | uniq
svn log --quiet | awk '/^r[0-9]/ {print $3}' | sort | uniq
svn log --quiet | awk '/^r[0-9]/ {print $3}' | sort -u
@while0pass
while0pass / tree.md
Created April 24, 2012 08:50 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@while0pass
while0pass / PythonLeaksHunting.py
Created April 20, 2012 20:36
Поиск утечек памяти в программе на Python
"""
Код, который можно использовать, чтоб понять, какого рода
насоздавались питоновые объекты за время между вызовами
с creageGcIds() и newGcIdsAndBreak(). Вторая функция,
очевидно, выкинет сразу в отладчик.
Можно использовать, когда на интересующие объекты
не получается поставить weakref. (с) Леонид Евдокимов.
См. также http://homo-virtualis.livejournal.com/25634.html
@while0pass
while0pass / sendxmpp.py
Created April 20, 2012 20:06
Скрипт для посылки сообщения на jabber
#!/usr/bin/env python
"""
Можно использовать например так:
(svn up && make ) && sendxmpp "Всё прошло успешно!" \
|| sendxmpp "Произошла ошибка!"
"""
import xmpp
import sys
@while0pass
while0pass / utf8PyGitHook.sh
Created April 20, 2012 19:05
хук для гита, чтобы нельзя было закомитить файл, если у него не проставлена кодировка UTF-8
#!/bin/sh
error=0
for file in `git diff-index --name-only HEAD | grep -e "\.py"`; do
grep -e 'coding: utf-8' $file > /dev/null
if [ $? -ne 0 ];
then
echo "python $file without coding directive"
error=1
fi
# Set prefix command to Ctrl-a
set -g prefix C-a
unbind C-b
# Reduce tmux delay for more responsiveness
set -sg escape-time 1
# Window and pane index count starts in 1 rather tan 0
set -g base-index 1
setw -g pane-base-index 1