Backup and restore RPi SDCard on MAC OS

At first, find the disk corresponding to your Pi’s SD card:
Open Terminal, run diskutil list:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            319.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   *0 B        disk1
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *2.0 GB     disk2
   1:             Windows_FAT_32 boot                    58.7 MB    disk2s1
   2:                      Linux                         1.9 GB     disk2s2

Clearly /dev/disk2 is my 2GB SD card, the Linux partition name is also a bit of a clue.
However, instead of using /dev/disk2 with dd, you should use /dev/rdisk2

On the Mac you don’t want to be using /dev/diskn, you should use /dev/rdiskn instead, where n is the number the OS uses to identify your SD card. This decreases the time required to copy by a huge amount. Continue reading Backup and restore RPi SDCard on MAC OS

Running a lightweight webserver on the Raspberry Pi (lighttpd)

Running a lightweight webserver on the Raspberry Pi (lighttpd)

This guide covers setting up a light webserver on Linux using the lighttpd web server on the Raspberry Pi. Most of these instructions can also be applied to other Debian or Ubuntu based distributions (except the tasks using the raspi-config tool). I’ve already written a tutorial based on the “full-fat” Apache webserver (running a LAMP Apache based webserver on the Raspbbery Pi).

Continue reading Running a lightweight webserver on the Raspberry Pi (lighttpd)

USBasp on Ubuntu without sudo

Connect your USBasp to computer.

Use this command to check if the computer recognize it:
# dmesg
[ 4734.960248] usb 5-1: new low-speed USB device number 21 using uhci_hcd
[ 4735.128594] usb 5-1: New USB device found, idVendor=16c0, idProduct=05dc
[ 4735.128607] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4735.128614] usb 5-1: Product: USBasp
[ 4735.128621] usb 5-1: Manufacturer: www.fischl.de

Check your USBasp bus# and device#:

# lsusb
Bus 003 Device 002: ID 413c:8140 Dell Computer Corp. Wireless 360 Bluetooth
Bus 005 Device 021: ID 16c0:05dc VOTI shared ID for use with libusb
Bus 005 Device 017: ID 1c4f:0034 SiGma Micro
Bus 007 Device 002: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 003: ID 0b97:7772 O2 Micro, Inc. OZ776 CCID Smartcard Reader

Check device info:
# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/[bus#]/[device#])

# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/005/021)
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device ‘/devices/pci0000:00/0000:00:1d.0/usb5/5-1’:
KERNEL==”5-1″
SUBSYSTEM==”usb”
DRIVER==”usb”
ATTR{bDeviceSubClass}==”00″
ATTR{bDeviceProtocol}==”00″
ATTR{devpath}==”1″
ATTR{idVendor}==”16c0″
ATTR{speed}==”1.5″
ATTR{bNumInterfaces}==” 1″
ATTR{bConfigurationValue}==”1″
ATTR{bMaxPacketSize0}==”8″
ATTR{busnum}==”5″
ATTR{devnum}==”21″
ATTR{configuration}==””
ATTR{bMaxPower}==”50mA”
ATTR{authorized}==”1″
ATTR{bmAttributes}==”80″
ATTR{bNumConfigurations}==”1″
ATTR{maxchild}==”0″
ATTR{bcdDevice}==”0103″
ATTR{avoid_reset_quirk}==”0″
ATTR{quirks}==”0x0″
ATTR{version}==” 1.10″
ATTR{urbnum}==”115″
ATTR{ltm_capable}==”no”
ATTR{manufacturer}==”www.fischl.de”
ATTR{removable}==”unknown”
ATTR{idProduct}==”05dc”
ATTR{bDeviceClass}==”ff”
ATTR{product}==”USBasp”

looking at parent device ‘/devices/pci0000:00/0000:00:1d.0/usb5’:
KERNELS==”usb5″
SUBSYSTEMS==”usb”
DRIVERS==”usb”
ATTRS{bDeviceSubClass}==”00″
ATTRS{bDeviceProtocol}==”00″
ATTRS{devpath}==”0″
ATTRS{idVendor}==”1d6b”
ATTRS{speed}==”12″
ATTRS{bNumInterfaces}==” 1″
ATTRS{bConfigurationValue}==”1″
ATTRS{bMaxPacketSize0}==”64″
ATTRS{authorized_default}==”1″
ATTRS{busnum}==”5″
ATTRS{devnum}==”1″
ATTRS{configuration}==””
ATTRS{bMaxPower}==”0mA”
ATTRS{authorized}==”1″
ATTRS{bmAttributes}==”e0″
ATTRS{bNumConfigurations}==”1″
ATTRS{maxchild}==”2″
ATTRS{bcdDevice}==”0308″
ATTRS{avoid_reset_quirk}==”0″
ATTRS{quirks}==”0x0″
ATTRS{serial}==”0000:00:1d.0″
ATTRS{version}==” 1.10″
ATTRS{urbnum}==”416″
ATTRS{ltm_capable}==”no”
ATTRS{manufacturer}==”Linux 3.8.0-29-generic uhci_hcd”
ATTRS{removable}==”unknown”
ATTRS{idProduct}==”0001″
ATTRS{bDeviceClass}==”09″
ATTRS{product}==”UHCI Host Controller”

looking at parent device ‘/devices/pci0000:00/0000:00:1d.0’:
KERNELS==”0000:00:1d.0″
SUBSYSTEMS==”pci”
DRIVERS==”uhci_hcd”
ATTRS{irq}==”20″
ATTRS{subsystem_vendor}==”0x1028″
ATTRS{broken_parity_status}==”0″
ATTRS{class}==”0x0c0300″
ATTRS{consistent_dma_mask_bits}==”32″
ATTRS{dma_mask_bits}==”32″
ATTRS{local_cpus}==”00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003″
ATTRS{device}==”0x2830″
ATTRS{msi_bus}==””
ATTRS{local_cpulist}==”0-1″
ATTRS{vendor}==”0x8086″
ATTRS{subsystem_device}==”0x01f9″
ATTRS{numa_node}==”-1″
ATTRS{d3cold_allowed}==”0″

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

Create file usbasp.rules in /etc/udev/rules.d with content:

SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="adm", MODE="0666"

Resstart udev:

# sudo restart udev

Then just unplug and plug the USBasp device again.

Sumber: https://www.skiews.com/usbasp-on-ubuntu-without-sudo-2/

10 Things To Do After Installing Ubuntu 15.10

Your Ubuntu 15.10 Wily Werewolf download has finished, and installation has begun. Now you’re wondering what to do next.

Well, no worries, we’re here to help.

Below you’ll find our list of the top 10 things to do after installing Ubuntu.

You’ll find plenty of useful tips and suggestion in this post if you’re new to Ubuntu. It’s not comprehensive though so do also check out the comments at the bottom to read other users’ advice about their post-install must-dos!

Waffle served up, now for the cream.

1. Learn What’s New

ubuntu-1510-wily-werewolf

Ubuntu 15.10 Wily Werewolf may lack the bite of its namesake but there is still some nifty new changes shipping inside it. Continue reading 10 Things To Do After Installing Ubuntu 15.10

Sets and Frozensets

Introduction

Graphical Depiction of Sets as Circles The philosopher Wittgenstein didn’t like the set theory and complained mathematics is “ridden through and through with the pernicious idioms of set theory,” He dismissed the set theory as “utter nonsense”, as being “laughable” and “wrong”. His criticism appeared years after the death of the German mathematician Georg Cantor, the founder of the set theory.

Cantor defined a set at the beginning of his “Beiträge zur Begründung der transfiniten Mengenlehre”:
“A set is a gathering together into a whole of definite, distinct objects of our perception and of our thought – which are called elements of the set.” Nowadays, we can say in “plain” English: A set is a well defined collection of objects.

The elements or members of a set can be anything: numbers, characters, words, names, letters of the alphabet, even other sets, and so on. Sets are usually denoted with capital letters. This is not the exact mathematical definition, but it is good enough for the following. Continue reading Sets and Frozensets

Dictionaries

Introduction

We have already become acquainted with lists in the previous chapter. In this chapter of our online Python course we will present the dictionaries and the operators and methods on dictionaries. Python programs or scripts without lists and dictionaries are nearly inconceivable. Like lists dictionaries can easily be changed, can be shrunk and grown ad libitum at run time. They shrink and grow without the necessity of making copies. Dictionaries can be contained in lists and vice versa. But what’s the difference between lists and dictionaries? Lists are ordered sets of objects, whereas dictionaries are unordered sets. But the main difference is that items in dictionaries are accessed via keys and not via their position. A dictionary is an associative array (also known as hashes). Any key of the dictionary is associated (or mapped) to a value. The values of a dictionary can be any Python data type. So dictionaries are unordered key-value-pairs.

Dictionary don’t support the sequence operation of the sequence data types like strings, tuples and lists. Dictionaries belong to the built-in mapping type. They are the sole representative of this kind!

At the end of this chapter, we will show how a dictionary can be turned into one list, containing (key,value)-tuples or two lists, i.e. one with the keys and one with the values. This transformation can be done reversely as well. Continue reading Dictionaries

print

Introduction

There are hardly any computer programs and of course hardly any Python programs, which don’t communicate with the outside world. Above a ll a program has to deliver its result in some way. One form of output goes to the standard output by using the print statement in Python. 1

>>> print "Hello User"
Hello User
>>> answer = 42
>>> print "The answer is: " + str(antwort)
The answer is: 42
>>> 

It’s possible to put the arguments inside of parentheses: Continue reading print

"Bacalah (dengan menyebut) nama Tuhanmu yang menciptakan"