Skip to content

Instantly share code, notes, and snippets.

View ZoltonMD's full-sized avatar

Sergey ZoltonMD

  • Lisbon, Portugal
View GitHub Profile
@ZoltonMD
ZoltonMD / deprecated.py
Created November 23, 2023 15:35
Deprecation wrapper
import warnings
def deprecated(message: str):
""" To decorate deprecated functions/methods
Args:
message (str): Warning message for developers
Returns:
func()
@ZoltonMD
ZoltonMD / my.zsh-theme
Created April 25, 2022 17:45
Disable git prompt info in oh-my-zsh theme
function _git_prompt_info {
# Possibility to disable git_prompt_info in repos when it is not needed
[ "$(git config prompt.hide)" = "true" ] && return
echo "$(git_prompt_info)"
}
@ZoltonMD
ZoltonMD / split_to_chunks.py
Last active January 31, 2018 16:00
Split list into chunks
def chunk_into_n_parts(list, n):
"""Split list into n chunks
Args:
list (list): splittable list
n (int): amount of chunks
Returns:
(list): list of n chunks
"""
@ZoltonMD
ZoltonMD / restart_bluetooth.sh
Created October 24, 2017 06:23
macos bluetooth restart
#!/bin/bash
# restart:
# > ./restart_bluetooth.sh
# turn bluetooth on:
# > ./restart_bluetooth.sh 1
# turn bluetooth off:
# > ./restart_bluetooth.sh 0
output="Bluetooth restarted";
@ZoltonMD
ZoltonMD / nginx.conf
Last active April 12, 2017 21:25
Nginx WebSocket proxy
# To turn a connection between a client and server from HTTP/1.1 into WebSocket,
# the protocol switch mechanism available in HTTP/1.1 is used.
# There is one subtlety however: since the “Upgrade” is a hop-by-hop header,
# it is not passed from a client to proxied server.
location /websocket {
proxy_pass https://url/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
@ZoltonMD
ZoltonMD / marble.sh
Last active September 13, 2016 16:32
Setting up Logitech Marble Mouse in Linux
#!/bin/bash
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8$
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1$
xinput set-button-map "Logitech USB Trackball" 1 8 3 4 5 6 7 2 9$