Skip to content

Instantly share code, notes, and snippets.

View rizsotto's full-sized avatar
🇺🇦
support Ukraine

László Nagy rizsotto

🇺🇦
support Ukraine
View GitHub Profile
@rizsotto
rizsotto / trace.py
Last active August 29, 2015 13:59
TRACE decorator with indent. using standard python logging.
import logging
import functools
import traceback
def trace(fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
indent = ' ' * len(traceback.extract_stack())
try:
logging.debug('{0}entering {1}'.format(indent, fn.__name__))
@rizsotto
rizsotto / backtag.py
Last active June 14, 2020 17:26
pygit2 exercise to create tags on certain commits. usage: enter the desired directory and exec the script from there.
#!/bin/env python
import pygit2
import logging
import re
import os
import os.path
def main():
repo = pygit2.init_repository(os.getcwd())
@rizsotto
rizsotto / index.html
Last active December 19, 2015 05:38
Hungarian national tobacco shops addresses parser
<!DOCTYPE html>
<html dir="ltr" lang="hu-HU">
<head/>
<meta charset="UTF-8"/>
</head>
<body>
<pre id='goods'></pre>
<script type="text/javascript">
function parse_raw_data(data) {
Config { font = "xft:Bitstream Vera Sans Mono:size=9:antialias=true"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, lowerOnStart = True
, hideOnStart = False
, persistent = False
, border = NoBorder
, commands = [ Run StdinReader
, Run Battery ["-t", "Batt: <acstatus><watts>W, <left>%",
@rizsotto
rizsotto / xmonad.hs
Last active December 16, 2015 21:20
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Layout.NoBorders
import XMonad.Util.EZConfig (additionalKeys)
import Graphics.X11.ExtraTypes.XF86
myWorkspace = ["1:web","2","3","4","5","6"]
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-s
#bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
@rizsotto
rizsotto / gist:4723645
Created February 6, 2013 16:12
first python code from me
def _extend_list(numbers, size):
copy = numbers[:]
current_size = len(copy)
for i in range(current_size, size):
copy.append(0)
return copy
class Version:
def __init__(self, string):
tokens = string.split('.')