Jul 092023
 

So a bit over a week after I couldn’t sleep, tossing and turning in bed when I first came up with the idea of ZeroTier-Console, the first release is ready for some field trials!

Continue reading »
Share
Jul 052023
 

Recorded a quick video of me using and then breaking ZeroTier-Console.

Any suggestions / feedback welcome! Though I’m aware that there are some misspellings in there at the moment lol

Share
Jul 032023
 

I was going to write up a blog post about setting up a self-hosted Zerotier server when I came to the realisation that there wasn’t really any good management tools for the CLI for ZeroTier.

The “Getting Started” guide from ZeroTier is pretty sparse on explanations on what things do, with some curl commands thrown into the mix to do things like create networks, authorise members, and things like that, but that is nowhere near convenient to use on a command line, though that is made pretty clear by the end of first page where they say

You’d likely build yourself something fancier around this API.

And they were right! I built something slightly fancier! Introducing Zerotier-Console!

Continue reading »
Share
Jan 222013
 

Hey Everyone

I’ve had issues with my WiFi in the past, and with my Pi running headless it’s sometimes a pain to get it connected back up to WiFi, so I’ve created this little script to start hostapd and dnsmasq whenever the WiFi connection went down, which allowed me to SSH into the Pi even though it wasn’t connected to the network, because it was broadcasting it’s own network !

This can be customised to do different things if either WiFi or ethernet go down.


#!/bin/bash
#
# Interface checker
# Checks to see whether interface has an IP address, if it doesn't assume it's down and start hostapd
# Author : SirLagz
#
Interface='wlan0'
HostAPDIP='10.0.0.1'
echo "-----------------------------------"
echo "Checking connectivity of $Interface"
NetworkUp=`/sbin/ifconfig $Interface`
IP=`echo "$NetworkUp" | grep inet | wc -l`
if [[ $IP -eq 0 ]]; then
echo "Connection is down"
hostapd=`pidof hostapd`
if [[ -z $hostapd ]]; then
# If there are any more actions required when the interface goes down, add them here
echo "Attempting to start hostapd"
/etc/init.d/hostapd start
echo "Attempting to start dnsmasq"
/etc/init.d/dnsmasq start
echo "Setting IP Address for wlan0"
/sbin/ifconfig wlan0 $HostAPDIP netmask 255.255.255.0 up
fi
elif [[ $IP -eq 1 && $NetworkUp =~ $HostAPDIP ]]; then
echo "IP is $HostAPDIP - hostapd is running"
else
echo "Connection is up"
hostapd=`pidof hostapd`
if [[ ! -z $hostapd ]]; then
echo "Attempting to stop hostapd"
/etc/init.d/hostapd stop
echo "Attempting to stop dnsmasq"
/etc/init.d/dnsmasq stop
echo "Renewing IP Address for $Interface"
/sbin/dhclient wlan0
fi
fi
echo "-----------------------------------"

Share
Apr 262012
 

I have created an updated version here

I’ve created an update of the Raspberry Pi Memory Split Selector Script that has been cleaned up a bit and functions a bit differently.
The new script can detect the current memory that the system is showing, as well as determining which file has been activated.
Changing the active split will result in the script removing start.elf and copying the relevant elf file to start.elf to enable the new RAM split.
Once again, feedback is most welcome either in this post or in this thread.

The script can be downloaded from here.

Update – a new version has been created from some feedback on the forums, Get it here

Below is the code –

#!/bin/bash
##
## Raspberry Pi Memory Split Selector Script v2
## Author: SirLagz
## Website: http://sirlagz.net
##
## The purpose of this script is to make selecting the memory split
## on the RPi easy.
## Simply make this script executable if it's not already, move
## it to the directory with the elf files, and run it with ./select2.sh
## The menu should be pretty self explanatory.
##
clear
list=./*
b128det=0
b192det=0
b224det=0
bdefdet=0

for i in $list
do
case $i in
"./arm128_start.elf") b128det=1;;
"./arm192_start.elf") b192det=1;;
"./arm224_start.elf") b224det=1;;
"./start.elf") bdefdet=1;;
esac
done

if [[ "$bdefdet" -eq 0 ]] ; then
cp arm192_start.elf start.elf
current=192
fi

if [[ "$b192det" == "$bdefdet" ]] ; then
diffresult=`diff arm192_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=192
fi
fi

if [[ "$b128det" == "$bdefdet" ]] ; then
diffresult=`diff arm128_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=128
fi
fi

if [[ "$b224det" == "$bdefdet" ]] ; then
diffresult=`diff arm224_start.elf start.elf`
if [[ -z $diffresult ]] ; then
current=224
fi
fi

declare -i vram
vram=256-$current
sysram=`cat /proc/meminfo | grep MemTotal | awk -F\ '{ printf("%.0f",$2/1024) }'`
echo "##################################"
echo "## Raspberry Pi Memory ##"
echo "## Selector Script ##"
echo "##################################"
echo " Current Memory Split"
echo " CPU $current/$vram VRAM"
echo " Detected System RAM"
echo " $sysram MB"
echo "##################################"
case $current in
128)
echo "1) Set CPU/VRAM split to 192/64"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
192)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 224/32"
echo "3) Quit"
;;
224)
echo "1) Set CPU/VRAM split to 128/128"
echo "2) Set CPU/VRAM split to 192/64"
echo "3) Quit"
;;
*)
echo "Invalid memory detected"
;;
esac
echo "Enter Choice:";
read x

case $x in
1)
case $current in
128)
rm start.elf && cp arm192_start.elf start.elf
;;
192)
rm start.elf && cp arm128_start.elf start.elf
;;
224)
rm start.elf && cp arm128_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
2)
case $current in
128)
rm start.elf && cp arm224_start.elf start.elf
;;
192)
rm start.elf && cp arm224_start.elf start.elf
;;
224)
rm start.elf && cp arm192_start.elf start.elf
;;
*)
echo "Invalid memory detected"
;;
esac
;;
3) exit 0;;
esac
if [[ $? -ne 0 ]]; then
echo "Memory Split setting failed"
fi

Share