Category Archives: Uncategorized

Random Links from Wisdom Stockholm Part 2

The Limits to Growth
The Limits to Growth is a 1972 book about the computer simulation of exponential economic and population growth with finite resource supplies.

EdX offers free online courses and classes. Find the latest MOOC from the world’s best universities including MIT, Harvard, Berkeley, UT and others.

Impact Hub
Part innovation lab, part business incubator, and part community center, It offers a unique ecosystem of resources, inspiration, and collaboration opportunities to grow impact.

GABV Banks
The Global Alliance for Banking on Values is an independent network of banks using finance to deliver sustainable economic, social and environmental development.

The Theory of Moral Sentiments
Adam Smith’s Theory of Moral Sentiments is a text of central importance in the history of moral and political thought.

Happiness, welfare or human flourishing

4 Platonic Virtues

  • Temperance
  • Courage
  • Wisdom
  • Judgement

The Culture Creatives
“Values are the best single predictor of real behavior”

Gallup Strenghts Finder

Entrepreneur First
Entrepreneur First helps Europe’s best technical individuals build world-class, high growth startups.

The Growth Mindset

The Impossible just takes a little longer
How to live every day with purpose and passion

Random Links from WisdomStockholm Part 1

The Spirit Level (Book)
Why do we mistrust people more in the UK than in Japan? Why do Americans have higher rates of teenage pregnancy than the French? What makes the Swedish thinner than the Australians? The answer: inequality.

Kennedy on GDP
Great speech by Kennedy on what’s wrong with GDP as a measurement

The Lost Generation
Another moving video

Growing unequal – OECD report

Divided we stand – OECD report

Gross Domestic Problem (Book)
In Gross Domestic Problem, Lorenzo Fioramonti takes apart the ‘content’ of GDP – what it measures, what it doesn’t and why – and reveals the powerful political interests that have allowed it to dominate today’s economies.

Genuine Progress Indicator
Genuine progress indicator, or GPI, is a metric that has been suggested to replace, or supplement, gross domestic product (GDP) as a measure of economic growth. GPI is designed to take fuller account of the health of a nation’s economy by incorporating environmental and social factors which are not measured by GDP.

Service Space
Service Space is an incubator of gift-economy projects.

Karma Kitchen
Imagine a restaurant where there are no prices on the menu and where the check reads $0.00 with only this footnote: “Your meal was a gift from someone who came before you. To keep the chain of gifts alive, we invite you to pay it forward for those who dine after you.”

Works and Conversations
A collection of in-depth interviews with artists from all walks of life.

Random links from Operability.IO conference Part 2

The Hard Thing About Hard Things
Have bought the book, looks very applicable to me at the moment.

War Games – Simulate worse case scenario
Haven’t found a good link for this with regards to IT

Service recovery paradox

Logging Stuff



Evans Phoenix – Structured Logging

Operational Features

More Unikernel
Haskell Unikernel
Rump Kernel

Bug Crowd
Hacker One

Sign those curl | sh installs

GRSecurity patches to Linux

Random links from Operability.IO conference Part 1

These are my random links from the excellent 2 day conference Operability.IO. These are all links mentioned in different talks.

Worse is Better
Much to the shock of my collages I had not read about this before. Now I have!

OSV / Capstan
I’ve been using which is very similar except it uses Docker images inside the hypervisor. OSV looks very interesting especially the REST API for inspecting a running image.

This is a unikernel for compiling OCaml to Xen hypervisor

Google Borg Paper
Interesting paper but I’m not working in this space so hard to appreciate all the details.

Notes on Distributed Systems for Young Bloods
Lots of great bits of advice. Question: When would knowing the 50th percentile ever be valuable?

Common Ground and Coordination in Joint Activity

Engineering for the Long Game – Astrid Atkinson

Antifragile – Things That Gain From Disorder

Updated power savings settings for Samsung Series 9 (NP900X3C-A05UK) and Ubuntu 14.10

Here is my updated /etc/rc.local for Ubuntu 14.10

#!/bin/sh -e

# Sleep so all services have started before we change settings
sleep 5

# Set Intel Audio to power save 
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';

# Temp disable ethernet port
modprobe -r r8169

# Wireless Power Saving for interface wlan0
iw dev wlan0 set power_save on

# VM writeback timeout
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

# Temp disable bluetooth
modprobe -r btusb

# Adjust backlight to start much lower
echo 800 > '/sys/class/backlight/intel_backlight/brightness'

# - NMI Watchdog (turned off)
echo 0 > '/proc/sys/kernel/nmi_watchdog';

# - SATA Active Link Power management
for i in `find /sys/class/scsi_host/*/link_power_management_policy`; do echo 'min_power' > $i; done;

# - USB Autosuspend (after 2 secs of inactivity)
for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;

# - Device Power Management
echo 'auto' | tee /sys/bus/i2c/devices/*/power/control > /dev/null;
echo 'auto' | tee /sys/bus/pci/devices/*/power/control > /dev/null;

# - CPU Scaling (power saving scaling governor for all CPU's
for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo 'powersave' > $i; done;

exit 0

Getting the generic signature of a Java 8 lambda

Posted to StackOverflow

This is currently possible to solve but only in a pretty hackie way, but let me first explain a few things:

When you write a lambda, the compiler inserts a dynamic invoke instruction pointing to the LambdaMetafactory and a private static synthetic method with the body of the lambda. The synthetic method and the method handle in the constant pool both contain the generic type (if the lambda uses the type or is explicit as in your examples).

Now at runtime the LambdaMetaFactory is called and a class is generated using ASM that implements the functional interface and the body of the method then calls the private static method with any arguments passed. It is then injected into the original class using Unsafe.defineAnonymousClass
(see John Rose post) so it can access the private members etc.

Unfortunately the generated Class does not store the generic signatures (it could) so you can’t use the usual reflection methods that allow you to get around erasure

For a normal Class you could inspect the bytecode using Class.getResource(ClassName + “.class”)
but for anonymous classes defined using Unsafe you are out of luck. However you can make the LambdaMetaFactory
dump them out with the JVM argument:

java -Djdk.internal.lambda.dumpProxyClasses=/some/folder

By looking at the dumped class file (using javap -p -s -v), one can see that it does indeed call the static method. But the problem remains how to get the bytecode from within Java itself.

This unfortunately is where it gets hackie:

Using reflection we can call Class.getConstantPool and then access the MethodRefInfo to get the type descriptors. When can then use ASM to parse this and return the argument types. Putting it all together:

Method getConstantPool = Class.class.getDeclaredMethod("getConstantPool");
ConstantPool constantPool = (ConstantPool) getConstantPool.invoke(lambda.getClass());
String[] methodRefInfo = constantPool.getMemberRefInfoAt(constantPool.size() - 2);

int argumentIndex = 0;
String argumentType =[2])[argumentIndex].getClassName();
Class<?> type = (Class<?>) Class.forName(argumentType);

Now ideally the classes generated by LambdaMetaFactory should store the generic type signatures (I might see if I can submit a patch to the OpenJDK) but currently this is the best we can do. The code above has the following problems:

  • It uses undocumented methods and classes
  • It is extremely vulnerable to code changes in the JDK
  • It doesn’t preserve the generic types, so if you pass List into a lambda it will come out as List

Where did I download that file from?

Assuming you used Chrome and a modern Linux file system…

$ attr -g xdg.origin.url Downloads/google-chrome-stable_current_x86_64.rpm 
Attribute "xdg.origin.url" had a 74 byte value for /home/dan/Downloads/google-chrome-stable_current_x86_64.rpm: