Skip to content

Instantly share code, notes, and snippets.

@sksitou
sksitou / my_redis.py
Last active June 28, 2019 10:45
Redis Client
# https://redis-py.readthedocs.io/en/latest/#redis.StrictRedis
import os
from functools import partial
import redis
from redlock import RedLock, RedLockFactory
#import configparser
#config = configparser.ConfigParser()
#config.read('config.ini')
@sksitou
sksitou / lru_cache_redis.py
Last active June 28, 2019 10:42
LRU cache with Redis
# https://github.com/python/cpython/blob/master/Lib/functools.py
from collections import namedtuple
from functools import partial
import pickle
from my_redis import Client
WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__qualname__', '__doc__',
'__annotations__')
WRAPPER_UPDATES = ('__dict__',)
def update_wrapper(wrapper,
@sksitou
sksitou / bashrc
Created August 29, 2018 03:56
bashrc setting and alias
# conda activation
export PATH=~/anaconda3/bin:$PATH
# alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias cd2='cd ../../'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias fk='fuck'
alias grep='grep --color=auto'
@sksitou
sksitou / 0_reuse_code.js
Created April 9, 2017 14:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console