Skip to content

Instantly share code, notes, and snippets.

Avatar

Vlad Zahorodnii zzag

View GitHub Profile
@zzag
zzag / little-cheatsheet.txt
Created Jun 29, 2016
Vim commands cheat sheet
View little-cheatsheet.txt
NORMAL:
- dd : cut line
- 10dd : cut 10 lines
- daw : cut word
- d2w : cut two words
- %d : cut all content
- y : copy
- yy : yank line
- 10yy : copy 10 lines
- p : paste after cursor
@zzag
zzag / scrollbar.css
Created Jul 26, 2016
Custom Google Chrome scrollbar
View scrollbar.css
::-webkit-scrollbar {
width: 9px;
height: 9px;
background-color: rgba(0,0,0,0);
-webkit-border-radius: 100px;
}
::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.5);
border: 1px solid transparent;
View gradient_checking.py
import numpy as np
def eval_gradient_naive(f, x, dx=1e-4):
grad = np.zeros_like(x)
it = np.nditer(x, flags=['multi_index'], op_flags=['readwrite'])
while not it.finished:
ix = it.multi_index
@zzag
zzag / template_madness.cpp
Created Mar 3, 2018
template madness: factorial
View template_madness.cpp
#include <iostream>
using std::cout;
using std::endl;
template <int N>
struct factorial {
constexpr static int value = N * factorial<N-1>::value;
@zzag
zzag / reformat.sh
Last active Mar 11, 2018
Re-format source tree with clang-format
View reformat.sh
find . -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \
| xargs clang-format -style=file -i -fallback-style=none
@zzag
zzag / torch-activate.fish
Created Jun 29, 2016
torch-activate for fish shell
View torch-activate.fish
function torch_activate()
set -gx TORCH_INSTALL_DIR $HOME
set -gx LUA_PATH $TORCH_INSTALL_DIR'/.luarocks/share/lua/5.1/?.lua;'$TORCH_INSTALL_DIR'/.luarocks/share/lua/5.1/?/init.lua;'$TORCH_INSTALL_DIR'/torch/install/share/lua/5.1/?.lua;'$TORCH_INSTALL_DIR'/torch/install/share/lua/5.1/?/init.lua;./?.lua;'$TORCH_INSTALL_DIR'/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua'
set -gx LUA_CPATH $TORCH_INSTALL_DIR'/.luarocks/lib/lua/5.1/?.so;'$TORCH_INSTALL_DIR'/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so'
set -gx LD_LIBRARY_PATH $TORCH_INSTALL_DIR/torch/install/lib $LD_LIBRARY_PATH
set -gx DYLD_LIBRARY_PATH $TORCH_INSTALL_DIR/torch/install/lib $DYLD_LIBRARY_PATH
set -gx LUA_CPATH $TORCH_INSTALL_DIR'/torch/install/lib/?.so;' $LUA_CPATH
set -gx fish_user_paths $TORCH_INSTALL_DIR/torch/install/bin $fish_user_paths
end
@zzag
zzag / gtk.css
Last active Apr 10, 2018
Breeze Firefox theme
View gtk.css
/* GTK NAMED COLORS
----------------
use responsibly! */
/*
widget text/foreground color */
@define-color theme_fg_color #232627;
/*
text color for entries, views and content in general */
@define-color theme_text_color #232627;
/*
@zzag
zzag / firefox-dev.desktop
Created May 8, 2018
Firefox Developer Edition desktop file
View firefox-dev.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Developer Edition
GenericName=Web Browser
Comment=Browse the Web
Exec=env GTK_THEME=Breeze-Firefox /home/vlad/Applications/firefox-dev/firefox -P Developer %u
Icon=/home/vlad/Applications/firefox-dev/browser/chrome/icons/default/default128.png
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
@zzag
zzag / tasks.json
Created Jan 25, 2019
compdb vscode task
View tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "compdb: Generate a Compilation Database",
"type": "shell",
"command": "compdb -p /home/vlad/Workspace/KDE/build/kde/workspace/kwin list > ${workspaceFolder}/compile_commands.json",
"presentation": {
"reveal": "silent",
"focus": false,
View .profile.fish
# Load keychain.
if type -q keychain and status is-interactive
keychain --quiet --agents ssh id_github id_kde
end
if test -f ~/.keychain/(hostname)-fish
source ~/.keychain/(hostname)-fish
end
# Use ccache.
You can’t perform that action at this time.