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}'