Skip to content

Instantly share code, notes, and snippets.

View dgk's full-sized avatar
🇬🇪

Dmitry Kuksinsky dgk

🇬🇪
View GitHub Profile
@dgk
dgk / .style.yapf
Created March 12, 2020 10:23 — forked from krnd/.style.yapf
(Python) yapf configuration file
# .style.yapf
#
# DESCRIPTION
# Configuration file for the python formatter yapf.
#
# This configuration is based on the generic
# configuration published on GitHub.
#
# AUTHOR
# krnd
# disable window move with alt + left mouse button
# https://askubuntu.com/questions/270032/how-do-i-disable-window-move-with-alt-left-mouse-button-in-xubuntu
xfconf-query -c xfwm4 -p /general/easy_click -s none
# scrollbar size
# https://forum.xfce.org/viewtopic.php?id=12271
cat > ~/.config/gtk-3.0/gtk.css <<EOF
scrollbar.vertical slider {
min-width: 20px;
}
@dgk
dgk / heredoc.rb
Created January 27, 2020 13:17 — forked from zaiste/heredoc.rb
class String
def unindent
gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "")
end
end
def display
text = <<-TEXT.unindent
Lorem ipsum dolor sit amet,
consectetur adipisicing elit,
@dgk
dgk / how-to.md
Created November 16, 2019 23:39 — forked from reywood/how-to.md
How to get a stack trace from a stuck/hanging python script

How to get a stack trace for each thread in a running python script

Sometimes a python script will simply hang forever with no indication of where things went wrong. Perhaps it's polling a service that will never return a value that allows the program to move forward. Here's a way to see where the program is currently stuck.

Install gdb and pyrasite

Install gdb.

# Redhat, CentOS, etc
timeout /T 3600 & shutdown /h /f
wget -O /usr/local/bin/stern https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64
chmod +x /usr/local/bin/stern
wget https://storage.yandexcloud.net/yandexcloud-yc/release/`curl https://storage.yandexcloud.net/yandexcloud-yc/release/stable`/linux/amd64/yc
install -t /usr/local/bin yc
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
apt-get install apt-transport-https ca-certificates
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk kubectl