Skip to content

Instantly share code, notes, and snippets.

Avatar

Vlad Zahorodnii zzag

View GitHub Profile
@zzag
zzag / PackageKit.md
Last active Dec 20, 2020
Pacman post transaction PackageKit hook
View PackageKit.md

Create 90-refresh-packagekit.hook file in /etc/pacman.d/hooks/ with the following contents

[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Target = *

[Action]
View dynamicwallpaperconverter
#!/usr/bin/env python3
# Copyright (C) 2020 Vlad Zahorodnii
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@zzag
zzag / synergys@.service
Created Aug 6, 2019
/usr/lib/systemd/system/synergys@.service
View synergys@.service
[Unit]
Description=Synergy Server Daemon
After=network.target
[Service]
User=%i
ExecStart=/usr/bin/synergys --no-daemon --config /etc/synergy.conf --enable-crypto
Restart=on-failure
[Install]
@zzag
zzag / firefox-nightly.desktop
Last active Nov 14, 2020
Firefox Nightly desktop file
View firefox-nightly.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Nightly
GenericName=Web Browser
Comment=Browse the Web
Exec=/home/vlad/Applications/firefox-nightly/firefox -P Nightly %u
Icon=/home/vlad/Applications/firefox-nightly/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 / 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 / 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;
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 / 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 / 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