Skip to content

Instantly share code, notes, and snippets.

View sampollard's full-sized avatar

Sam Pollard sampollard

View GitHub Profile
@sampollard
sampollard / onlycite.tex
Created August 5, 2019 20:55
Print out only citations given a .bib file
% Only generate citations. Build with latexmk -pdf
\documentclass{article}
\begin{document}
\nocite{*}
\bibliographystyle{plain}
\bibliography{mybib}
\end{document}
@sampollard
sampollard / iq.sh
Last active March 9, 2021 22:36
Totally accurate IQ calculator based only on your full name
#!/bin/bash
echo "$1" | awk -F'[\-.]' '{print NF*15+70}'
@sampollard
sampollard / singularity.md
Last active March 15, 2019 20:05
Singularity: Did You Bring Enough to Share with the Class?

Singularity: Did You Bring Enough to Share with the Class?

Motivation

I wanted to use singularity for my own selfish purposes; when presenting my research I want it to be easy for someone else to try.

Installing Singularity

The Easy Way

sudo apt install singularity.

@sampollard
sampollard / fix_pdf.sh
Last active October 13, 2020 21:19
Tricks to embed fonts inside pdfs for paper submissions
#!/bin/bash
# Embed fonts in pdf files. This may be needed for R graphics.
# You can check if fonts are embedded using pdffonts (on mac, xpdf-pdffonts); check the emb column
mkdir -p unembedded
cp *.pdf unembedded/
for f in unembedded/*; do
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEmbedAllFonts=true -sOutputFile=$(basename $f) -f $f
done
# Other things you may need to do to pass the IEEE pdf eXpress (pdf-express.org)
@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"
@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 / 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 / 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 / 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 / LargeGraphs.md
Last active April 27, 2017 23:55
A collection of links to datasets containing large graphs