Skip to content

Instantly share code, notes, and snippets.

View dair-targ's full-sized avatar

Vladimir Berkutov dair-targ

  • St. Petersburg, Russia
View GitHub Profile
@dair-targ
dair-targ / LIST.md
Created January 10, 2018 02:38
List of articles, things and other interesting stuff
"""
How to use:
cat test.txt | python logg.py
"""
import sys
keywords = ['mmm']
datetime_str = None
# This would be a dictionary
@dair-targ
dair-targ / install-idea.sh
Created July 19, 2016 02:40
Install IntelliJ IDEA on Ubuntu
#!/bin/bash
set -e -o pipefail
# TODO: .local/share/applications/jetbrains-idea.desktop
echo >/dev/null <<_JETBRAINS_IDEA_DESKTOP
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/home/vladimirb/Documents/Applications/idea/bin/idea.png
@dair-targ
dair-targ / bash-prompt.sh
Last active December 1, 2015 06:42
bash-prompt.sh
#!/bin/bash
# Call this file from .bashrc to get useful prompt:
# 1. It shows local time and Unix time (number of seconds since 01.01.1970+00:00)
# 2. It shows just current working directory
# 3. Whenever the current working directory is under control of git, it shows the current branch
function __551007e297f511e593a71b4727b21972_ps1() {
# Reset
Color_Off='\[\e[0m\]' # Text Reset
@dair-targ
dair-targ / properties.hs
Created February 12, 2014 13:19
Reads values of property from file
import System.Environment
import Data.List
import Data.Maybe
data Arguments = Arguments String String
| UnexpectedArguments [String]
| NotEnoughArguments
deriving Show
@dair-targ
dair-targ / autocd-git.sh
Created September 20, 2013 12:32
autocd for git
function err_handle()
{
status=$?
lastcmd=$(history | tail -1 | sed 's/^ *[0-9]* *//')
# Perform autocd
if [ -d "$lastcmd" ]
then
# Comment the following line out if autocd is enabled
cd $lastcmd
return
@dair-targ
dair-targ / tornado-async-redis-cache
Last active December 17, 2015 22:49
Implementation of asynchronous Redis-based cache for Tornado framework
# -*- coding: utf-8 -*-
import functools
import json
from tornado import gen
class RedisCache(object):
"""
Redis-based cache.