Skip to content

Instantly share code, notes, and snippets.

View dgk's full-sized avatar
🇬🇪

Dmitry Kuksinsky dgk

🇬🇪
View GitHub Profile
@dgk
dgk / jq-cheetsheet.md
Created March 2, 2021 11:22 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@dgk
dgk / bluepill.cfg
Created October 16, 2020 19:50 — forked from hemalchevli/bluepill.cfg
OpenOCD config file for Bluepill STM32F103C8T6
#source [find interface/stlink-v2-1.cfg]
source [find interface/stlink-v2.cfg]
transport select hla_swd
source [find target/stm32f1x.cfg]
#reset_config srst_only
reset_config none separate
@dgk
dgk / nginx.conf
Created August 19, 2020 17:07 — forked from dctrwatson/nginx.conf
Caching PyPi packages locally with nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@dgk
dgk / version-up.sh
Created June 22, 2020 13:51 — forked from OleksandrKucherenko/version-up.sh
Calculate Next Suitable Version Tag for Your Git based project
#!/usr/bin/env bash
## Copyright (C) 2017, Oleksandr Kucherenko
## Last revisit: 2017-09-29
# For help:
# ./versionip.sh --help
# For developer / references:
# https://ryanstutorials.net/bash-scripting-tutorial/bash-functions.php
# http://tldp.org/LDP/abs/html/comparison-ops.html
@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
@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
@dgk
dgk / submit.md
Created May 23, 2019 11:55 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"