Skip to content

Instantly share code, notes, and snippets.

View sampollard's full-sized avatar

Sam Pollard sampollard

View GitHub Profile
@sampollard
sampollard / minionize.sh
Created November 21, 2015 07:56
Add (feat. Minions) to every mp3 file song title
#!/bin/bash
for song in $(find ~ -iname *.mp3)
do
title=$(id3info $song | awk -F ':' '/TIT2/{print $NF}')
id3tag -s "$title (feat. Minions)" $song
done
@sampollard
sampollard / GraphFileFormats.md
Last active April 14, 2021 05:08
Comprehensive filename extension for graph file formats

There are almost as many graph file formats as there are graph processing platforms. Here, I attempt to provide a comprehensive listing. Some of these are nearly trivial, but yet, the standards are just not established. Whether the vertices are 0-indexed or 1-indexed is undefined. However, this does matter for some systems such as GraphMat. All the examples show the same directed, unweighted graph with the exception of .metis.

ASCII Text Formats

.el

This is the "edge list" format. The format is one edge per line of the form . For example,

1 2
2 1
1 3
@sampollard
sampollard / productivity.sh
Last active December 24, 2018 23:13
Productivity Enhancer
#!/bin/bash
# usage: ./prod.sh <repository_url>
# Have no one doubt your productivity on GitHub. You must already have
# a repository and have an ssh key established for this to work.
# To get a nice solid green contribution, see
# https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile
REPO_URL=$1
git clone "$REPO_URL" ~/prod
cd ~/prod
if ! [ -f counter.txt ]; then
@sampollard
sampollard / all-unicode.py
Last active February 11, 2017 23:53
Save every printable unicode character to a file
# Enumerate every printable character
# It could be fun to find an interesting subset
from __future__ import print_function
import random
f = open("all.txt", "w")
for i in range(200000):
try:
f.write(unichr(i).encode("utf8"))
except ValueError:
pass
@sampollard
sampollard / LargeGraphs.md
Last active April 27, 2017 23:55
A collection of links to datasets containing large graphs
@sampollard
sampollard / sp.tex
Last active September 29, 2020 06:40
My Logo
% Copyright 2020 Samuel Pollard. All rights reserved.
% Requires imagemagick for "convert" binary. Can also do .png
% Build using `pdflatex -shell-escape sp.tex`
% My Logo
%\documentclass[crop,tikz=true,convert={outfile=mylogo.svg}]{standalone}
\documentclass[crop,tikz=true,convert={outfile=mylogo.png,size=1080x1080,density=720}]{standalone}
\begin{document} % You saw it here first
\begin{tikzpicture}
% Plot lines
\draw[help lines, color=gray!40, dashed] (-2,-2) grid (2,2);
@sampollard
sampollard / vimrc
Last active March 11, 2024 06:23
My Vimrc
""" vimrc
" Install some packages I like
" mkdir -p ~/.vim/pack/bundle/start
" cd ~/.vim/pack/bundle/start
" git clone https://tpope.io/vim/surround.git
" vim -u NONE -c "helptags surround/doc" -c q
" git clone https://tpope.io/vim/commentary.git
" vim -u NONE -c "helptags commentary/doc" -c q
" git clone https://github.com/atelierbram/vim-colors_atelier-schemes.git
" git clone https://github.com/trefis/coquille.git
@sampollard
sampollard / transcend-dependency-hell.sh
Last active June 12, 2020 23:44
Install every package
#!/bin/bash
INSTALL='sudo apt --assume-yes install'
POPULARITY_CONTEST='yes'
$INSTALL curl
$INSTALL gunzip
$INSTALL awk
if [ "$POPULARITY_CONTEST" = 'yes' ]; then
curl https://popcon.debian.org/by_inst.gz > allpackages.txt.gz
gunzip allpackages.txt.gz
awk '!/^#/{if ($4 > 0) print $2}' allpackages.txt > pkg.txt
@sampollard
sampollard / mine_or_game.bat
Created December 11, 2017 23:48
Ensure exactly one or two programs is running in Windows. Useful if you only want your miner to run while you're not gaming.
REM Miner.
REM !!!! NOTE: You should edit the 'start' command to restart whichever process you want. !!!!
SET MINER=EthDcrMiner64.exe
REM Examples for a particular games, or you can just use Steam in general.
SET GAME=Dota2.exe
REM SET GAME=Steam.exe
REM Testing with echoes
@sampollard
sampollard / dedupe-imgs.sh
Last active April 21, 2023 09:32
Deduplicate Files - works for Photos in a dumb way, and mp3s in a slightly less dumb way
#!/bin/bash
# Deduplicate. Works on BSD.
# Port to GNU by replacing
# -E with -regex-type posix-extended
set -e
if [ "$#" -ne 1 ]; then
echo "usage: dedupe.sh <dir>"
exit 2
elif [ "$(uname)" != 'Darwin' ]; then
echo "Only Mac supported, see comments"