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. :|
Subscribe to:
Posts (Atom)