Skip to content

Instantly share code, notes, and snippets.

View sergejx's full-sized avatar

Sergej Chodarev sergejx

View GitHub Profile
@sergejx
sergejx / gist:91176
Created April 7, 2009 10:33
Tango palette in JavaScript
// Tango palette <http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines>
// Depends on Hash class from MooTools <http://mootools.net/>
var palette = new Hash({
white: '#ffffff', black: '#000000',
butter1: '#fce94f', butter2: '#edd400', butter3: '#c4a000',
orange1: '#fcaf3e', orange2: '#f57900', orange3: '#ce5c00',
chocolate1: '#e9b96e', chocolate2: '#c17d11', chocolate3: '#8f5902',
chameleon1: '#8ae234', chameleon2: '#73d216', chameleon3: '#4e9a06',
skyBlue1: '#729fcf', skyBlue2: '#3465a4', skyBlue3: '#204a87',
plum1: '#ad7fa8', plum2: '#75507b', plum3: '#5c3566',
% Toto je pokus o implantaciu rustiny do Latexu
% 26. 1. 1994 Jano Busa
%% zdroj: http://lists.felk.cvut.cz/pipermail/cstex/2003-January/015285.html
\chardef\mz='176 % myakkij znak
\chardef\tz='177 % tverdyj znak
\chardef\pj='32 % russkoe j
\chardef\pJ='22 % propisnoe russkoe J
\chardef\pe='13 % obratnoe e
@sergejx
sergejx / gist:180897
Created September 4, 2009 14:03
Real World Haskell comments remover
// ==UserScript==
// @name Real World Haskell comments remover
// @namespace http://sergejx.mysteria.cz/
// @description Remove links to comments from Real World Haskell online book.
// @include http://book.realworldhaskell.org/read/*
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
@sergejx
sergejx / pic2graph.sh
Created October 7, 2009 09:59
pic2graph script from groff-1.20.1
#! /bin/sh
#
# pic2graph -- compile PIC image descriptions to bitmap images
#
# by Eric S. Raymond <esr@thyrsus.com>, July 2002
# In Unixland, the magic is in knowing what to string together...
#
# Take a pic/eqn diagram on stdin, emit cropped bitmap on stdout.
# The pic markup should *not* be wrapped in .PS/.PE, this script will do that.
@sergejx
sergejx / backup.sh
Created January 20, 2010 13:10
Simple backups using rsync
#!/bin/sh
# Simple backups based on article
# http://blog.interlinked.org/tutorials/rsync_time_machine.html
FILES=$HOME # What to backup
BACKUPS=/media/sklad/backups-`uname -n` # Where to store backups
# File .rsync-filter can be used to exclude/include some files
# Use `man 1 rsync` for more information
date=`date "+%Y-%m-%dT%H:%M:%S"`
@sergejx
sergejx / build.sh
Created January 20, 2010 13:11
Build anything
#!/bin/bash
# Compile file with right tool based on file extension.
# If Makefile exists in direcotory, then run make.
function run() {
echo $@
$@
}
function find_tex_master() {
#!/bin/bash
# Notify me at specified time using `at' and `notify-send'
# Strings
TITLE="Notify At…"
QUESTION="When to notify you?"
DEFAULT="now +10min"
NOTIFICATION="You have been notified!"
# Code
@sergejx
sergejx / README
Created January 20, 2010 13:12
Keyboard layouts
My customized keyboard layouts for X.org
To apply patches use:
sudo patch -b -p0 < patch_file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import zipfile
from BeautifulSoup import BeautifulSoup, Tag # Better for HTML
from lxml import etree # Better for XML
@sergejx
sergejx / gist:818179
Created February 9, 2011 09:04
TaskPaper language definition for Gedit
<?xml version="1.0" encoding="UTF-8"?>
<language id="taskpaper" _name="TaskPaper" version="2.0" _section="Others">
<metadata>
<property name="globs">todo;*.taskpaper</property>
</metadata>
<styles>
<style id="project" _name="Project" map-to="def:type"/>
<style id="task" _name="Task" map-to="def:keyword"/>
<style id="note" _name="Note" map-to="def:comment"/>