A bash script that turns mpv into a radio.
- mpv: to play the stream
- dmenu: to choose radio stations
- jq: to parse IPC responses from mpv
# An example to get the remaining rate limit using the Github GraphQL API. | |
import requests | |
headers = {"Authorization": "Bearer YOUR API KEY"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: |
wl(){ | |
local ssid | |
local conn | |
nmcli device wifi rescan > /dev/null | |
ssid=$(nmcli device wifi list | tail -n +2 | grep -v '^ *\B--\B' | fzf -m | sed 's/^ *\*//' | awk '{print $1}') | |
if [ "x$ssid" != "x" ]; then | |
# check if the SSID has already a connection setup | |
conn=$(nmcli con | grep "$ssid" | awk '{print $1}' | uniq) |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)