Skip to content

Instantly share code, notes, and snippets.

@calebreister
calebreister / csv.lua
Created April 28, 2017 17:21
Lua script that converts a CSV file to the LaTeX tabular format
--To include this file, use
--dofile('csv.lua') or require('csv')
--Function to convert a *SV file to a Lua array
--file: the name of the file to read
--delim: the delimeter (default ',')
function dataToTable(file, delim)
--Set initial values
if delim == nil then --allow delim to be optional
delim = ','
@calebreister
calebreister / .emacs
Created July 5, 2016 01:22
Emacs and Nano configuration files with (mostly) matching key combinations.
(add-to-list 'load-path "~/.emacs.d/lisp")
(add-to-list 'default-frame-alist '(fullscreen . maximized))
; Load modules
(load "sr-speedbar.elc") ;CEDET speedbar in current frame
(load "modeline-posn.elc") ;Show position of point
(load "doc-mode.elc") ;Doxygen mode
(load "lua-mode.elc") ;Lua mode
(load "markdown-mode.elc") ;Markdown mode
(load "bind-key.elc") ;Useful keybinding functions
@calebreister
calebreister / resistor.py
Last active May 17, 2021 17:21
Python script to determine optimal resistor combinations. Its arguments are a desired resistance and either 10%, 5% (default), or 1% tolerance value. I intend to refine and expand this code and then implement it in several other languages (Matlab, Lua, TI-BASIC, ...). Based loosely on http://www.qsl.net/in3otd/parallr.html.
#!/usr/bin/python3
#Copyright (C) 2016 Caleb Reister
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
@calebreister
calebreister / ArchInstall-Encrypted.md
Last active January 9, 2017 04:47
This file contains my notes from installing Arch Linux on my new(er) computer. It uses dm-crypt and LUKS to encrypt the entire hard drive (including /boot). So far, it has preformed well. NOTE: some of this is specific to my machine, but the encryption and filesystem setup is not.

Arch Linux w/ Encryption Installation Notes

These are my notes for installing Arch Linux with full-disk encryption on a HDD. The installation process changes significantly for an SSD.

Install system

$ lsblk #list devices
$ timedatectl set-ntp true

I will create the following partition layout...

@calebreister
calebreister / xkcd.py
Last active July 15, 2016 16:42
Python script that downloads xkcd comics to basePath, prepends the comic number to the filename, and puts the alt text in 0-alt.txt. I recommend setting basePath to an absolute path.
#!/usr/bin/python
#Download xkcd comics by their index numbers (passed as arguments)
import sys
import re
import json
from urllib.request import *
basePath = '/home/caleb/Pictures/Comics/xkcd/'
#Read alt text file into memory
@calebreister
calebreister / backup.sh
Last active December 15, 2015 07:21
New and updated version of backup.sh. The old script had many limitations and was often unreliable. This script, while requiring slightly more user input, is much more robust.
#!/bin/sh
#Find a date in file name:
#ls | grep -E $datematch
increment() {
# Creates a backup version of a btrfs subvolume and sends it to to an
# external drive. Assumes there are drives mounted in ./hd and ./bu
# $1 subvolume to backup
# $2 date of parent
@calebreister
calebreister / resistors.js
Last active September 3, 2015 06:40
Very useful JavaScript that can approximate a given resistor value using parallel and series configurations. (http://www.qsl.net/in3otd/parallr.html)
//<![CDATA[
/* Copyright (C) 2001-2010 Claudio Girardi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
@calebreister
calebreister / unicode.txt
Created May 12, 2015 05:21
A categorized and sorted collection of useful Unicode characters.
Quick Access:
± · √ ≠ ≈ ≤≥ ≡
° ℓ ∠ ∞ ⅇ ⅉ
∴ ⇒ ⇔ ∵ ∀ ∈ ℝ ℂ
α β Δδ θ Φφ μ τ Ωω
Operators: ±∓ ×· ÷ √∛ ≠ ≈ ≤≥ ≪≫ ≡≢ ⨁⊕⊖ ⨂⊗⨀⊙
Calculus: ∫ ℒ ℱ ∑ ∂ ′
Special: ∞ ℓ ⇀ ∠∡ ° ∇ ⅇ ⅉ x̄ ∥⊥ ℑ ℜ ℛ ℋ
Logic: ∴ ⇒ ⇔ ∵ ¬ ∃ ∄ ⋎ ⋏
EDMA3_DRV_Handle* hi2cEdma;
GIO_Handle i2c_outHandle;
GIO_Handle i2c_inHandle;
I2c_Params i2cParams;
//----------------------------------------------------------------
// Setup I2C
//----------------------------------------------------------------
void I2C_init(EDMA3_DRV_Handle* hEdma) {
I2c_ChanParams chanParams;

Assuming that you have a program running in the foreground, press ctrl-Z, then:

[1]+  Stopped                 myprogram
$ disown -h %1
$ bg 1
[1]+ myprogram &
$ logout

If there is only one job, then you don't need to specify the job number. Just use disown -h and bg. Explanation of the above steps: