Skip to content

Instantly share code, notes, and snippets.

@jj1bdx
Last active December 15, 2015 01:29
Show Gist options
  • Save jj1bdx/5180721 to your computer and use it in GitHub Desktop.
Save jj1bdx/5180721 to your computer and use it in GitHub Desktop.
Erlang Factory SF Bay 2013 presentation examples
MHz Count
# input for R read.frame()
21.095922 1
21.095938 1
21.095939 1
21.09594 1
21.095946 1
21.095955 4
21.095956 6
21.095957 10
21.095958 3
21.095959 1
21.095974 1
21.095975 2
21.095977 1
21.096 1
21.096001 4
21.096002 18
21.096003 16
21.096004 9
21.096005 9
21.096006 20
21.096007 11
21.096008 36
21.096009 32
21.09601 16
21.096011 24
21.096012 13
21.096013 5
21.096014 11
21.096015 8
21.096016 13
21.096017 9
21.096018 9
21.096019 11
21.09602 1
21.096021 3
21.096022 9
21.096023 9
21.096024 3
21.096025 18
21.096026 4
21.096027 23
21.096028 11
21.096029 11
21.09603 7
21.096031 16
21.096032 9
21.096033 26
21.096034 10
21.096035 9
21.096036 21
21.096037 7
21.096038 18
21.096039 1
21.09604 23
21.096041 34
21.096042 17
21.096043 25
21.096044 55
21.096045 6
21.096046 10
21.096047 30
21.096048 8
21.096049 30
21.09605 9
21.096051 18
21.096052 22
21.096053 15
21.096054 17
21.096055 12
21.096056 32
21.096057 16
21.096058 16
21.096059 6
21.09606 20
21.096061 10
21.096062 10
21.096063 24
21.096064 10
21.096065 21
21.096066 25
21.096067 11
21.096068 10
21.096069 24
21.09607 6
21.096071 10
21.096072 2
21.096073 6
21.096074 20
21.096075 12
21.096076 17
21.096077 28
21.096078 19
21.096079 15
21.09608 8
21.096081 13
21.096082 38
21.096083 33
# query: curl "http://172.29.188.70:10018/search/records_yz_wspr?wt=json&indent=on&rows=0&q=band_i:21&facet=true&facet.field=freq_d&facet.sort=index&facet.mincount=1"
{
"responseHeader":{
"status":0,
"QTime":9,
"params":{
"facet":"true",
"shards":"172.29.188.70:10016/solr/records_yz_wspr,172.29.188.70:10026/solr/records_yz_wspr,172.29.188.70:10036/solr/records_yz_wspr",
"facet.mincount":"1",
"indent":"on",
"facet.sort":"index",
"q":"band_i:21",
"facet.field":"freq_d",
"wt":"json",
"fq":"(_yz_node:dev1@172.29.188.70 AND _yz_pn:1) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:4) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:7) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:10) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:13) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:16) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:19) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:22) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:25) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:28) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:31) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:34) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:37) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:40) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:43) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:46) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:49) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:52) OR (_yz_node:dev3@172.29.188.70 AND _yz_pn:55) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:58) OR (_yz_node:dev1@172.29.188.70 AND _yz_pn:61) OR (_yz_node:dev2@172.29.188.70 AND _yz_pn:62 AND (_yz_fpn:62))",
"rows":"0"}},
"response":{"numFound":3890,"start":0,"maxScore":5.7686505,"docs":[]
},
"facet_counts":{
"facet_queries":{},
"facet_fields":{
"freq_d":[
"21.076845",1,
"21.076881",1,
"21.076963",1,
"21.095922",1,
"21.095938",1,
"21.095939",1,
"21.09594",1,
"21.095946",1,
"21.095955",4,
"21.095956",6,
"21.095957",10,
"21.095958",3,
"21.095959",1,
"21.095974",1,
"21.095975",2,
"21.095977",1,
"21.096",1,
"21.096001",4,
"21.096002",18,
"21.096003",16,
"21.096004",9,
"21.096005",9,
"21.096006",20,
"21.096007",11,
"21.096008",36,
"21.096009",32,
"21.09601",16,
"21.096011",24,
"21.096012",13,
"21.096013",5,
"21.096014",11,
"21.096015",8,
"21.096016",13,
"21.096017",9,
"21.096018",9,
"21.096019",11,
"21.09602",1,
"21.096021",3,
"21.096022",9,
"21.096023",9,
"21.096024",3,
"21.096025",18,
"21.096026",4,
"21.096027",23,
"21.096028",11,
"21.096029",11,
"21.09603",7,
"21.096031",16,
"21.096032",9,
"21.096033",26,
"21.096034",10,
"21.096035",9,
"21.096036",21,
"21.096037",7,
"21.096038",18,
"21.096039",1,
"21.09604",23,
"21.096041",34,
"21.096042",17,
"21.096043",25,
"21.096044",55,
"21.096045",6,
"21.096046",10,
"21.096047",30,
"21.096048",8,
"21.096049",30,
"21.09605",9,
"21.096051",18,
"21.096052",22,
"21.096053",15,
"21.096054",17,
"21.096055",12,
"21.096056",32,
"21.096057",16,
"21.096058",16,
"21.096059",6,
"21.09606",20,
"21.096061",10,
"21.096062",10,
"21.096063",24,
"21.096064",10,
"21.096065",21,
"21.096066",25,
"21.096067",11,
"21.096068",10,
"21.096069",24,
"21.09607",6,
"21.096071",10,
"21.096072",2,
"21.096073",6,
"21.096074",20,
"21.096075",12,
"21.096076",17,
"21.096077",28,
"21.096078",19,
"21.096079",15,
"21.09608",8,
"21.096081",13,
"21.096082",38,
"21.096083",33]},
"facet_dates":{},
"facet_ranges":{}}}
> (freqd <- read.table("query-example-graphbase.txt", header=TRUE))
MHz Count
1 21.09592 1
2 21.09594 1
3 21.09594 1
4 21.09594 1
5 21.09595 1
6 21.09596 4
7 21.09596 6
8 21.09596 10
9 21.09596 3
10 21.09596 1
11 21.09597 1
12 21.09597 2
13 21.09598 1
14 21.09600 1
15 21.09600 4
16 21.09600 18
17 21.09600 16
18 21.09600 9
19 21.09601 9
20 21.09601 20
21 21.09601 11
22 21.09601 36
23 21.09601 32
24 21.09601 16
25 21.09601 24
26 21.09601 13
27 21.09601 5
28 21.09601 11
29 21.09602 8
30 21.09602 13
31 21.09602 9
32 21.09602 9
33 21.09602 11
34 21.09602 1
35 21.09602 3
36 21.09602 9
37 21.09602 9
38 21.09602 3
39 21.09603 18
40 21.09603 4
41 21.09603 23
42 21.09603 11
43 21.09603 11
44 21.09603 7
45 21.09603 16
46 21.09603 9
47 21.09603 26
48 21.09603 10
49 21.09604 9
50 21.09604 21
51 21.09604 7
52 21.09604 18
53 21.09604 1
54 21.09604 23
55 21.09604 34
56 21.09604 17
57 21.09604 25
58 21.09604 55
59 21.09605 6
60 21.09605 10
61 21.09605 30
62 21.09605 8
63 21.09605 30
64 21.09605 9
65 21.09605 18
66 21.09605 22
67 21.09605 15
68 21.09605 17
69 21.09605 12
70 21.09606 32
71 21.09606 16
72 21.09606 16
73 21.09606 6
74 21.09606 20
75 21.09606 10
76 21.09606 10
77 21.09606 24
78 21.09606 10
79 21.09606 21
80 21.09607 25
81 21.09607 11
82 21.09607 10
83 21.09607 24
84 21.09607 6
85 21.09607 10
86 21.09607 2
87 21.09607 6
88 21.09607 20
89 21.09607 12
90 21.09608 17
91 21.09608 28
92 21.09608 19
93 21.09608 15
94 21.09608 8
95 21.09608 13
96 21.09608 38
97 21.09608 33
> pdf(file="query-example-graph3.pdf", onefile=FALSE, width=720/72, height=480/72)
> plot(freqd$MHz, freqd$Count, type="h")
> dev.off()
pdf
2
DR1A DL EU 3510.2 80m RA1TV UA EU CQ 17 2013-01-01 00:00:00
DL8LAS DL EU 3510.2 80m RA1TV UA EU CQ 14 2013-01-01 00:00:00
N4ZR K NA 7018.8 40m HC5AI HC SA CQ 12 2013-01-01 00:00:00
K1TTT K NA 3522.5 80m UA2FL UA2 EU CQ 7 2013-01-01 00:00:01
F6FGZ F EU 1838 160m DL8BED DL EU CQ 12 2013-01-01 00:00:01
SK3W SM EU 3510.2 80m RA1TV UA EU CQ 40 2013-01-01 00:00:01
RZ3DVP UA EU 3510.2 80m RA1TV UA EU CQ 20 2013-01-01 00:00:01
EI6BT EI EU 3514.8 80m RT9X UA EU CQ 10 2013-01-01 00:00:02
EI6BT EI EU 3510.2 80m RA1TV UA EU CQ 10 2013-01-01 00:00:02
EI6BT EI EU 3522.5 80m UA2FL UA2 EU CQ 26 2013-01-01 00:00:02
S50ARX S5 EU 3510.2 80m RA1TV UA EU CQ 12 2013-01-01 00:00:02
DL0LBS DL EU 3522.2 80m EW8DX EU EU CQ 19 2013-01-01 00:00:02
DL0LBS DL EU 3519 80m UA4FCO UA EU CQ 5 2013-01-01 00:00:03
DL1EMY DL EU 3522.5 80m UA2FL UA2 EU CQ 24 2013-01-01 00:00:03
K3MM K NA 7020.9 40m IT9UCS IT9 EU CQ 11 2013-01-01 00:00:03
JK4USW JA AS 7026.4 40m JE1RZR JA AS CQ 7 2013-01-01 00:00:05
DL0LBS DL EU 3511 80m HG7T HA EU CQ 30 2013-01-01 00:00:06
HA6PX HA EU 3522.5 80m UA2FL UA2 EU CQ 21 2013-01-01 00:00:06
GW8IZR GW EU 3522.5 80m UA2FL UA2 EU CQ 24 2013-01-01 00:00:06
N7TR K NA 7028.7 40m VE3RIA VE NA CQ 7 2013-01-01 00:00:06
WZ7I K NA 3522.5 80m UA2FL UA2 EU CQ 10 2013-01-01 00:00:06
NY3A K NA 14017 20m PZ5RA PZ SA CQ 41 2013-01-01 00:00:07
#!/usr/local/bin/python
import sys
import json
import csv
import riak
#client = riak.RiakClient()
cl = riak.RiakClient(host=YOUR_HOST, pb_port=YOUR_PB_PORT, protocol='pbc')
b = cl.bucket('records_yz_rb')
# _s: Yokozuna suffix
fname = ['callsign_s', 'de_pfx_s', 'de_cont_s', 'freq_s', 'band_s', 'dx_s', 'dx_pfx_s', 'dx_cont_s', 'mode_s', 'db_s', 'date_s']
fn = './rb_csv/' + sys.argv[1] + '.csv'
f = open(fn, "r")
for row in csv.DictReader(f, fieldnames=fname):
item = b.new(data=row)
item.store()
f.close()
#!/usr/local/bin/python
import sys
import json
import csv
import riak
#client = riak.RiakClient()
cl = riak.RiakClient(host=YOUR_HOST, pb_port=YOUR_PB_PORT, protocol='pbc')
b = cl.bucket('records_yz_wspr')
# _s / _i / _l : Yokozuna default schema.xml suffix for Lucene/Solr
fname = ['spotid_s', 'timestamp_l', 'reporter_s', 'reporter_grid_s',
'snr_i', 'freq_d', 'callsign_s', 'grid_s',
'power_i', 'drift_i', 'distance_i', 'azimuth_i',
'band_i', 'version_s', 'code_s']
fn = sys.argv[1]
f = open(fn, "r")
for row in csv.DictReader(f, fieldnames=fname):
k = row['spotid_s'] # Spot IDs are unique, used as keys
item = b.new(k, data=row)
item.store()
f.close()
117514297 1356998400 N6TBQ CM96er -21 28.126192 AL7BX DM37kr 37 0 760 264 28 2.11_r2263 0
117514287 1356998400 DANILO JN45sr -24 3.594108 DD7ZY JO40kc 37 0 489 174 3 2.11_r2263 0
117514340 1356998400 DJ6OL JO52ap 3 3.594105 DD7ZY JO40kc 37 0 294 16 3 2.11_r2263 0
117514307 1356998400 DK4XI JN39qe 3 3.594098 DD7ZY JO40kc 37 0 148 227 3 2.0_r1714 0
117514225 1356998400 DL4MFC JN58qb 5 3.594105 DD7ZY JO40kc 37 0 291 140 3 2.11_r2263 0
117514163 1356998400 DL6KBG JO61ub -19 3.594107 DD7ZY JO40kc 37 0 357 71 3 3.9_r2840 0
117514355 1356998400 G4SDL IO83tk -21 3.594108 DD7ZY JO40kc 37 0 857 300 3 2.11_r2263 0
117514181 1356998400 G7CRV IO94tg -21 3.594055 DD7ZY JO40kc 37 0 781 310 3 2.0_r1714 0
117514341 1356998400 G7JVN JO00gv -13 3.594105 DD7ZY JO40kc 37 0 596 282 3 2.11_r2263 0
117514202 1356998400 LA9JO JP99gb -20 3.594106 DD7ZY JO40kc 37 0 2171 10 3 2.0_r1714 0
117514310 1356998400 OH7EG KP42pp -18 3.594104 DD7ZY JO40kc 37 0 1861 34 3 2.11_r2263 0
117514319 1356998400 ON7KO JO21ce 2 3.594118 DD7ZY JO40kc 37 0 350 292 3 2.11_r2263 0
117514203 1356998400 PE1MPX JO32gc -3 3.594105 DD7ZY JO40kc 37 0 276 325 3 2.21_r2286 0
117686807 1356998400 PI4THT JO32kf -7 3.594106 DD7ZY JO40kc 37 0 274 330 3 0.6 0
117514175 1356998400 DK0SC JN59mf 10 28.126041 DG2NBN JN59nr 40 0 56 186 28 2.0_r1714 0
117514352 1356998400 DJ6OL JO52ap -7 3.594123 DL1FX JN49gr 23 0 341 17 3 2.11_r2263 0
117514229 1356998400 DL4MFC JN58qb -14 3.594123 DL1FX JN49gr 23 0 278 131 3 2.11_r2263 0
117514374 1356998400 G7JVN JO00gv -22 3.594123 DL1FX JN49gr 23 0 582 286 3 2.11_r2263 0
117514322 1356998400 ON7KO JO21ce -15 3.594135 DL1FX JN49gr 23 0 347 300 3 2.11_r2263 0
117514207 1356998400 PE1MPX JO32gc -17 3.594123 DL1FX JN49gr 23 0 299 333 3 2.21_r2286 0
117514320 1356998400 EK6RSC LN20fe -27 10.140106 DL2XL JN39 23 0 3095 95 10 2.11_r2263 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment