RaspberryPi Raspbian Minimal/Server Install


Written by

I’ve been trying to make a smaller install of the RaspberryPi‘s distro Raspbian for use as a headless server/base as a minimal install. The default image contains a full desktop environment, development tools aimed at general users and firmware for most common WiFi chipsets which are entirely unessesary for a headless server for web and dhcp services.

I’ve decided to document what I did to save me time next time I reimage my Pi.

Re-activate Root

pi@rpi:$ [login as pi]
sudo su
passwd
[new root password]
exit

Remove the user Pi

root@rpi:$ [login as root]
deluser pi
rm -R /home/pi
rm -R /home/Desktop

Update the repo and install screen and dropbear

root@rpi:$ apt-get update
apt-get -y install screen dropbear
nano /etc/default/dropbear
[change NO_START=1 to NO_START=0]

Remove uneeded packages

root@rpi:$ apt-get -y purge aspell aspell-en blt cifs-utils cups-bsd cups-client cups-common dbus-x11 dconf-gsettings-backend:armhf dconf-service desktop-base desktop-file-utils dillo ed fbset firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek fontconfig fonts-droid fonts-freefont-ttf g++ g++-4.6 galculator gconf-service gconf2 gconf2-common gdb gdbserver gettext-base ghostscript gksu glib-networking:armhf glib-networking-common glib-networking-services gnome-icon-theme gnome-themes-standard gpicview gsettings-desktop-schemas gsfonts gsfonts-x11 gstreamer0.10-pulseaudio:armhf gtk2-engines:armhf gvfs:armhf gvfs-backends gvfs-common gvfs-daemons gvfs-fuse gvfs-libs:armhf hardlink hicolor-icon-theme icelib idle idle-python2.7 idle-python3.2 idle3 ifplugd kmod krb5-locales leafpad lesstif2:armhf lightdm lightdm-gtk-greeter lua5.1 luajit lxappearance lxde lxde-common lxde-core lxde-icon-theme lxinput lxmenu-data lxpanel lxpolkit lxrandr lxsession lxsession-edit lxshortcut lxtask lxterminal man-db manpages manpages-dev menu menu-xdg midori ncdu netcat-openbsd netsurf-common netsurf-gtk obconf omxplayer openbox parted pcmanfm penguinspuzzle pistore pkg-config plymouth policykit-1 poppler-data poppler-utils pulseaudio pulseaudio-esound-compat pulseaudio-module-x11 pulseaudio-utils qdbus raspberrypi-artwork rpcbind rtkit samba-common scratch shared-mime-info smartsim smbclient squeak-plugins-scratch squeak-vm strace sudo tcl8.5 tk8.5 triggerhappy tsconf ttf-dejavu-core ttf-freefont udisks unzip usbmuxd wireless-tools wpagui wpasupplicant x11-common x11-utils x11-xkb-utils xarchiver xfonts-encodings xfonts-utils xinit xpdf xdg-utils xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics xserver-xorg-video-fbdev zenity zenity-common
apt-get -y purge libfontconfig1 libqt4-network libqt4-xml libqtcore4 libqtdbus4 ttf-bitstream-vera libwrap0 ncurses-term tcpd openssh-server openssh-blacklist openssh-blacklist-extra openssh-client
apt-get -y autoremove

Refix networking

root@rpi:$ nano /etc/network/interfaces
[remove all references to wlan0 and add eth0 as an auto up device]

Minimise Logs

root@rpi:$ nano /etc/logrotate.conf
# Keep 1 week of logs
rotate 1
compress

Reboot

root@rpi:$ reboot

These are all the edits I’ve made and now my Raspbian images is down from 2GB to 675MB

Original Article Date: 18th Feb 2013
Last Edited: 22nd Feb 2013

CSS that shouldn’t work but does…


Written by

I was messing about today with some CSS and actually wrote a snippet of CSS for the shits and giggles.

It works in Firefox and Chrome browsers but not IE; so I’m presuming it’ll work in all KHTML and Webkit browsers.

head, head title, head script, body script {display:block;}

If you know any reason why this does actually work then mail me explaining so. It shouldn’t work but for some reason it does which is crazy.

Social Media Icons…


Written by

I had written this code a few years ago for use on a website although not the icon sprite I’m including… I needed to use it recently so I’ve decided to upload it here too..

I know it’s not the most elegant solution, but it works well over all browsers and fallbacks (no CSS) gracefully as a list, finally if there isn’t an actual icon available for your social networking site, then it will default to the ‘share this’ icon.

CSS:

/* =================================================
 * @package: Social Links
 * @author: Adam Boutcher <adam@aboutcher.co.uk>
 * @link: www.aboutcher.co.uk
 * @copyright: 2013
 * @internal: Default icon is "Share This"
 * Icons are CC-Attrib3 - www.awicons.com
 * ================================================= */
.social_links{margin:0;text-align:center;}.social_links .social_t{display:block;font-variant:small-caps;margin-bottom:5px;}
.social_links ul{display:inline-block;*display:inline;*zoom:1;list-style-type:none;margin:0 auto;padding:0;}
.social_links ul li{float:left;margin:0;padding:0;}.social_links .social_i{display:block;width:36px;height:36px;overflow:hidden;margin-right:5px;color:transparent;text-indent:-9999px;background:url('/images/icons/social_sprite.png') no-repeat;}
.social_links .social_i:hover{background-position:0 -36px;}.social_links ul>li:last-child .social_i{margin-right:0;}
.social_links .fb{background-position:-36px 0;}.social_links .fb:hover{background-position:-36px -36px;} /* Facebook */
.social_links .tw{background-position:-72px 0;}.social_links .tw:hover{background-position:-72px -36px;} /* Twitter */
.social_links .gp{background-position:-108px 0;}.social_links .gp:hover{background-position:-108px -36px;}/* Google+ */
.social_links .rs{background-position:-144px 0;}.social_links .rs:hover{background-position:-144px -36px;}/* RSS Feed */
.social_links .pt{background-position:-180px 0;}.social_links .pt:hover{background-position:-180px -36px;}/* Pintrest */
.social_links .li{background-position:-216px 0;}.social_links .li:hover{background-position:-216px -36px;}/* LinkedIn */
.social_links .yt{background-position:-252px 0;}.social_links .yt:hover{background-position:-252px -36px;}/* YouTube */
.social_links .em{background-position:-288px 0;}.social_links .em:hover{background-position:-288px -36px;}/* Email */
.social_links .ad{background-position:-324px 0;}.social_links .ad:hover{background-position:-324px -36px;}/* Add */
.social_links .rd{background-position:-360px 0;}.social_links .rd:hover{background-position:-360px -36px;}/* Reddit */
.social_links .su{background-position:-396px 0;}.social_links .su:hover{background-position:-396px -36px;}/* StumbleUpon */
.social_links .dl{background-position:-432px 0;}.social_links .dl:hover{background-position:-432px -36px;}/* Delicious */
.social_links .dg{background-position:-468px 0;}.social_links .dg:hover{background-position:-468px -36px;}/* Digg */
.social_links .gh{background-position:-504px 0;}.social_links .gh:hover{background-position:-504px -36px;}/* GitHub */
.social_links .cp{background-position:-540px 0;}.social_links .cp:hover{background-position:-540px -36px;}/* CodePen */

 

HTML:

<div class="social_links"><span class="social_t">Find us on:</span>
<ul>
	<li><a class="social_i" title="Share" href="#" rel="nofollow">Share</a></li>
	<li><a class="social_i fb" title="Facebook" href="#" rel="nofollow">Facebook</a></li>
	<li><a class="social_i tw" title="Twitter: @username" href="#" rel="nofollow">Twitter</a></li>
	<li><a class="social_i gp" title="Google+" href="#" rel="nofollow">Google+</a></li>
	<li><a class="social_i rs" title="RSS Feed" href="#" rel="nofollow">RSS Feed</a></li>
	<li><a class="social_i pt" title="Pintrest" href="#" rel="nofollow">Pintrest</a></li>
	<li><a class="social_i li" title="LinkedIn" href="#" rel="nofollow">LinkedIn</a></li>
	<li><a class="social_i yt" title="YouTube" href="#" rel="nofollow">YouTube</a></li>
	<li><a class="social_i em" title="Email" href="#" rel="nofollow">Email</a></li>
	<li><a class="social_i ad" title="Add This" href="#" rel="nofollow">Add This</a></li>
	<li><a class="social_i rd" title="Reddit" href="#" rel="nofollow">Reddit</a></li>
	<li><a class="social_i su" title="Stumble Upon" href="#" rel="nofollow">StumbleUpon</a></li>
	<li><a class="social_i dl" title="Delicious" href="#" rel="nofollow">Delicious</a></li>
	<li><a class="social_i dg" title="Digg" href="#" rel="nofollow">Digg</a></li>
	<li><a class="social_i gh" title="GitHub" href="#" rel="nofollow">GitHub</a></li>
	<li><a class="social_i cp" title="CodePen" href="#" rel="nofollow">CodePen</a></li>
</ul>
</div>

Image Sprite:

Social Media Icons

Social Media Icon Sprite

 

You can see a demo of it on the footer of this site too; I will try to include other sprites if I can find the time to make them.

Edit (6th July 2013):

Added GitHub to the icon list and changed the code to be a class over an id so it can be used multiple times in the same page; also added CodePen icon.

ldir 1.8.1 released!


Written by

While using ldir within a different project, I found a couple of bugs releated to how it retrieves its own URL/URI so I figured out a better way of retrieving this information and updated ldir available to everyone else.

I have decided to deprecate the $GET parameter when using the function as it should now detect $_GET variables automatically and utilise them although this maybe still be a little buggy but the ultimate aim is for it to figure out the $_GET variables itself.

In the time it took me to write a post for version 1.8.0 I improved some of the $_GET parameter code so I incemented the version number to 1.8.1 and you can grab the latest version of ldir on its page as always

Changelog:

  • Automatic $_GET variable detection
  • Improved $_GET variable detection
  • Microtime generation time in HTML comments
  • Improved SELF detection for the link URL

Android DHCP IP Release


Written by

Just because I spent about 2 hours looking for this info…

A rooted android device with busybox can easily release the DHCP allocated IP with the following commands

su
dhcpcd -k wlan0
dhcpcd -n wlan0

turn wifi on and off and now you should have a new DHCP IP rather than a renewed IP.