Created a docker image for running Jupyter with common ML libraries.
https://github.com/kitsook/jupyter-xgboost-docker
Idea based on De-Mystifying XGBoost. But instead of deploying to cloud, this image focus on running the container locally.
Created a docker image for running Jupyter with common ML libraries.
https://github.com/kitsook/jupyter-xgboost-docker
Idea based on De-Mystifying XGBoost. But instead of deploying to cloud, this image focus on running the container locally.
A few notes on using the Aqara Motion Sensor P1 with zigbee2mqtt and Home Assistant.
mosquitto_pub -t 'zigbee2mqtt/the_device_friendly_name/set' -m '{"motion_sensitivity": "high"}' -u username -P password
Trying out the SparkFun Edge board. Seems there are changes to the source repositories and many online instructions are outdated.
For example, to build and deploy the micro_speech example:
Notes to self: remember to re-enable IOMMU after flashing new BIOS. Otherwise ROCm OpenCL wont work for iGPU.
Java has implicit casting (e.g. from float to double). Curious to know what is the performance impact. For example:
// direct cast to double
methodWithDoubleAsParam((double)Integer.parseInt(anInteger))
vs
// explicitly cast to float and implicitly to double
methodWithDoubleAsParam((float)Integer.parseInt(anInteger))
For the above example, when looking at the generated byte code, the direct casting used the "i2d" (integer to double) instruction. The indirect and implicit casting used "i2f" and "f2d" instructions.
......
private void lambda$run$2(java.lang.String[], int);
Code:
0: aload_0
1: aload_1
2: iconst_0
3: aaload
4: invokestatic #20 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
7: i2f
8: f2d
9: invokevirtual #21 // Method dummy:(D)V
12: return
private void lambda$run$1(java.lang.String[], int);
Code:
0: aload_0
1: aload_1
2: iconst_0
3: aaload
4: invokestatic #20 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
7: i2d
8: invokevirtual #21 // Method dummy:(D)V
11: return
......
On machine with OpenJDK 11, the extra cost for each call is about 2ns.
Full source code available.
Besides those dedicated Raspberry Pis running piCorePlayer, sometimes I wanted to simulate a Squeezebox device on my work PC to play music. The easiest way is to run Squeezelite with docker.
A minor patch to the docker run script so that I can pass in upsampling parameters to it as my USB DAC can handle up to 768kHz.
Then just start the container with something like this, where D50s is my DAC:
docker run --rm --env SQUEEZELITE_AUDIO_DEVICE=hw:CARD=D50s --env SQUEEZELITE_SPECIFY_SERVER=yes --env SQUEEZELITE_SERVER_PORT=192.168.100.6:3483 --env SQUEEZELITE_NAME=openSUSE_PC --env SQUEEZELITE_OPTS='-r 705600,768000 -R vE::4:28:99:100:50' --device /dev/snd --name squeezelite --net host -d giof71/squeezelite
Quick notes on ripping audio tracks from a DVD (Unplugged by The Corrs) using command line:
# rip dvd by track (total 17)
for i in {1..17}; do
mplayer dvd:// -chapter $i-$i -dumpstream -dumpfile $i.vob;
done
# find out which audio stream has the 2-channel pcm and copy it into a flac file
for i in {1..17}; do
tmp=`ffprobe -v error -show_format -show_streams $i.vob | grep -B 1 pcm_dvd | head -n 1 | cut -d '=' -f 2-`
ai="$(($tmp-1))"
ffmpeg -i $i.vob -map 0:a:$ai -vn -f flac $i.flac;
done
# rename flac files by track... TBD
# set metadata
for i in *.flac; do
ALBUM='Unplugged'
ARTIST='The Corrs'
tracknumber=`echo $i | cut -d ' ' -f 1 | sed 's/^0*//'`
title=`echo $i | cut -d ' ' -f 2- | cut -f 1 -d '.'`
metaflac --set-tag="ALBUM=$ALBUM" --set-tag="ARTIST=$ARTIST" --set-tag="tracknumber=$tracknumber" --set-tag="title=$title" --remove-tag=encoder "$i"
done
This is my current audio setup with free software.
Decided to try out Dart and Flutter for Android development. Some thoughts after re-implementing AndSafe:
I first implemented Android Safe 10 years ago in 2010. This re-write is certainly more enjoyable and easy, thanks to matured development environment.
Just archived my cloudflared patch repo. My patch was a hack to get around a run-away issue: when there are sudden in-rush of requests or network delay, cloudflared will create lots of connection to upstream DNS-over-HTTPS servers. This will trigger the upstream throttling cloudflared and causing it to create even more connections to upstream. The machine will ended up with high CPU usage and no DNS request being resolved.
That is because cloudflared used golang "http.Transport" for the connection without setting a max limit. My hack hard-coded the max number of connection to 2 to avoid the issue. But it is probably inappropriate if cloudflared is used in an enterprise environment.
Luckily someone worked on a fix by adding a command line parameter to specify the max connection. Just add "--max-upstream-conns num_con" as parameter when starting cloudflared.