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 / 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
@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 / 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" "johnsmith@example.com"
# 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 / 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 / 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 / collatz.cpp
Created May 13, 2018 04:45
A C++ script written to generate sequences from the Collatz Conjecture, an open problem in mathematics.
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
int main(int argc, char** argv)
{
int time_initial = 0,
time_final = 0,
@seanpianka
seanpianka / hacking.cpp
Created May 13, 2018 04:48
A hacky, partially-working implementation of the Fallout video-game series hacking mini-game.
/*
** Game designed according to this challenge:
** https://www.reddit.com/r/dailyprogrammer/comments/3qjnil/20151028_challenge_238_intermediate_fallout/
*/
/*
************************************************************
// HEADER FILES
************************************************************
*/
@seanpianka
seanpianka / combat.cpp
Created May 13, 2018 04:50
A game where spartans and skeletons fight! Idea from YouTube channel "MakingGamesWithBen" and his first challenge video!
/*
* Title: Spartan vs. Skeletons
* Author: Sean Pianka
* Date: November 3rd, 2015
* Description: A game where spartans and skeletons fight! Idea from
* YouTube channel "MakingGamesWithBen" and his first challenge video!
The game is based off of this tutorial, which I highly recommend to
anyone looking to get into programming and game development:
@seanpianka
seanpianka / rpi3-install-py3-opencv.sh
Last active March 22, 2020 03:23
Py3 OpenCV on Raspberry Pi 3
# Remove useless programs to free up space
sudo apt-get remove --purge -y wolfram* libreoffice* sonic-pi minecraft-pi
sudo apt-get clean && sudo apt-get autoremove
# Update, upgrade, and install all OpenCV dependencies
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt install libgdk-pixbuf2.0-dev libpango1.0-dev libcairo2-dev libfontconfig1-dev libgdk-pixbuf2.0-dev libpango1.0-dev libcairo2-dev # GTK requires
sudo apt-get install build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran python2.7-dev python3-dev # opencv requires
# virtualenv for Python, this is where OpenCV will be installed
sudo pip install virtualenv virtualenvwrapper
PROJECT_HOME=$HOME/Development