Moe's Techblog

Samsung SCX-3405 as network scanner

To access a Samsung SCX3405 as scanner in your local network modify /etc/sane.de/xerox_mfp.conf :

#Samsung SCX-3400 Series
usb 0x04e8 0x344f
tcp 192.168.0.4

Sorting arrays by column

With argsort, you get the index of the sorted array, which you can use to access the original array in sorted order. By selecting a single column for the sort algorithmn you can sort the array by the different columns

Assume an array with 3 columns and N rows

arr_org = np.random.rand((20,3))

idx=arr_org[:,3].argsort() arr_sort =arr_org[idx]

USB stick gets mounted readonly

When plug in an USB stick it happens with Ubuntu that it gets mounted read-only. Even with rw mount option it is not possible to write. Often the mount point directoy is not writeable (or even accessible) to the user. This could be solved by setting the ACLs.

To see the actual access rights

$ ls -ld /media/<username>
drwxrwx---+ 2 <username> <username> 4096 Mar 4 18:32 /media/<username>

where the + charcter indicates the use of ACL. These ACL can be shown as followed

$ getfacl /media/<username>

# file: <username>/
# owner: <username>
# group: <username>
user::rwx
user:<username>:r-x
group::---
mask::r-x
other::---

In this example, the user is read only. This can be easily changed to read-write (rw)

setfacl -m u:<username>:rwx /media/<username>

Eventually you have to reset the dirty-bit of the FAT filesystem of your USB stick.

dosfsck /dev/sdc1

Multiple conditions with numpy.where

Using numpy and the numpy.where function is very powerfull. If you want to use several conditions with np.where you have to use the bitwise-AND-operator to combine to different conditions in one query. Of course you can also use the bitwise OR-operator too.

daten = np.random.rand(50,5)
sel = np.where((daten[:,0]==5) & (daten[:,1]< 17))[0]
plt.scatter(daten[sel,3], daten[sel,4])

Mousse-au-chocolat

Finally I managed to write down my recipe for mousse-au-chocolat. Till now, I did it every time by a rule of thumb estimation. This mousse-au-chocolat is NOT vegan, it contains sugar and it contains fat. And it is NOT made out of 90% chocolate. --> It really tastes good :-)

Ingredients:

  • 3 Eggs
  • 150g dark chocolate (Zartbitterschokolade)
  • 33 g icing sugar
  • half a cup of whipping cream

Melt the chocolate carefully in a double boiler. Meanwhile separate eggs and mix egg yolk with the icing sugar. Whisk the egg white stiff. Slowly give the chocolat into the yolk sugar mixture and subsequent carefully the stiff egg white also. Finally whisk the cream and add to the mousse. Keep it in a cool place (refrigerator) for some hours.

Enjoy, maybe with some raspberry sauce

Home ← Ältere Posts