Skip to content

Instantly share code, notes, and snippets.

@Potherca
Potherca / debug-bash-scripts.md
Last active January 10, 2024 21:29
Sometimes you want to be able to debug a bash script. This gist gives an example of how to do this.

Introduction

Sometimes you want to be able to debug a bash script. Usually the -x option will suffice but sometimes something more sophisticated is needed.

In such instances using the DEBUG trap is often a good choice.

Attached to this gist is a example script to demonstrate how such a thing would work.

@scue
scue / .bash_aliases.git
Last active May 9, 2021 12:54
Git aliases autocomplete
__linux_git_complete_file=/usr/share/bash-completion/completions/git
__windows_git_complete_file=/etc/bash_completion.git
__host_os_type=$(uname -sm)
case ${__host_os_type:0:5} in
Linux)
__current_git_complete_file=$__linux_git_complete_file
;;
MINGW)
__current_git_complete_file=$__windows_git_complete_file
@wandernauta
wandernauta / sp
Last active April 16, 2024 15:37
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000