Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
@T1T4N
T1T4N / sVimcss.css
Last active March 7, 2019 08:36
sVimcss
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@T1T4N
T1T4N / cvimrc.vim
Last active May 14, 2018 14:16
cVimrc
set smoothscroll
set noignorecase
let scrollstep = 50
let scrollduration = 25
" unmap space
let mapleader = "<Space>"
let hintcharacters = "sadfjklewcmpgh"
let barposition = "bottom"
@T1T4N
T1T4N / cvim.css
Last active February 21, 2018 08:58
cVimcss
#cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results,
.cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left,
.cVim-completion-item .cVim-right {
font-family: Helvetica, Helvetica Neue, Neue, sans-serif, monospace, Arial;
font-size: 10pt !important;
-webkit-font-smoothing: antialiased !important;
}
#cVim-command-bar {
position: fixed;
@T1T4N
T1T4N / conditional_decorator.py
Last active September 14, 2024 09:31
Python conditional decorator
class conditional_decorator(object):
def __init__(self, dec, condition):
self.decorator = dec
self.condition = condition
def __call__(self, func):
if not self.condition:
# Return the function unchanged, not decorated.
return func
return self.decorator(func)
@T1T4N
T1T4N / function_wrapper.sh
Created February 12, 2018 11:53
Complex function alias based on first argument
function pip() {
if [[ $1 == "install" ]]; then
command pip "$1" -i "${ARTIFACTORY_PYPI_URL}" "${@:2}"
else
command pip "$@"
fi
}
@T1T4N
T1T4N / pushd.py
Last active February 26, 2018 08:59
Python pushd implementation using context manager
import os
from contextlib import contextmanager
@contextmanager
def pushd(newdir):
old_path = os.getcwd()
os.chdir(newdir)
try:
yield
finally:
@T1T4N
T1T4N / environment_append.py
Created February 27, 2018 10:35
Python function to append values to existing environment variables
from contextlib import contextmanager
from collections import Iterable
def flatten(coll):
for i in coll:
if isinstance(i, Iterable) and not isinstance(i, str):
for subc in flatten(i):
yield subc
else:
yield i
@T1T4N
T1T4N / async_timeout.js
Created April 1, 2018 19:12
A timeout function to be used with async/await
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@T1T4N
T1T4N / emulate_dots.sh
Created April 6, 2018 13:15
Emulate printing dots while command is executing
command-that-outputs-too-much-stuff | while read line; do printf "%c" .; done
@T1T4N
T1T4N / safe_array.sh
Created April 9, 2018 07:20
Safe array usage with set -u
make ${MAKEOPTS[@]+"${MAKEOPTS[@]}"}