Sunday, November 6, 2016

Freedom

Freedom comes from having a community and the resultant government that is uninterested in your private life.  

A government that does not care what you do in your bedroom and is indifferent to what books and movies you enjoy. 

Freedom does not arise from an individual being able to hide 'offences' from authorities, it arises from the community not wanting to make a person's personal life subject to moralistic oppression.

In western democracies the overwhelming source of oppression comes from criminals. And only minor secondary oppression from inaccurate legal attention. 


Proper means of detecting offences and freeing the legal system from haphazard targeting of the innocent should be welcomed.

That's why I support centralised databases of proper authentication such as finger prints, DNA and iris scans.

Wednesday, October 26, 2016

Truncate or empty all docker container logs



After a while of dockering you'll have too much in your logs.  This command:

docker-compose logs -f 

Will take ages to show anything recent.  So you'll want to truncate those logs.

First run docker info to find where your docker logs are kept.  Example:

~/docker $ docker info
Containers: 68
 Running: 7
 Paused: 0
....
....
Docker Root Dir: /var/lib/docker

The docker root dir: is where you'll search.  Alternatively, use this command to see the docker root dir:

docker info | grep "Docker Root Dir: " | awk '{print $NF}'

This command should truncate all the docker logs to zero length.

sudo truncate -s 0 $(sudo find /var/lib/docker/containers/ -name "*-json.log")

To view the total bytes used by logs files:


sudo find /var/lib/docker/containers/ -name "*-json.log" -exec du -ch {} + | grep total$



Monday, November 30, 2015

HP ProBook 4730s - enabling vt-x

I'm working on a new DevOps system that relies upon Chef, Vagrant and VirtualBox.  To duplicate the system I needed to run Ubuntu Trusty 64 bit edition in the virtual box.  Vagrant setup failed with timeouts.  When I ran the 64 bit VM Vagrant made through the VirtualBox client it said I did not have VT-x visualization on my machine.

I have a HP ProBook 4730s.

As you can see it uses i5-2430M CPUs.  Checking at http://ark.intel.com/products/53450/Intel-Core-i5-2430M-Processor-3M-Cache-up-to-3_00-GHz , shows that :
So, why won't VirtualBox work?  The answer lays in the HP bios.  To enable:

Restart notebook.
Press F10
Choose system features
Device features
Virtualisation
check.
Save
Reboot.

VirtualBox still refuses to run ubuntu 64.  Some googling reveals you have to enable the bios to change the setting, rather than just view.  WTF?

Restart notebook
Press F10
Choose security
Some stupid setting
save
reboot

Now it works.

Connecting to vagrant using NppFTP and Notepad++

Notepad++ comes with a great plugin to enable editing remote files or files on virtual boxes.  It can be a bit of a mystery to setup.  I'll explain what I do to allow editing on a Vagrant box on your Windows PC.


  1. start vagrant using vagrant up
  2. start notepad++
  3. open the NppFTP plugin from the plugins menu.
  4. click on the setup gear and choose 'profile settings'
  5. click on the add new profile button
  6. give it a good name and click OK
  7. click on the connection tag
  8. enter the ssh port number your vagrant box is using, it'll be 2222 or a variant of that.
  9. enter these parameters:  
  10.    hostname: 127.0.0.1
  11.    connection type: SFTP
  12.    username: vagrant
  13.    uncheck 'ask for password'
  14. click on the Authentication tab
  15. check 'Try private key file authentication'
  16. click the '...' next to the 'Private key file' edit box.
  17. navigate in the file dialog to your Vagrant box location
  18. select this file: '.vagrant\machines\default\virtualbox\private_key'
  19. uncheck 'ask every time'
  20. click close

That should setup the connection.  Try it out by using the  icon.  Click on the  icon to see the log of NppFTP connection attempts.


Tuesday, October 22, 2013

Use curl to get picture from Kogan ip camera

curl  http://10.0.0.90:90/snapshot.cgi -u admin: > x2.jpg

Thursday, May 9, 2013

Paleo twaddle


Menu:

2 Poached eggs
Baby spinach
Bacon
Mushrooms
Tomato
Avocado.
+
Regular coffee.

How much of this is really part of a Paleo diet?  From wikipedia: "The Paleolithic..., is a prehistoric period of human history distinguished by the development of the most primitive stone tools discovered... and covers roughly 99% of human technological prehistory. It extends from the earliest known use of stone tools, probably by hominins such asaustralopithecines, 2.6 million years ago, to the end of the Pleistocene around 10,000 BP"

So; 10,000 years ago what parts of these menu items would a paleo eater have to eat?

Poached eggs?  Nope, chickens were domesticated in southeast asia only a few thousand BCE.  And chickens are native to southeast Asia, so no way they could have been eaten on the African savanna.

Spinach?  Dunno.  Seems to have been from Persia, so maybe.

Bacon?  Same situation as chickens.  Another southeast asian native.

Mushrooms? Very probably.

Tomato?  A native plant of south America, so no, not available.

Avocado.  Ummm. The avocado (Persea americana) is a tree native to Central Mexico. FAIL.

Coffee; it was only harvested in Ethiopian highlands in the last few thousand years.

Yumm, a big plate of mushrooms is what you need to keep authentic paleo.

Saturday, March 2, 2013

dojox charting tooltip function



Want to have a custom tool tip on your dojox chart?  The easiest thing to do is to use a custom function when creating the Tooltip object.

First: Add the require for the tool tip.

dojo.require( 'dojox.charting.action2d.Tooltip' );

Second: define the function to be used when a tooltip is required.


new dojox.charting.action2d.Tooltip(chart1, "default", {
text : function(o) {
return ( o.run.name +'<br>' + o.y ); 
} );

As you can see the tool tip function is passed the o object.  This object describes the chart, series and plots you'll need to make a nice tool tip.  What you need is the o.run.name, which is the name of the series and o.y, which is the value of the data point on the y axis.  Combined with <br> you'll get a two line tool tip.

Well, this is a three liner, but it looks much the same.  That's because I used a more complicated tool tip function that uses the label function to add the x axis label to the tool tip.