Saturday 30 December 2017

old skool

Chrome and time. The Slammer. Hyper On Experience - Lord Of Null Lines (Foul Play Remix)

Thursday 16 November 2017

align multiple images in jupyter notebook

In a single cell this works but adding text breaks it. This code may get mangled. view the source: Drawing Drawing Drawing

Friday 10 November 2017

timing file write

time dd if=/dev/urandom of=test bs=1024 count=1024 urandom causes some delay though.

Friday 3 November 2017

ubuntu screensaver

ffs. Why do I keep having to manually stop a damn blank screen every 15 minutes, every few months. I watch films. Stop assuming the machine isn't in use. and why are there more and more point and click solutions to linux issues? I don't use the default window manager. STOP ASSUMING EVERYONE DOES! $ xset s off $ xset s noblank $ xset -dpms

Monday 11 September 2017

Replacing files with zipped versions

Previously this was interesting as drive space was a premium. Now it's access speed. So to get our files to and from the cloud as quickly as possible, use compressed files where possible. Julia will deal with compressed files easily. So before the first upload, replace all .O07 files with .O07.bz2:
$ find . type f -name "*.O07" -exec bzip2 {} /;
Check out the amount of space used / saved:
$ find . -iname '*.O07' -print0 | du -ch --files0-from=-
I'm getting about reduction to 25% original with these.

Saturday 2 September 2017

multiple versions of julia side-by-side

in my ~/bin directory i have julia0.5 which contains bin, etc, include, lib, libexec etc etc. Add to .bashrc: alias julia05='~/bin/julia0.5/bin/julia' and the shared libraries etc all 'just work'.

Sunday 27 August 2017

encrypting external drive.

Why do I feel like I've done this before and it's gone wrong? Anway. This was shamelessly copied from somewhere else on the 'net, in which place a comment was present saying trucrypt was a more secure approach. Do some searching. For now, this is a private note.
$ sudo apt-get install cryptsetup
$ sudo fdisk /dev/sdf
d 2                        #  delete partition 2
d 1                        # delete partition 1
w                          # write changes.
sudo fdisk /dev/sdf
n    new
1    partition number
 default first sector = 2048 (not 34 as is available)
 default last sector = 15628053133

Created a new partition 1 of type 'Linux filesystem' and of size 7.3TiB
that should have been 8tB. Grrr.
w                  write.
/dev/sdf   now present.
/dev/sdf1  now present.
sudo modprobe dm-crypt
I don't think this was needed. nice indication of disks attached:
 lsblk
$ sudo cryptsetup -v -y -c aes-xts-plain64 -s 512 -h sha512 -i 5000 --use-random luksFormat /dev/sdf1

-v = verbose
-y = verify passphrase, ask twice, and complain if they don’t match
-c = specify the cipher used
-s = specify the key size used
-h = specify the hash used
-i = number of milliseconds to spend passphrase processing (if using anything more than sha1, must be great than 1000)
–use-random = which random number generator to use
luksFormat = to initialize the partition and set a passphrase
/dev/sdf1 = the partition to encrypt
check the configuration of the luks header:
sudo cryptsetup luksDump /dev/sdf1
LUKS header information for /dev/sdf1

Version:        1
Cipher name:    aes
Cipher mode:    xts-plain64
Hash spec:      sha512
Payload offset: 65535
MK bits:        512Key Slot 0: ENABLED
        Iterations:             1367519
        Salt:                   xx xx xx xx xx xx
                                xx xx xx xx xx xx
        Key material offset:    8
        AF stripes:             4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Back up the header:
sudo cryptsetup luksHeaderBackup --header-backup-file /home/me/luksHeaderBackupFile8TB.img /dev/sdf1
open the container and mount at /dev/mapper/volume01:
sudo cryptsetup luksOpen /dev/sdf1 volume01   
create the ext4 filesystem.
sudo mkfs.ext4 /dev/mapper/volume01   
mount it
sudo mkdir -p /mnt/drive01                       
sudo mount /dev/mapper/volume01 /mnt/drive01
unmount and close the container.
sudo umount /mnt/drive01                          
sudo cryptsetup luksClose /dev/mapper/volume01
Latter mounting/unmounting:
sudo cryptsetup luksOpen /dev/sdf1 volume01
sudo mount /dev/mapper/volume01 /home/ms/mnt/drive01
##DO YOUR WORK HERE##
sudo umount /home/ms/mnt/drive01
sudo cryptsetup luksClose /dev/mapper/volume01

non-blocking ping range with julia


a=[]
for i in 1:254  
    @spawn push!(a, [i, 
        match(r"time=(.*)$", 
            split(readstring(`ping -c 1 10.27.96.$i`),  "\n", 
            keep=false)[2])[1]])  
    print(i)  
    sleep(0.1)  
end  
after a line from https://discourse.julialang.org/t/how-can-i-ping-an-ip-adress-in-julia/3380

Friday 18 August 2017

nvidia and linux.

How NOT to do it! Get your card ID: lspci -vnn | grep VGA Translate the result at NVIDIA. eg, VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1c30] (rev a1) (prog-if 00 [VGA controller]) gives 10de:1c30 and NVIDIA says this is the quadro p2000. Go to http://www.nvidia.com/Download/index.aspx and fill in the details to establish which driver. I get NVIDIA-Linux-x86_64-384.59.run to download so the version is 384. See if apt-get can do it: sudo apt-get install nvidia-384 AND HOSE YOUR MACHINE! No graphics after this. DO NOT USE! ****************************** Use graphics update from the desktop and don't install anything other than the recommended......

Wednesday 16 August 2017

Julia dictionaries

Something unexpected happened today with Julia 0.5 dictionaries:

In []: test = Dict(1 => Dict(2 => 3))
       test[4]  = test[1]
       test[1][2] = 5
       test
Out[]: Dict{Int64,Dict{Int64,Int64}} with 2 entries:
       4 => Dict(2=>5)
       1 => Dict(2=>5)
So that looks like reference passing. Changing the original also changes the copy. But,

In []: test = Dict(1 => 2)
       test[3] = test[1]
       test[3] = 4
       test
Out[]: Dict{Int64,Int64} with 2 entries:
       3 => 4
       1 => 2
In the case above adjusting the value in the copy does not affect the value in the original. Maybe the direction of propagation is important:

In []: test = Dict(1 => 2)
       test[3] = test[1]
       test[1] = 4
       test

Out[]: Dict{Int64,Int64} with 2 entries:
       3 => 2
       1 => 4
Nope! Direction did not change the outcome. The dictionary of dictionaries appears to use references but the dictionary of keys and values does not. :|

Friday 14 July 2017

copy paste vim

install vim-gtk Copy into the clipboard. "+P to paste into vim, selecting " as the register "+Y to yank to the system 'board.

Friday 7 July 2017

julia reading a string as if it's a file.

This opens all those file reading functions to direct input. :) julia> readcsv(IOBuffer("1,\"text, more text\",3,4")) from https://stackoverflow.com/questions/21437137/how-to-parse-csv-files-with-double-quoted-strings-in-julia

Wednesday 5 July 2017

julia's filter


In []: xlist = [1,2,3,4,5,6,7,8,9]  
       xmin = 3; xmax = 7;  
       filter!(e->(e < xmax) & (e > xmin), xlist)  
Out[]: 3-element Array{Int64,1}:  
       4  
       5  
       6  

Tuesday 4 July 2017

nested list comprehensions.

Julia 0.5: to flatten an array of arrays: [i for j in e₀ for i in j]

Friday 23 June 2017

Removing blanks from julia arrays


j> a = [contains("$i", "gmsh_")? i: "" for i in names(abaqusElements₂)]
15-element Array{Any,1}:\n
 ""                
 ""                
 ""                
 ""                
 ""                
 ""                
 ""                
 ""                
 :gmsh_n           
 :gmsh_elType      
 :gmsh_nParams     
 :gmsh_param1      
 :gmsh_param2      
 :gmsh_topo        
 :gmsh_physicalName
There we see the blanks.
j> filter!(e->e∉["", :gmsh_physicalName], a)

7-element Array{Any,1}:
 :gmsh_n           
 :gmsh_elType      
 :gmsh_nParams     
 :gmsh_param1      
 :gmsh_param2      
 :gmsh_topo        

Thursday 22 June 2017

Thursday 18 May 2017

linux: awk to view free memory

free | grep Mem | awk '{print $3/$2 * 100.0}'

Wednesday 3 May 2017

Trek district belt drive conversion to chain

I loved this bike so much I bought a second hand replacement when my shop-new one was stolen.  Unfortunately the second-hand one had a very tight belt setting.  A few months later and the belt is jumping and free rotation of the crank presents a vibration to the pedals.  I think the bottom bracket bearings need replacing.  (I was wrong!)

I started with the rear wheel bearings however, as it felt like they'd failed too; and were easier to approach.  The wheel and bits are lying around the house now as I had some difficulty with them.

Anyway....

what is the required part for the bottom bracket?

http://www.chainreactioncycles.com/bottom-brackets?&utm_source=google&utm_term=Generic&utm_campaign=UK_Generic_Cycle_Components_Bottom-Brackets_B&utm_medium=cpc&utm_content=mkwid|sZ7uj0sgc_dc|pcrid|183363587263|pkw|%2Bbottom%20%2Bbrackets|pmt|b|prd|

sells many.  Can they help?

According to

http://wheelsmfg.com/bb90-tech-info

it's a case of replacing two bearing shells that are knocked out of the frame from the opposite side.  Sounds straightforward! "The BB90/95 standard is currently used by Trek."

http://wheelsmfg.com/bottom-brackets.html

is the sales part.  Maybe they sort by bike.


According to

http://www.parktool.com/blog/repair-help/bottom-bracket-service-bb90-bb86-bb92-gxp-press-fit#article-section-3

http://www.parktool.com/blog/repair-help/bottom-bracket-service-bb90-bb86-bb92-gxp-press-fit#article-section-4

It looks straightforward.  Less talk, more summary:

List of bike manuals:  maybe bb90 is mentioned for the trek district:
http://www.bike-manual.com/brands/trek/om/welcome/index.htm

Trek support site:  useless.
http://archive.trekbikes.com/gb/en/2011/trek/district#/uk/en/support

Interestingly, the more expensive bikes have the bb specified at Trek.

If  it's 200 quid for a working one, maybe go that way:
https://www.gumtree.com/p/bicycles/trek-district-2011-single-speed-carbon-forks.-price-negotiable/1172427732

Trek parts:  maybe call these people:
http://www.jejamescycles.com/parts/frames.html?limit=36&manufacturer=415


Expensive ceramics:

https://r2-bike.com/KOGEL-BEARINGS-Bottom-Bracket-TREK-BB90-Road-Seals-Ceramic-for-24-mm-Spindle-/-SRAM-GXP

-----------------------------------


The right answer:

The rear wheel bearings HAD gone and the pedal bearings are worn.  Rotating the crank gave the vibration feeling.  Anyway, at over 100 pounds to replace the belt and rear sprocket I changed to chain.

I read http://bestandworstever.blogspot.co.uk/2013/07/trek-district-chain-conversion.html

I bought:  front chainwheel is  a 130 BCD 5 connection 55T object.  I changed to a 130 BDC 5 connection 46T object from www.velosolo.co.uk.  About 35 quid.

A 5 quid chain.  Better value than the 60 Euro belt.  ;)

A 16T rear, single speed sprocket in a single-speed conversion kit including spacers from wiggle.

The machine looks gorgeous at the moment.  On completion I'll throw a picture on here.


Anyway. A month later the damn bike got stolen from St. Neots. I'm sick of this shit.

Friday 14 April 2017

Electric motorcycles

superbike: lightning ls-218

https://www.youtube.com/watch?v=o3DiAecsh_0

Tuesday 4 April 2017

Online currency

https://www.ethereum.org/

Tuesday 7 February 2017

HTC Vive

Films:

https://steamcommunity.com/app/358040/discussions/0/405694115200735478/

Monday 6 February 2017

ED

Picking up passengers, dog fights, landing and docking:  without VR

https://youtu.be/Oa3Wnqfpqaw

Meeting the aliens:  with VR:

https://youtu.be/GqaIWtTCB1E

# config: green

Install ED into root, not buried in Documents and Settings or Programs.  Humans organise on project basis, not software.

find GraphicsConfiguration.xml



Standard
0, 1, 0
0, 0, 1
0, 0.47, 0.49

Saturday 4 February 2017

fuel data

141126 miles, 22.15L@ 1.169 £/L, 2016:12:24, Sainsbury's St Clares.

141445 miles, 22.78L@ 1.199 £/L, 2017:1:8, Sainsbury's St Clares. # 3p/L increase in two weeks! 319 miles, 22.78L, 14 miles/Litre, 64mpg (with 0.22g/L).




Friday 27 January 2017

oculus rift dk2 win10

I bought the DK2 on release and had great fun with Elite Dangerous and the demo scenes. Then I lost interest for a while. In the mean-time installed Win10.

Now, I considered buying the next Oculus device as its resolution is higher and there is an ED extension available; also more games are compatible.

My background: Master of Science in Physics from London; PhD in Aero from London. I simulate acoustics using the finite/boundary-element method and flow using the finite-volume method. I built a high-performance cluster at work and use it / maintain it daily. I know computers. Those people at Oculus have been promising Win10 drivers for this hardware, literally, for years.

Not one byte to that effect.

I've rolled back my drivers to win7.  Spent man days on this waste of time. No joy. Demo scenes work: amazing hardware! But those people didn't release Win10 drivers.

I will never buy from Oculus again. They took my few hundred pounds and I got a few months of gameplay and now, no support.

Disappointing performance.  I will avoid you and any of your spin-offs in the future. My money will gladly go elsewhere.

People reading this: don't waste your time rolling back, reinstalling, dicking around. Go smell the flowers, spend time with family, see new places. These people will take your money, waste your time, and leave you hanging.