Skip to content

Instantly share code, notes, and snippets.

@rdmarsh
rdmarsh / pi-tips.md
Last active June 10, 2024 10:48
Clean up the Raspbian default build for the Raspberry Pi

Remove unused packages on Raspberry Pi

(this is worth looking at http://www.stefan-seelmann.de/wiki/rasperrypi-homeserver, which is basically this:

apt-get purge --auto-remove scratch debian-reference-en dillo idle3 python3-tk idle python-pygame python-tk lightdm gnome-themes-standard gnome-icon-theme raspberrypi-artwork gvfs-backends gvfs-fuse desktop-base lxpolkit netsurf-gtk zenity xdg-utils mupdf gtk2-engines alsa-utils  lxde lxtask menu-xdg gksu midori xserver-xorg xinit xserver-xorg-video-fbdev libraspberrypi-dev libraspberrypi-doc dbus-x11 libx11-6 libx11-data libx11-xcb1 x11-common x11-utils lxde-icon-theme gconf-service gconf2-common

)

Warning: this will probably break something. If you need sound, don't remove the "alsa" packages

sudo apt-get --yes purge xserver-common x11-xfs-utils x11-xserver-utils xinit libsmbclient blt gvfs gvfs-backends gvfs-daemons gvfs-fuse idle idle-python2.7 idle-python3.2 idle3 libaudio2 libice6 liblightdm-gobject-1-0 libobrender27 libpulse0 libqt4-svg libqt

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# GoogleDNS
ifconfig eth0:1 8.8.8.8 netmask 255.255.255.0
ifconfig eth0:2 8.8.4.4 netmask 255.255.255.0
# Level3
ifconfig eth0:3 4.2.2.2 netmask 255.255.255.0
ifconfig eth0:4 4.2.2.1 netmask 255.255.255.0
ifconfig eth0:5 4.2.2.3 netmask 255.255.255.0
@rdmarsh
rdmarsh / setup-debian.sh
Last active December 18, 2015 09:39
Set up debian the way I like it.
#choose lxterm
sudo update-alternatives –config x-terminal-emulator
#choose vim.basic
sudo update-alternatives –config vi
#choose xmonad
sudo update-alternatives –config x-window-manager
#install tex/latex
@rdmarsh
rdmarsh / convert dvorak to qwerty
Last active December 19, 2015 07:09
Apple script function to convert dvorak to qwerty
--function to convert dvorak to qwerty
on dvorak_to_qwerty(dvorak_text)
set the dvorak_string to "',.pyfgcrlaoeuidhtns;qjkxbmwvz"
set the qwerty_string to "qwertyuiopasdfghjkl;zxcvbnm,./"
set the qwerty_text to ""
repeat with dvorak_char in dvorak_text
set x to the offset of dvorak_char in the dvorak_string
if x is not 0 then
set the qwerty_text to (the qwerty_text & character x of the qwerty_string) as string
else
@rdmarsh
rdmarsh / showreadonly.sh
Created August 9, 2013 03:10
Find readonly ext2,3,4 file systems
#!/bin/bash
awk '$3 ~ /^ext(2|3|4)$/ && $4 ~ /(^|,)ro($|,)/ {print $2}' /proc/mounts
@rdmarsh
rdmarsh / pad-internal-with-zero
Last active December 22, 2015 21:19
pad files to 8.3, fill with zeros
#!/usr/bin/env bash
# Pad a range of file names with extra zeros
# AA012345.EXT = AA012345.EXT
# BB012345.EXT = BB012345.EXT
# ABC.EXT = ABC00000.EXT
# ABCDE.EXT = ABCDE0000.EXT
for orgfilename in *.EXT ; do
#slice of EXT and add zeros
@rdmarsh
rdmarsh / rdmfuncs.sh
Last active July 27, 2022 15:38
standard shell script functions
#!/usr/bin/env bash
########################################
###
### This code is under version control
### See the following link before making changes
### https://gist.github.com/rdmarsh/e60f8de3da853c493518
###
########################################
@rdmarsh
rdmarsh / tent-ent-rares-near output.txt
Last active August 29, 2015 14:04
if "tent+ent=rares", what's "near"? Each letter is a digit, assume base 10
-------------
tent : 7527
ent : 527
rares : 08054
near : 2580
-------------
tent : 8528
ent : 528
rares : 09056
near : 2590
@rdmarsh
rdmarsh / dvorak-evolution.pl
Created September 10, 2014 01:04
Try and find a better keyboard layout using evolution algorithm
#!/usr/bin/perl -w
#
#kb calculation by david marsh
#
#version 1.11
#
#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.