jerous' ::1

Listing of these articles
2016-12-29 [E] [D]
linux Comments 0

I was trying out to see if I could use my new tablet Lenovo Yoga Pro Tab3 10) as an external screen and projector.

The most obvious method to try this is using VNC (I haven't tried anything else yet). The script below will setup everything for you.

On the server I used TigerVNC's x0vncserver. On the host side I used AndroidVNC. For anything that is not moving (like viewing photos and reading text) this approach is doable over wifi, however watching video will require you to either cut in color depth or have a lot of patience :)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

# Source:
# * http://www.hitbits.net/2016/02/26/use-an-android-tablet-as-a-second-monitor-for-linux-pc/

# NOTE if something goes wrong, use next command to reset the screen to the default
# xrandr -s 0

SCREEN_W=1920 # Alternate
W=2560; H=1600; R=60.00 # Lenovo Yoga Tab Pro 3
W=800; H=600; R=60.00 # Lenovo Yoga Tab Pro 3 projector
VIRTUAL_MODE=${W}x${H}_${R}
MODELINE=$(gtf $W $H $R|g\rep Modeline|cut -f4- -d' ')
CUR_SCREEN=$(xrandr|grep ' connected '|cut -f1 -d' ')

xrandr --newmode $MODELINE
xrandr --addmode VIRTUAL1 "$VIRTUAL_MODE"
xrandr --output VIRTUAL1 --mode "$VIRTUAL_MODE" --right-of "$CUR_SCREEN"

IP=$(ifconfig  |grep '192\.168\|10\.0' | awk '{print $2}')
echo foo | vncpasswd -f > /tmp/vncpasswd
echo
echo "Connect from your Android device using a VNC client to "
echo "$IP : 5900 using the password 'foo' (no quotes)"
echo

# Part of tigervnc
x0vncserver --Geometry=${W}x${H}+${SCREEN_W}+0 --PasswordFile=/tmp/vncpasswd

2016-10-31 [E] [D]
hardware,linux Comments 0

Bought a eID & smart card reader, because it seems like something you need urgently at night when all stores all closed.

It works, installing pcsclite, and then starting it using

1
 sudo pcscd --debug --foreground

To use the eID: first install the eID middleware (eid-mw) from http://eid.belgium.be/nl/je_eid_gebruiken/de_eid-middleware_installeren/linux (just a configure && make && make install, mirror) and download the eid-viewer.jar (mirror).

1
java -jar eid-viewer.jar
should now show the contents of your eID.

To use the eID in firefox: install eID Belgium firefox addon (in firefox), and check if you can open it in e.g. https://certif.iamfas.belgium.be/fasui/login/eidservice.

2016-09-20 [E] [D]
bash,linux,osx,bsd Comments 0

ssh-copy-id is a very useful tool to quickly gain passwordless access to a server. However, it does not always work right away.

I've encountered this problem enough times to have written a script that will check for possible problems.

It requires 1 argument, the host to connect to, and will request for a password on the command line. Then it will check all of the following, which are known to cause some problems:

  • are there public key files?
  • sshd_config at the host
  • permission of .ssh/authorized_keys, ~/.ssh and ~

The source code can be view below, and downloaded on this link.

The requirements:

  • expect
  • ssh (obviously)
  • perl (to obtain permissions in a OS-agnostic way)

If you know other causes of problems, please inform me so I can add them :)

read more...

2016-09-19 [E] [D]
linux,bash Comments 1

Encountered this problem after upgrading my linux system, so I keep this here for future reference, and in case someone else also has this message:

1
bash: have: command not found

(or in Dutch:

1
bash: have: opdracht niet gevonden
)

Quick fix (for me at least): sudo $EDITOR /usr/share/bash-completion/bash_completion, search for "unset -f have", which is somewhere at the end of the file, and comment out the lines that have "unset have" and "unset -f have".

How did I find this out?

1
bash -x
will run bash in debug mode, meaning it will print out every command it executes. Somewhere along the lines it displayed this strange "unset have" line. Going back in the history, I found out that /usr/share/bash-completion/bash_completion was the last include, so it must've been that file!

2015-08-24 [E] [D]
hardware,linux,code Comments 0

After attempting to extract annotations from my Sony PRS-350 a long time ago, and finding only a very strange format, I decided to not pursue it further (especially as the Internet didn't have any clue about it neither).

Now that I have acquired a new ereader, the kobo aura, I thought I'd visit this topic again, but with my new toy.

My main reason to do this is that I often highlight words in ebooks for lookup. It would be great to extract them so I can have them offline for later reference and practice.

For the Kobo Aura this proves to be a breeze. Thus I made a bash script that will do all of this at once for all books for which there are annotations, and output a HTML table containing the definitions.

Download it from: translate_kobo_annots.sh (6 KiB, modified on 30 December 2015, MD5 86534491a86304faa566ce573a5b6da5) and run translate_kobo_annots.sh html -d ./dict/ (with your Kobo connected) to create an HTML file.

The read more link shows some more details, and contains a listing of the file.

read more...

2014-05-31 [E] [D]
hardware,linux Comments 0

Got myself yesterday a Lenovo Yoga Tablet 10, a 10.1" Android 4.2 tablet.

I finally decided to get a tablet, as it might be useful when playing some piano and not having to look at my laptop. Now I can just comfortably put it on my sheet music stand, and display anything I need.

I chose to get this one, as it was immediately available, not too small nor too large, with good battery life (18 hours, they report) and reasonably priced.

So far, it feels sturdy, the stand mode is quite enjoyable. The camera lacks in quality (but well, it's not as if I'm going to use it as my main camera), browsing is sometimes a bit slow (I think, as I can't really compare with other tablets) and the minimum volume is way too loud (but is a problem in general with Android, it seems).

If I find any valuable apps, I'll update this post :)

read more...

2014-05-06 [E] [D]
linux,code Comments 0

Recently I bought a Raspberry Pi which I intended to use for some little projects. One of those projects is to use it as a relay to my wireless headphone, which isn't as portable as I would've liked: the basestation needs to be connected to the audio-out jack of my laptop, making my laptop rather immobile.

So I had to the idea of plugging the wireless headphone basestation into the Raspberry Pi, and send my laptop's audio data over wifi to the RPi.

There are a couple of solutions, involving jack and pulseaudio, but I wanted something very simple (both jack and pulseaudio took longer than I wanted to get it working, even though the time I put in might be more than the time I would've, researching more PA or jack :)).

My initial idea was to capture ALSA's output, redirect it to a fifo that get's piped to Raspberry, where a player like aplay just plays it onto the jack-out.

In what follows, I refer to the raspberry as speakers and server as the one producing the sound, like a laptop.

TLDR: Update ~/.asoundrc, download audio-streamer.sh and execute ./audio-streamer.sh --both speakers-ip

read more...

2012-07-31 [E] [D]
osx,bash,linux Comments 0

An interesting set of dot-files https://github.com/mathiasbynens/dotfiles.

2012-06-12 [E] [D]
bash,code,linux Comments 0

Sometimes I perform some parameter studies with bash. Having four cores, it would be a shame to only use one of them. One could just background all processes, and let the OS manage it. This will result in bad performance.

It would be wiser to at all times allow at most four scripts to run simultaneously. Bash does not provide such facility. Hence, below is a script which can be sourced.

The script allows tuning the MAX_NPROC parameter, the maximum number of simultaneous scripts.

Available functions are

  • new_job (for regular commands with pipes and stuff),
  • new_job_f (for internal functions),
  • wait_jobs (wait for completion) and
  • kill_jobs (kill all running jobs).

Download ppool.sh, or click the view more link to view the contents.

read more...

2012-05-22 [E] [D]
bash,linux,osx Comments 0

Resolving a path in bash in a cross platform way:

1
2
3
4
function resolve_path {
    cd "$(dirname "$1")"
    pwd
}

or oneliner

1
path="$(cd "$(dirname "$path")"; pwd)";

To get the full path of the current script, one can use

1
path="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd  )"
which works regardless of $0's value.

Listing of these articles Download these articles
[printer friendly] [static version] [Post listing] [Page listing] [Tags: music tab jazz travel wdb europe code live programming youtube record ]