Skip to content

Instantly share code, notes, and snippets.

View kbseah's full-sized avatar
🔠
farewell etaoin shrdlu

Brandon Seah kbseah

🔠
farewell etaoin shrdlu
View GitHub Profile
@domenic
domenic / redirecting-github-pages.md
Created February 10, 2017 19:28
Redirecting GitHub pages after a repository move

Redirecting GitHub Pages after a repository move

The problem

You have a repository, call it alice/repo. You would like to transfer it to the user bob, so it will become bob/repo.

However, you make heavy use of the GitHub Pages feature, so that people are often accessing https://alice.github.io/repo/. GitHub will helpfully redirect all of your repository stuff hosted on github.com after the move, but will not redirect the GitHub Pages hosted on github.io.

The solution

@pierdom
pierdom / plot_precounted_hist.py
Last active August 3, 2023 11:56
[Plot histograms with pre-computed counters] Plot histograms with Marplotlib hist function or Seaborn distplot function using pre-counted values using 'weights' argument. Very useful for plotting distributions of values queried from a very large dataset, where it is impossible to retrieve and load in memory every element of the distribution inde…
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import seaborn as sns
# dictionary with pre-counted bins
test = {1:1,2:1,3:1,4:2,5:3,6:5,7:4,8:2,9:1,10:1}
# with matplotlib
plt.hist(list(test.keys()), weights=list(test.values()))
@stvhwrd
stvhwrd / combine-pdf.md
Last active March 26, 2023 11:19
Combining PDF files on the command line in OSX

###While this script does concatenate pdf files, I haven't yet figured out in which order it does so. On a sample of 19 pdf files, logically named 01something.pdf, 02something.pdf, 03something.pdf, etc. the order of the merged product seemed almost random...

...from Tiger onwards, OSX ships with a Python script that concatenates pdf files (merges them together). The script is already executable, and Python is pre-installed on OS X, so all you need to do is point it at your pdf files and run

"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o PATH/TO/YOUR/MERGED/FILE.pdf /PATH/TO/ORIGINAL/1.pdf /PATH/TO/ANOTHER/2.pdf /PATH/TO/A/WHOLE/DIR/*.pdf

I prefer putting the link in /usr/local/bin, as it is in the $PATH and therefore I can run the command from anywhere. To set up the link, you need to navigate to the directory where you want the link.

@ChrisWills
ChrisWills / .screenrc-main-example
Created November 3, 2011 17:50
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@fredrick
fredrick / screen.md
Created September 14, 2011 15:30
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow