Skip to content

Instantly share code, notes, and snippets.

View colejhudson's full-sized avatar
🏃
roonin

Cole Hudson colejhudson

🏃
roonin
View GitHub Profile
@colejhudson
colejhudson / reset_ibooks.sh
Last active June 15, 2017 01:31
Reset iBooks
#!/usr/bin/env bash
LIB=${HOME}/Library
kill $(pidof ibooks) \
&& echo -e "Quitting iBooks"
rm -rf ${LIB}/Cookies/com.apple.ibooks.cookies \
&& echo -e "Deleting ${LIB}/Cookies/com.apple.ibooks.cookies"
# This file should go in $(pwd)/cmake/modules
# and, add set(CMAKE_MODULE_PATH ${CMAKE_MODULES_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
# to your CMakeLists.txt
# Module for locating the Crypto++ encryption library.
#
# Customizable variables:
# CRYPTOPP_ROOT_DIR
# This variable points to the CryptoPP root directory. On Windows the
# library location typically will have to be provided explicitly using the
#!/usr/bin/env bash
# 'cat' seems to take multiple file descriptors (fd) - vaguely analgous to pointers -
# and queues them, polling for available data and outputting it in a blocking FIFO manner.
# It moves onto the next fd condition on the closing of the last.
function cat_subprocess_handeling() {
START=${SECONDS}
@colejhudson
colejhudson / bash_subprocesses.sh
Created December 6, 2017 01:41
Using file descriptors to coordinate processes and paralized tasks in bash.
#!/usr/bin/env bash
function sub_proc_test() {
START=${SECONDS}
echo "[1] pid:${$}"
(
@colejhudson
colejhudson / annotated_manelbrot.c
Last active December 6, 2017 06:26
Annotated version of an entry to OCC that prints the mandelbrot set.
#include <unistd.h>
float fractal_scale=0.075;
float fractal_vertical=2.1; // Vertical positioning of the fractal within the actual characters
float fractal_left_padding;
float r, O, l, I;
@colejhudson
colejhudson / graphics-issues-log.md
Last active February 13, 2019 19:00
Ubuntu Graphics/HDMI Issues Log

The Problem

Started having issues on Ubuntu with the HDMI output. I hit the power button with my foot and caused the computer to restart. After, the screen was blank, save for its default message indicating to 'Check the video cable' I had tried switching the display, restarting, a different HDMI cabel, etc. I have a Gigabyte motherboard, an intel CPU, an AMD graphics card is installed, but has been broken for quite some while.

Log

@colejhudson
colejhudson / rescale.md
Created April 14, 2018 07:57
Rescaling a display on ubuntu

First by running xrandr --current you'll get a list of display connections by format, for example below I have a single HDMI cable to my display:

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
HDMI1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+  50.00    50.00    59.94  
   1680x1050     59.88  
   1600x900      60.00  
 1280x1024 60.02 
@colejhudson
colejhudson / add-toc-to-pdf.sh
Last active April 18, 2018 22:57
Table of Contents for The Princeton Companion to Mathematics. Slightly off as the ToC available from the library of congress is different from the current editions. Also the number of files here is a case study in version control.
!#/usr/bin/env bash
function add-toc-to-pdf() {
[[ ${#} -ne 3 ]] && echo -e 'usage: add-toc-to-pdf path/to/toc.txt /path/to/file.pdf /path/to/output.pdf' && return -1
[[ $(file ${2} | cut -d ' ' -f 2) != "PDF" ]] && echo -e 'Error: second argument must be a pdf.' && return -1
cpdf -add-bookmarks ${1} ${2} -o ${3}
}
@colejhudson
colejhudson / the-princeton-companion-to-mathematics-table-of-contents.txt
Created April 18, 2018 22:57
the-princeton-companion-to-mathematics-table-of-contents.txt
1 "Cover" 1
1 "Part I" 2
1 "I.1 What Is Mathematics About?" 2
1 "I.2 The Language and Grammar of Mathematics" 8
1 "I.3 Some Fundamental Mathematical Definitions" 17
1 "I.4 The General Goals of Mathematical Research" 46
1 "Part II The Origins of Modern" 74
1 "II.1 From Numbers to Number Systems" 74
1 "II.2 Geometry" 80
1 "II.3 The Development of Abstract Algebra" 93
Ng=100; % Number of genes
w=randn(1,Ng); % IQ effect of each allele
Np=1000; % Population size
g=rand(Ng,Np)<.5; % Initial population, 50% mixture of all alleles
ff=[]; % Store mean IQ
change=1e6; % Generation to modify fitness.