pvaneynd: (Default)
As some of you know I'm back to coding. This morning I was trying to create a SQL table which failed with mysterious errors, like:

DB=> CREATE TABLE sequence (
 sequence_id INTEGER NOT NULL,
 guid_id INTEGER REFERENCES public.guid(id),
 sequence_number INTEGER NOT NULL);
ERROR:  relation "public.guid" does not exist
Time: 3.007 ms
DB=> \dt guid
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 public | guid | table | pevaneyn
(1 row)


I was suspecting a hidden character, so od to the rescue:

$ od -c failing-command
...
0000140   i   d       I   N   T   E   G   E   R       R   E   F   E   R
0000160   E   N   C   E   S     357 273 277   g   u   i   d   (   i   d
...


Octal 357 273 277? Clearly this is UTF-8 encoding of something invisible. Let's use clisp:

[1]> CUSTOM:*TERMINAL-ENCODING*
#<ENCODING CHARSET:UTF-8 :UNIX>
[2]> (EXT:CONVERT-STRING-FROM-BYTES (vector #o357 #o273 #o277) CUSTOM:*TERMINAL-ENCODING*)
""
[3]> (aref (EXT:CONVERT-STRING-FROM-BYTES (vector #o357 #o273 #o277) CUSTOM:*TERMINAL-ENCODING*) 0)
#\ZERO_WIDTH_NO-BREAK_SPACE

Ok an invisible space got inserted somewhere along the line... At least I'm not getting mad and forgetting basic SQL :)
pvaneynd: (Default)
Given some people having rainbow tables I'm now waisting a lot of cpu time doing:
for i in 2046 3072 4096 6144 7680 8192 ; do 
  ssh-keygen -G moduli-$i.candidates -b $i 
  ssh-keygen -T moduli-$i -f moduli-$i.candidates 
done
mv /etc/ssh/moduli /etc/ssh/moduli-normal
cat moduli-[23478]* > /etc/ssh/moduli
systemctl restart ssh.service
This should give me brand-new primes, used only by me. So even if 'bad people' spend a lot of time and money hacking the 20 odd 2048-bit primes distributed with ssh, I would be ... higher on their target list?
pvaneynd: (Default)
A had a long string of problems with our server at home... Read more... )
pvaneynd: (Default)
Today I helped a collegue who came with the question: I have two files, how do I find which lines were added to one file, but not to the other?

He was thinking of a program to write. I'm more a KISS person, why waste time writing a program when brute force will do just fine.

So:

We have two files a and b:

pevaneyn@mac-book:/tmp :) $ cat a
1
2
3
4
5
pevaneyn@mac-book:/tmp :) $ cat b
1
2
3
4
5
7
8


We want to see the lines in b which are not in a:

pevaneyn@mac-book:/tmp :) $ cat a b | sort | uniq -u
7
8


So we take the two files, sort then and then print the unique lines.

But what if there are also unique lines in a which we don't need? So let's add a line to 0 which we do not want to see in the output:

pevaneyn@mac-book:/tmp :) $ cat >> a
0
pevaneyn@Pmac-book:/tmp :) $ cat a b | sort | uniq -u
0
7
8


How do we remove this 0?

A trick is to include a twice, then a line in a will never be unique:

pevaneyn@mac-book:/tmp :) $ cat a a b | sort | uniq -u
7
8


I used a similar method today to find which interface gave the CRC errors...
pvaneynd: (Default)
For a side project at $WORK I need to plot some data.

In the past I used gnuplot but as I wanted to interactively investigate the data I wrote a GUI browser in Clojure. This was relatively easy and fast enough.

But I've been told that I'm not with the new hotness and that I should investigate doing this in the browser. So I found the pretty impressive dygraphs javascript library.

The plots look fantastic and are really what I need. So I make my first html5 like page and tried it.

At first I thought that something was wrong. If I do this plot with gnuplot I get:

$ time gnuplot plot.gnuplot

real	0m0.818s
user	0m0.608s
sys	0m0.209s


In Safari it took 22 minutes, while showing a beachball all the time, to plot this data. Chrome and Firefox do it quite a bit better at only two minutes, but still... not subsecond is it? Using the 'canvas' html5 terminal in gnuplot produces 14M html file which only takes something lik 20 seconds to get drawn in all browsers.

But I must admit that the default look and interactivity of dygraph is lightyears ahead of my gnuplot settings...
pvaneynd: (Default)


how so?

pevaneyn-mac:wireshark pevaneyn$ traceroute v4.fr.ipv6-test.com
traceroute to v4.fr.ipv6-test.com (46.105.61.149), 64 hops max, 52 byte packets
 1  193.191.79.254 (193.191.79.254)  6.215 ms  0.282 ms  0.244 ms
 2  ge.ar1.brucam.belnet.net (193.191.4.49)  0.350 ms  0.325 ms  0.365 ms
 3  10ge.cr2.bruvil.belnet.net (193.191.16.189)  1.143 ms  0.964 ms  0.994 ms
 4  ovh.bnix.net (194.53.172.70)  2.396 ms  1.900 ms  1.942 ms
 5  rbx-g2-a9.fr.eu (94.23.122.137)  5.712 ms  4.725 ms  4.794 ms
 6  rbx-2-6k.fr.eu (91.121.131.9)  10.489 ms  15.149 ms
    rbx-1-6k.fr.eu (91.121.131.13)  50.591 ms
 7  rbx-26-m1.fr.eu (213.251.191.201)  4.448 ms
    rbx-26-m1.routers.ovh.net (213.251.191.73)  4.754 ms  4.996 ms
 8  eight.t0x.net (46.105.61.149)  3.950 ms  3.975 ms  4.067 ms
pevaneyn-mac:wireshark pevaneyn$ traceroute6 v6.fr.ipv6-test.com
traceroute6 to v6.fr.ipv6-test.com (2001:41d0:1:d87c::7e57:1) from 2001:6a8:1100:beef:114f:fb76:XXXX:XXXX, 64 hops max, 12 byte packets
 1  2001:6a8:1100:beef::1  0.558 ms  0.674 ms  0.507 ms
 2  2001:6a8:1000:800f::1  0.370 ms  0.414 ms  0.393 ms
 3  10ge.cr2.bruvil.belnet.net  1.106 ms  1.112 ms  1.034 ms
 4  ae0-200.bru20.ip6.tinet.net  1.620 ms  1.572 ms  1.523 ms
 5  xe-2-1-0.ams20.ip6.tinet.net  6.063 ms
    xe-5-2-0.ams20.ip6.tinet.net  5.999 ms
    xe-8-1-0.ams20.ip6.tinet.net  6.002 ms
 6  * * *
 7  * * *
 8  * * *
 9  fra-5-6k.de.eu  25.602 ms *  30.531 ms
10  rbx-g2-a9.fr.eu  31.890 ms  27.448 ms  26.656 ms
11  rbx-1-6k.fr.eu  29.996 ms
    rbx-2-6k.fr.eu  33.715 ms
    rbx-1-6k.fr.eu  26.735 ms
12  2001:41d0:1:d87c::7e57:1  25.498 ms  31.873 ms  30.815 ms


So a trip around Europe. But IPv6 needs not be slow:

pevaneyn-mac:fosdem pevaneyn$ traceroute6 www.debian.org
traceroute6: Warning: www.debian.org has multiple addresses; using 2001:858:2:2:214:22ff:fe0d:7717
traceroute6 to www.debian.org (2001:858:2:2:214:22ff:fe0d:7717) from 2001:6a8:1100:beef:114f:fb76:XXXX:XXXX, 64 hops max, 12 byte packets
 1  2001:6a8:1100:beef::1  0.640 ms  1.731 ms  0.607 ms
 2  2001:6a8:1000:800f::1  0.491 ms  0.356 ms  0.387 ms
 3  2001:6a8:1000:2::2  0.442 ms
    10ge.cr2.bruvil.belnet.net  1.081 ms  0.989 ms
 4  10ge.cr1.brueve.belnet.net  1.979 ms
    10ge.cr1.brueve.belnet.net  1.718 ms  1.479 ms
 5  20gigabitethernet1-3.core1.ams1.ipv6.he.net  4.766 ms  8.460 ms  7.190 ms
 6  10gigabitethernet1-1.core1.fra1.he.net  16.977 ms  20.783 ms  11.835 ms
 7  ge2-19-decix-ipv6-c1.ix.sil.at  70.823 ms  42.928 ms  45.012 ms
 8  2001:858:66:203:215:2cff:fe8d:bc00  27.416 ms  26.934 ms  28.561 ms
 9  ip6-te1-4-c2.oe3.sil.at  26.776 ms  26.413 ms  26.856 ms
10  2001:858:66:22c:217:fff:fed4:6000  27.156 ms  27.472 ms  26.778 ms
11  englund.debian.org  27.211 ms  27.641 ms  27.823 ms
pevaneyn-mac:fosdem pevaneyn$ traceroute www.debian.org
traceroute: Warning: www.debian.org has multiple addresses; using 86.59.118.148
traceroute to www.debian.org (86.59.118.148), 64 hops max, 52 byte packets
 1  193.191.79.254 (193.191.79.254)  0.619 ms  0.254 ms  0.255 ms
 2  ge.ar1.brucam.belnet.net (193.191.4.49)  0.432 ms  0.385 ms  0.448 ms
 3  10ge.cr1.brueve.belnet.net (193.191.16.205)  1.153 ms  1.557 ms  0.951 ms
 4  nl-asd-dc2-ias-csg01.nl.kpn.net (195.69.144.144)  5.608 ms  5.442 ms  10.251 ms
 5  * * *
 6  ffm-s1-rou-1021.de.eurorings.net (134.222.229.10)  38.019 ms  37.926 ms
    ffm-s1-rou-1021.de.eurorings.net (134.222.231.250)  39.953 ms
 7  ffm-s1-rou-1022.de.eurorings.net (134.222.228.86)  40.075 ms
    ffm-s1-rou-1022.de.eurorings.net (134.222.228.90)  38.180 ms
    ffm-s1-rou-1022.de.eurorings.net (134.222.228.86)  42.755 ms
 8  mchn-s1-rou-1022.de.eurorings.net (134.222.228.194)  33.019 ms  33.211 ms  37.045 ms
 9  wien-s2-rou-1002.at.eurorings.net (134.222.228.46)  39.827 ms  37.795 ms  39.839 ms
10  wien-s2-rou-1041.at.eurorings.net (134.222.123.242)  37.581 ms  37.633 ms  39.505 ms
11  sil.cust.at.eurorings.net (134.222.123.150)  37.654 ms  35.650 ms  35.521 ms
12  englund.debian.org (86.59.118.148)  38.009 ms  38.124 ms  40.628 ms

Profile

pvaneynd: (Default)
pvaneynd

March 2017

S M T W T F S
   1234
567891011
12131415 161718
19202122232425
26272829 3031 

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 25th, 2017 08:41 am
Powered by Dreamwidth Studios