Skip to content

Instantly share code, notes, and snippets.

@igorepst
igorepst / runOrRaise
Created September 28, 2024 17:54
Run or raise for Hyprland
#!/usr/bin/env sh
selectOne() {
target=$(hyprctl clients -j | jq -rc '.[] | select((.class |test("'"${1}"'")))')
if [ -n "${target}" ]; then
target=$(echo "${target}" | jq -r '.address')
hyprctl dispatch "focuswindow address:${target}" >/dev/null
return 0
fi
return 1
@igorepst
igorepst / gist:db9ee3c62664ea06f011d5671715ac33
Created November 29, 2022 15:12
Multiline Eshell prompt
(add-hook 'eshell-mode-hook (lambda ()
(add-hook 'eshell-pre-command-hook #'ig-eshell-pre-command nil t)
(add-hook 'eshell-post-command-hook #'ig-eshell-post-command nil t)))
(with-eval-after-load 'eshell
(defvar-local ig-eshell-last-command-status 0)
(defvar-local ig-eshell-last-command-start-time nil)
(defvar-local ig-eshell-last-command-time nil)
(defconst ig-color-blue "#3465A4" "Blue color.")
(defconst ig-color-bright-blue "#729FCF" "Bright blue color.")
(defconst ig-color-red "#CC0000" "Red color.")
#compdef foo-tools.sh
_foo_tools_sh() {
local -a commands
commands=(
"start:Start something"
"stop:Stop something"
"install:Install something"
"switch:Switch to something else"
@igorepst
igorepst / install.sh
Created June 11, 2018 20:00
Install Vim8 with Python3 and GTK3 on CentOS 7.5
sudo yum install epel-release
sudo yum install gcc-c++ ncurses-devel ruby ruby-devel lua lua-devel luajit luajit-devel ctags python python-devel python3 python3-devel tcl-devel perl perl-devel perl-ExtUtils-ParseXS perl-ExtUtils-XSpp perl-ExtUtils-CBuilder perl-ExtUtils-Embed cscope gtk3-devel libSM-devel libXt-devel libXpm-devel libappstream-glib libacl-devel gpm-devel
yum list installed | grep -i vim
# sudo yum erase vim-common.x86_64 vim-enhanced.x86_64 vim-filesystem.x86_64 vim-X11
# sudo depends on vim-minimal
sudo rpm -e --nodeps vim-minimal
sudo ln -s /usr/bin/python3.6 python3
SVN ignore:
svn propedit svn:ignore .
PostgreSQL:
Copy data from your CSV file to the table
COPY zip_codes FROM '/path/to/csv/ZIP_CODES.txt' WITH (FORMAT csv);
Save select to CSV
Copy (Select * From foo) To '/tmp/test.csv' With CSV DELIMITER ',';
@igorepst
igorepst / gist:7d5fe9bb8a300802c630
Created February 1, 2016 07:04
Replace CRLF in already cloned Git repository
git config core.eol lf
git config core.autocrlf input
git rm -rf --cached .
git reset --hard HEAD
@igorepst
igorepst / AndroidManifest.xml
Created July 1, 2015 12:07
Gradle: exclude something from AndroidManifest.xml by regexp, then use Proguard to throw it away
<!-- START: XXX Do not remove the comment's START-END pair. Used by Gradle -->
...
<!-- END: XXX -->
@igorepst
igorepst / gist:091a9c16d08c1981b3ac
Last active June 12, 2021 02:48
Gradle: Copy Proguard's mapping.txt to save it
android {
applicationVariants.all { variant ->
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast{
copy {
from variant.mappingFile
into "${rootDir}/mappings"
rename { String fileName ->
"mapping-${variant.name}.txt"
}