Skip to content

Instantly share code, notes, and snippets.

@Ohcanep
Ohcanep / sp
Last active September 23, 2016 20:46 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/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.
#
@Ohcanep
Ohcanep / spotify-ctrl
Last active September 23, 2016 21:03
#!/usr/bin/env bash
# For a vastly more feature-rich tool, have a look at
# https://gist.github.com/Ohcanep/48dac84c5916821d150c545a6eb12547
# https://gist.github.com/wandernauta/6800547 (original)
DEST="org.mpris.MediaPlayer2.spotify"
OBJECT_PATH="/org/mpris/MediaPlayer2"
INTERFACE="org.mpris.MediaPlayer2.Player"
@Ohcanep
Ohcanep / .gitconfig
Last active September 7, 2016 15:31
[alias]
b = branch -vv
ba = branch -avv
c = commit
ca = commit --amend
can = !git commit --amend --date="$(date +%Y-%m-%dT%H:%M:%S%z)"
co = checkout
com = checkout master
ds = diff --stat-name-width=50
dw = diff --word-diff=color
#!/usr/bin/env bash
E_NUMARGS=1
E_NOTDIR=2
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` [DIRECTORY]"
exit $E_NUMARGS
fi
#!/usr/bin/env python3
# curl -sS $KARINKEIKAT_BASE_URL/$(date +%Y)'.json?orderBy="date"&startAt="'$(date -I)'"&limitToFirst=5' | jq '.'
import json
import os
from sys import argv
import lxml.html
import requests
##
## Serpent Guard / Jaffa
##
$the_cow = <<EOC;
$thoughts
$thoughts
$thoughts
___
/ \\
| @ \\
#!/usr/bin/env bash
git config --get-regexp 'alias.*' | colrm 1 6 | sort | while read -r line; do
alias_name=$(echo "$line" | cut -d ' ' -f 1)
alias_command=$(echo "$line" | cut -d ' ' -f 2-)
printf "\033[1;37m%16s \033[0;39m%s\n" "$alias_name" "$alias_command"
# color ^^^^^^^^^^ ^^^^^^^^^^
# minimum width ^^
done
#!/usr/bin/env python3
# https://docs.python.org/3/library/datetime.html
# https://docs.python.org/3/library/string.html#formatspec
from datetime import date, timedelta
def days_from_now(days: int) -> date:
return date.today() + timedelta(days=days)