This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
def deprecated(message: str): | |
""" To decorate deprecated functions/methods | |
Args: | |
message (str): Warning message for developers | |
Returns: | |
func() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# restart: | |
# > ./restart_bluetooth.sh | |
# turn bluetooth on: | |
# > ./restart_bluetooth.sh 1 | |
# turn bluetooth off: | |
# > ./restart_bluetooth.sh 0 | |
output="Bluetooth restarted"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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$ |