Posts

Time to talk about google app engine, flex , standard , php, and google cloud storage. I've been doing some experimenting using GAE to make a service like cloudinary.  It's pretty simple to do, using imagick, which is installed in GAE.  But here are some simple discoveries; 1)  GAE flex, sounds like GAE standard, but it's not.  if using php55 it's quite different.  with php72 now launched in standard, it's closer to flex, you need a front_controller, and your app.yaml is simpler 2) GAE standard scales really quickly, like to 10k instances in 1 to 2 mins.  Flex takes a LOT longer, think 30 mins 3) GAE can use imagick, imagick is not fast, and cpu intensive , fetching an image from a GCS bucket and rendering it cropped or resized is a 1-2 second operation. you could use appengines image api, but for php it's limited to getservingurl functions. unless you want to write protobuf interfaces . In python, it's way more useful, you can do all the usual t...

load testing

I have used apache bench, and more recently artillery.io tools, but it still wasn't ideal.  I came across this tool which will do a better job for basic testing https://github.com/wg/wrk

Sky Q tuning with a Meter

Image
Using a sky Q compatible LNB, you can still tune with a regular digital tuner.  The analogue inline tuners won't get enough voltage to work right. I use a satlink ws-6933, and set it to a vertical transponder and hooked it to the vertical output of the LNB, without doing that you will get a signal measurement with no quality measurement Below are the screen shots of sky Q signal on the meter and in the sky Q UI too.

FreeBSD in GCE

Yes there are supported images of amd64 freebsd available in GCE to boot, but I needed an i386 variant so here are the steps I took. I downloaded the mini memstick image, converted it to a disk format virtualbox recognised VBoxManage.exe convertfromraw FreeBSD-11.1-RELEASE-amd64-mini-memstick.img FreeBSD-11.1-RELEASE-amd64-mini-memstick.vdi  --format vdi Then made a virtual machine with that as it's disk, booted and chose the shell option, then remounted as read/write, and put this into /boot/loader.conf mount -o rw /dev/ufs/FreeBSD_install / boot_multicons="YES" boot_serial="YES" comconsole_speed="115200" console="comconsole,vidconsole" then shutdown the machine (gracefully!) now I have an image that supports install via a serial port, just need to make it the right format for GCE to consider as a boot disk VBoxManage.exe clonehd FreeBSD-11.1-RELEASE-amd64-mini-memstick.vdi disk.raw --format raw tar -Sczf /tmp/compress...

Controlling an LG soundbar

As part of my home automation configuration, I wanted to figure out how to control my soundbar. Seems it's not documented, there isn't an API, but there is an Android App.  So I installed Genymotion, set the nic to be bridged and used wireshark to sniff what the app was doing.  I saw udp packets for each key, so copied the data, and used it like this.... Mute: 080312002a0808011204081a1002 followed by 080312002a0808011204081a1001  Vol down: 080312002a080801120408191002 then 080312002a080801120408191001 Vol up: 080312002a080801120408181002 then 080312002a080801120408181001 Power off: 080312002a080801120408011002 then 080312002a080801120408011001  switching inputs (optical/bluetooth/home):  080312002a0808011204084d1002 then 080312002a0808011204084d1001 So, to send this udp data to a sound bar at 1.2.3.4 address  echo "080312002a080801120408011002" | xxd -r -p > /dev/udp/1.2.3.4/9741  netcat seemed quite...

caching a webcam

I Recently tried to use a webcam on the internet and it was unusable because too many people were using it. Taking a peek, it was clear it was simple jpgs being refreshed by client side JS , using the built in webui in the camera itself, the hardware just couldn't handle too many users. So I setup some urls and cloudfront to cache, and then an nginx proxy which would do the right thing with headers to make the images cache friendly.  Then reached out to the webmaster and talked them through what to do Next step is to consider changing the client JS to not just increment a number in the url, which is ignored by the CDN, but maybe find some other way to cache to you get better than one frame a second. server { listen  8888; access_log      /var/log/nginx/cam1.access.log; error_log       /var/log/nginx/cam1.error.log; server_name cam1.test.com; location / {     add_header Pragma public;     add_header Cach...

home automation, alexa and an LG lm660 series tv, cctv and more

I thought I'd try alexa, and so it began .... Alexa (unlike google home) talks over your LAN to philips HUE devices, so you can simply setup a fake hue bridge to interface with alexa.  this is much easier than the official lambda foo you have to do in aws. I also had  domoticz setup, tracking my solar usage, electrical usage, and Nest data.  So, using habridge I ended up connecting habridge to domoticz, but will probably remove that integration, and just do habridge direct to my scripts. in domoticz I setup virtual switches that ran scripts, so habridge saw these switches and presented them like hue lights to alexa, so I can say things like 'alexa turn on sky tv' , or 'alexa turn on netflix' My two interesting problems were 1) how to turn on my tv, as it doesn't have WOL, and 2) how to handle CCTV (not really alexa related) My tv is an LG lm660t , which doesn't have WOL, so looked at solutions to use infra red to turn it on, but it all felt pr...