Skip to content

Instantly share code, notes, and snippets.

View seanpianka's full-sized avatar
🦀
Busy

Sean Pianka seanpianka

🦀
Busy
  • Somewhere in Cislunar Space
  • LinkedIn in/pianka
View GitHub Profile
@seanpianka
seanpianka / spotify_playing.py
Created May 13, 2018 04:38
A Python script which can display information for the currently playing track on Spotify for Linux.
import dbus
import time
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object("org.mpris.MediaPlayer2.spotify",
"/org/mpris/MediaPlayer2")
spotify_properties = dbus.Interface(spotify_bus,
"org.freedesktop.DBus.Properties")
@seanpianka
seanpianka / github_username_test.py
Created April 28, 2018 18:04
Find all usernames that are (potentially available) to use on GitHub
from queue import Queue
from threading import Thread, Lock
from itertools import product
from string import ascii_lowercase
import requests
usrs = [''.join(i) for i in product(ascii_lowercase + '-', repeat = 3)]
usrs = [x for x in usrs if (not x.startswith('-')) and (not x.endswith('-'))]
class Worker(Thread):
@seanpianka
seanpianka / git-replace-author
Created September 14, 2017 21:55
Git script for replacing all the authors within a git repository.
# Save the script below as e.g. ~/.bin/git-replace-author and run it using, e.g:
# git replace-author "John Ssmith" "John Smith" "[email protected]"
# With no arguments, it updates all commits with your name to use your
# current email address according to Git config.
DEFAULT_NAME="$(git config user.name)"
DEFAULT_EMAIL="$(git config user.email)"
export OLD_NAME="${1:-$DEFAULT_NAME}"
export NEW_NAME="${2:-$DEFAULT_NAME}"
@seanpianka
seanpianka / generate_hex_string.py
Last active August 18, 2023 21:07
Generate a random hex string/key in Python 3
def generate_hex_string(length: int):
""" Generate a randomized hex string.
Parameters
----------
length : int
Desired character length of the returned token.
Returns
-------
@seanpianka
seanpianka / makefile
Last active September 21, 2018 20:12
C/C++ Makefile Template
# if there is a clock skew detected, run:
# find /your/dir -type f -exec touch {} +
CXX := g++
CXXSTD := -std=c++11
CXXFLAGS := -Wall -Wextra -O2
SRCDIR := src
BUILDDIR := build
TARGET := bin/a.out