Latest arch_remix RaspberryPi SD card image

12/03/2013

Latest arch_remix RaspberryPi SD card image

Click photo to download arch_remix_5.zip.

The .zip contains README and md5sum.txt.

embedded_termHere is a screen-shot with a BASH terminal embedded instead of python.

Happy Hacking

Latest RPi desktop – with embedded Python.

10/03/2013

Latest RPi desktop - with embedded Python.

Essential tweak for parselmouths.

Latest arch-remix

23/02/2013

screen

My Public shares got suspended. I have updated the links and they should work (for a while!) mt

 

Latest release of my arch-remix available to download.

arch_remix_3

md5sum:
c0c3df7b7300fd9fba814790bb7a0bd9  arch_remix_3.img

This is the latest release of my remix of Arch Linux for the Raspberry Pi.

I have not set up a separate user, so you log on as root, with the password “root”. (I am a Puppy Linux user at heart and we always run as root! ).

The following command will launch a graphical session:
startx

The desktop is managed by Rox and Openbox. A right-click on the desktop will bring up the openbox menu.

To power off, right click on the desktop and choose the “shut down” option from the Openbox menu.

This image overclocks the Pi to 900mhz by default. You can change this by editing /boot/config.txt.

The system comes with a bare minimum of software with which to start programming. Scratch and IDLE (Python 3.1.5) can be opened from desktop icons.

Also installed are
* Python 2.7.3 plus pygame
* MIT Scheme
* Leafpad
* Mtpaint (a useful image editor),
* Mupdf (a fast pdf reader)
* NetworkManager and nm-applet
* Tigervnc (to allow you to use a graphical interface when running headless).

If you log in via ssh and wish to use vnc, you might like to use a simple script I have written. You can launch the vnc server by  typing:
vnc.sh

You can then view this from your other computer (assuming you have a vnc viewer installed  and both computers are connected to the router) with this command:
vncviewer [address_of_pi]:1

I have compiled Python 3.1.5 from source. I prefer to use Python 3 and this version is fully supported by Pygame (which is also installed).

No browser is included, but you can easily install one with pacman, for example:
pacman -S midori

I have written a simple script which will mount the first partition of a usb drive  (which can be accessed via the openbox menu). If you want to mount other drives and partitionsYou will need to mount them manually. (See the Arch Wiki).

I have deliberately kept this installation small so it should easily fit onto a 2 gb card. As a result, it would be advisable to expand the main partition after copying it to an sd card. Instructions for how to do this can be found on the Raspberry Pi forum.

The sd card image does not include a swap partition but I have put a (commented out) entry for it in fstab, so you can use that if you make a swap on the SD card.

It’s worth noting that using the SD card for a swap partition will dramatically shorten its life. I’d recommend setting up the swap file on a real external hard drive.

Connection to the internet ought to be painless using nm-applet.

If you run into problems, leave a comment on my wordpress blog (teampython) or email me on antiloquax@sky.com.

If you are planning to try Arch and don’t have much experience, I recommend reading the Arch wiki: https://wiki.archlinux.org/

Enjoy.
antiloquax

notes:

When you open a terminal, the “archey” script displays some ascii art and system information. To disable this edit /etc/bash.bashrc

To change the openbox menu, conky and tint2 settings, look in the folder ~/.config.

dropbox_uploader.sh is a very useful script I found on github. If you run it, it will lead you through the process of setting up an app so that you can access your dropbox from the command-line. It’s a very handy tool.

RacyPy 4 released

10/02/2013

Image

If you do still do not have a Raspberry Pi, but want to try out Linux and learn programming on a PC or laptop, RacyPy 4_1may be for you.
Racy Py was featured in the first issue of the MagPi  and Liz Upton mentioned it in one of her blog posts on the RPi homepage.This edition is built on the most up to date version of Puppy Linux. (kernel is 3.0.25).
It has Python 3.1.5 including pygame (this is “a source-only security fix for 3.1.4″.)Other programming languages included are java (jdk 7u13), scala and mit scheme.

The devx (for gcc etc.) is here:

md5sum for the .iso:

c1e6e0ae46f58ffae5b432e18463a6a2  racypy4_1.iso

enjoy.

Arch SD card image #2

19/01/2013
mypi

Click to download the .zip file

New Arch sd card image.

This is a very basic installation of Arch Linux for the Raspberry Pi. I have not set up a separate user, so you log on as root, with the password “root”. (I am a Puppy Linux user at heart and we always run as root! ).

The following command will launch a graphical session:

startx

The desktop is managed by Rox and Openbox. To power off, right click on the desktop and choose the “shut down” option from the Openbox menu.

This image overclocks the Pi to 930mhz by default. You can change this by editing /boot/config.txt. The system comes with a bare minimum of software with which to start programming. Scratch and IDLE (Python 3.1.4) can be opened from desktop icons. Also installed are

* MIT Scheme,

* Leafpad,

* Mtpaint (a useful image editor),

* Mupdf (a fast pdf reader)

* wireless_tools and wpa_supplicant

* Tigervnc (to allow you to use a graphical interface when running headless).

If you log in via ssh and wish to use vnc, you might like to use a simple script I have written. You can launch the vnc server by typing:

vnc.sh

You can then view this from your other computer (assuming you have a vnc viewer installed and both computers are connected to the router) with this command: vncviewer [address_of_pi]:1 You will be prompted for a password. The password is:

button

I have compiled Python 3.1.4 from source. I prefer to use Python 3 and this version is fully supported by Pygame (which is also installed). In the /home folder, you will find some useful Python tutorials (.pdf files). When I tested on my Pi, pygame (including sound) as well as sound in Scratch, were working. If you wish you can try out a test program called “myshooter” which is the the /root/python folder and is my version of Liam Fraser’s PiShooter game.

No browser is included, but you can easily install one with pacman, for example:

pacman -S midori

I have written a simple script which will mount the first partition of a usb drive, but if you want to mount other drives and partitions, you will need to mount them manually. (See the Arch Wiki). I have deliberately kept this installation small so it should easily fit onto a 2 gb card. As a result, it would be advisable to expand the main partition after copying it to an sd card. Instructions for how to do this can be found on the Raspberry Pi forum.

The sd card image includes a swap partition and I have put an entry for it in fstab, so it should be activated on each boot. To set up wifi, you will need to read the instructions on the arch wiki. Once you have set it up, there is a simple shell script called “wifi.sh” which should allow you to connect (although depending on your network settings you may need to alter it, again, the wiki will help here). If you are planning to try Arch and don’t have much experience, I recommend reading the Arch wiki: https://wiki.archlinux.org/

Enjoy.

antiloquax

sha1sum:

7cf77ee91a6208604adc011c1d4bbb5b45654648  arch.img

RSA Algorithm

16/01/2013

I have put together some short articles with sample code, all based on mathematical algorithms in Python.

Series One

1: A. M. Legendre, exponentiation by successive squaring.
2: Heron of Alexandria, square roots
3: Peano arithmetic
4: Zeller’s congruence
5: Factorial
6: Fibonacci numbers
7: Euclid’s GCD & prime factors
8: Eratosthenes’ Sieve and the Miller-Rabin algorithm
9: Pascal’s triangle
10: Tau using Gregory and Euler’s equations

Series Two

1. Newton’s method for nth roots.
2. Primes revisited
a) faster Miller-Rabin
b) Lucas-Lehmer number
3. A Little Number Theory
a) Ramanujan’s Highly Composite Numbers
b) Ramanujan and Hardy – roundness
c) Pythagoras – perfect numbers
d) Pythagoras – friendly numbers
4. Pi
a) Euler’s method for calculating Pi
b) Cesaro / Monte Carlo method
5. The RSA algorithm

The .zip file is here.

As a little taster, here is the code of my RSA algorithm program. You can copy and paste it and have a play and download the .zip file to read my notes in the pdf file.

# rsa.py - demo of the RSA algorithm

def main():
    n = e = d = 0
    while 1:
        print("""
    1. Set Public Key
    2. Encode
    3. Decode
    0. Quit
    Your choice? """, end = "")
        choice = int(input())
        if not choice:
            return
        if choice == 1:
            n, e, d = set_keys()
        if choice == 2:
            if not n:
                n = int(input("Public Key: "))
                e = int(input("e: "))
            encode(n, e)
        if choice == 3:
            if not d:
                n, e, d = set_keys()
            decode(d, n)

def set_keys():
    """This fuction asks for 2 primes.
    It sets a public key and an encoding number, 'e'."""
    p = int(input("p: "))
    q = int(input("q: "))
    n = p * q
    m = (p - 1) * (q - 1)
    e = get_e(m)
    print("N = ", n, "\ne = ", e)
    d = get_d(e, m)
    while d < 0:
         d += m
     return [n, e, d]

     def encode(n, e):
     """This function asks for a number and encodes it using 'n' and 'e'."""
     while 1:
         c = int(input("Number to encode: "))
         if not c:
             return
         print(pow(c, e, n))

 def decode(d, n):
     """This function asks for a number and decodes it using 'd' and 'n'."""
     while 1:
         c = int(input("Number to decode: "))
         if not c:
             return
         else:
             print(pow(c, d, n))
     
  def even(x):
     """True if x is even."""
     return x % 2 == 0

  def get_e(m):
     """Finds an e coprime with m."""
     e = 2
     while gcd(e, m) != 1:
         e += 1
     return e

 def gcd(a,b):
     """Euclid's Algorithm: Takes two integers and returns gcd."""
     while b > 0:
        a, b = b, a % b
    return a

def get_d(e, m):
    """Takes encoding number, 'e' and the value for 'm' (p-1) * (q-1).
    Returns a decoding number."""
    x = lasty = 0
    lastx = y = 1
    while m != 0:
        q = e // m
        e, m = m, e % m
        x, lastx = lastx - q*x, x
        y, lasty = lasty - q*y, y
    return lastx

if __name__ == "__main__":
    main()

You can download a .zip file with the other short articles and programs here.

Enjoy!

An Arch installation to play with.

29/11/2012

I have made an image of a very simple installation of Arch with Scratch and Python3 + Pygame ready installed.

Setting up Arch is a bit more difficult than Raspbian, so this may help you see what performance benefits this distribution offers.

Download the .zip of the image here:
arch.zip – google drive
or here:
arch.zip on dropbox

The sha1sum is:
a8a44c145eabd8682f70d1a1f79c2e246dbb0ead  arch.img

There are some instructions in this file:
README.txt

I hope you find this useful!
Image

Latest Python tutorial. System arguments and stuff.

27/09/2012

Watch “Python Tutorial 13: print() and strings” on YouTube

11/08/2012

Watch “Python Tutorial 12: Turtle Graphics” on YouTube

11/08/2012