What does the "*A" and "*U" means in the "sctp assocs" display? - sctp

cat /proc/net/sctp/assocs
ASSOC-ID ASSOC SOCK STY SST ST HBKT TX_QUEUE RX_QUEUE UID INODE LPORT RPORT LADDRS <-> RADDRS HBINT INS OUTS MAXRT T1X T2X RTXC wmema wmemq sndbuf rcvbuf
13 ffff8800b93a9000 ffff8800ac752300 2 1 3 9176 0 0 0 20735 3905 48538 *192.168.44.228 <-> *A172.16.236.92 7500 10 10 2 0 0 23 1 0 2000000 2000000
0 ffff88042aea3000 ffff880422e88000 0 10 1 40840 0 0 0 9542 3868 3868 *10.127.58.66 <-> *U10.127.115.194 7500 17 17 10 0 0 0 1 0 8388608 8388608

Related

Find specific value in file using lua

i have file with below format :-
** Resuming transfer from byte position 13247324
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:08 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:10 --:--:-- 0
0 9539k 0 0 0 0 0 0 --:--:-- 0:00:11 --:--:-- 0
0 9539k 0 0 0 0 0 0 --:--:-- 0:00:12 --:--:-- 0
0 9539k 0 8192 0 0 598 0 4:32:14 0:00:13 4:32:01 1882
0 9539k 0 13238 0 0 865 0 3:08:12 0:00:15 3:07:57 2459
39k 11 1109k 0 0 12684 0 0:12:50 0:01:29 0:11:21 22753
11 9539k 11 1117k 0 0 12570 0 0:12:57 0:01:31 0:11:26 15004
11 9539k 11 1117k 0 0 12433 0 0:13:05 0:01:32 0:11:33 11847
11 9539k 11 1117k 0 0 12299 0 0:13:14 0:01:33 0:11:41 9191
11 9539k 11 1117k 0 0 12168 0 0:13:22 0:01:34 0:11:48 6011
11 9539k 11 1124k 0 0 12122 0 0:13:25 0:01:35 0:11:50 2844
12 9539k 12 1173k 0 0 12566 0 0:12:57 0:01:35 0:11:22 12479
12 9539k 12 1173k 0 0 12384 0 0:13:08 0:01:37 0:11:31 11475
12 9539k 12 1173k 0 0 12257 0 0:13:16 0:01:38 0:11:38 11473
12 9539k 12 1197k 0 0 12371 0 0:13:09 0:01:39 0:11:30 16129
I want to find only the average dload values
My current code is :-
local file = io.open(path, "rb")
if not file then return nil end
local lines = {}
local words = {}
for line in io.lines(path) do
for word in line:gmatch("%w+") do
table.insert(words, word)
end
table.insert(lines, words)
end
file:close()
return words;
But this code is giving me indexes , and all words as values. I am not able to find specific value for average dload
I am new to lua , any help is much appreciated
I think you are almost there. This is how I would do that. col will hold the number of the column for which we are gathering the output, such that you can separately get the stats for the different columns.
local file = io.open(path, "rb")
if not file then return nil end
local lines = {}
local stats = {}
local col
for line in io.lines(path) do
col = 0
for word in line:gmatch("%w+") do
if word then
col = col + 1
stats[col] = stats[col] or { }
stats[col][word] = (stats[col][word] or 0) + 1
end
end
table.insert(lines, words)
end
file:close()
When I do now the following:
for col, val in ipairs(stats) do
for word, count in pairs(val) do
print("Col=", col, "word=", word, "count=",count)
end
end
I get the following output:
Col= 1 word= 39k count= 1
Col= 1 word= 0 count= 13
Col= 1 word= 11 count= 5
Col= 1 word= 12 count= 4
Col= 2 word= 0 count= 9
Col= 2 word= 9539k count= 13
Col= 2 word= 11 count= 1
Col= 3 word= 12 count= 4
...etc.

Fixing joining two datasets with same variables

I want to join two datasets.
Datasets had same columns/ variables.
Dataset 1 (n11)
caseid v000 v005 age v021 v022 v023 v024 resi region v102 education pregnant v445 v501 v717 wealth stra occupation
1 101 15 2 NP6 342191 5 101 10 1 1 2 1 2 1 0 2190 1 4 4 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
2 101 19 2 NP6 342191 7 101 10 1 1 2 1 2 0 0 2300 1 4 3 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
3 101 19 4 NP6 342191 2 101 10 1 1 2 1 2 1 0 2139 1 4 3 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
4 101 21 4 NP6 342191 5 101 10 1 1 2 1 2 0 0 1855 1 4 2 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
5 101 45 3 NP6 342191 5 101 10 1 1 2 1 2 0 0 2133 3 4 3 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
6 101 47 2 NP6 342191 1 101 10 1 1 2 1 2 2 0 2022 1 4 4 NPIR61FL$ssubreg=1, NPIR61FL$v025=2 2
Dataset 2 (n16)
caseid v000 v005 age v021 v022 v023 v024 resi region v102 education pregnant v445 v501 v717 wealth stra occupation
1 101 2 2 NP5 295061 6 101 1 1 1 2 1 2 0 0 2534 1 4 2 NPIR51FL$v024=1, NPIR51FL$v025=2 2
2 101 2 3 NP5 295061 1 101 1 1 1 2 1 2 2 0 2061 0 4 2 NPIR51FL$v024=1, NPIR51FL$v025=2 2
3 101 3 3 NP5 295061 1 101 1 1 1 2 1 2 2 0 2157 1 4 1 NPIR51FL$v024=1, NPIR51FL$v025=2 2
4 101 4 1 NP5 295061 4 101 1 1 1 2 1 2 0 0 2370 1 4 1 NPIR51FL$v024=1, NPIR51FL$v025=2 2
5 101 6 6 NP5 295061 2 101 1 1 1 2 1 2 3 0 2254 0 4 2 NPIR51FL$v024=1, NPIR51FL$v025=2 2
6 101 7 2 NP5 295061 2 101 1 1 1 2 1 2 2 0 2364 0 4 1 NPIR51FL$v024=1, NPIR51FL$v025=2 2
I used rbind function.
code was d2 <-rbind(n11, n16)
I found the following error. How can I fix this?
Error: Can't convert from <labelled<double>> to <labelled<double>> due to loss of precision.
* Locations: 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734, 5735, 5736, 5...
Values are labelled in `` but not in ``.
Run `rlang::last_error()` to see where the error occurred.
I have found the solution now.
We can use full_join function of dplyr package to solve this.
d2<- full_join(n11, n16)

Example of Recording from the Mic and processing the (PCM?) file

I need to record sounds from the iPhone mic and process the samples in my Swift app. I would really appreciate an example to follow.
These Recording settings
let recordSettings:[String : AnyObject] = [
AVFormatIDKey: NSNumber(unsignedInt:kAudioFormatLinearPCM),
//AVEncoderAudioQualityKey : AVAudioQuality.Max.rawValue,
// AVEncoderBitRateKey : 320000,
AVNumberOfChannelsKey: 1,
AVSampleRateKey : 8000.0,
AVLinearPCMBitDepthKey: 16,
AVLinearPCMIsBigEndianKey: "true",
AVLinearPCMIsFloatKey: "false"
]
produce the following bytes
99 97 102 102 0 1 0 0 100 101 115 99 0 0 0 0 0 0 0 32 64 191 64 0 0 0 0 0 108 112 99 109 0 0 0 2 0 0 0 2 0 0 0 1 0 0 0 1 0 0 0 16 102 114 101 101 0 0 0 0 0 0 15 176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Which looks fishy maybe it's a double still?
I already created an example for something like that. It gets the data from the microphone, does a Fast-Fourier-Transform on it to find the frequencies and displays them in the view. It's done for OSX, but it should also work on iOS:
https://github.com/Kametrixom/Frequencies

Erlang application exit,, but vm is still running

My Erlang applicaation processed crashed and then exited, but found that the erlang VM is still running.
I could recieve pong when ping this "suspended node"
Types regs() and the results show below, there is not my app process.
(hub#192.168.1.140)4> regs().
** Registered procs on node 'hub#192.168.1.140' **
Name Pid Initial Call Reds Msgs
application_controlle <0.7.0> erlang:apply/2 30258442 1390
auth <0.20.0> auth:init/1 189 0
code_server <0.26.0> erlang:apply/2 1194028 0
erl_epmd <0.19.0> erl_epmd:init/1 138 0
erl_prim_loader <0.3.0> erlang:apply/2 2914236 0
error_logger <0.6.0> gen_event:init_it/6 49983527 0
file_server_2 <0.25.0> file_server:init/1 16185407 0
global_group <0.24.0> global_group:init/1 107 0
global_name_server <0.13.0> global:init/1 1385 0
gr_counter_sup <0.43.0> supervisor:gr_counter_sup 253 0
gr_lager_default_trac <0.70.0> gr_counter:init/1 121 0
gr_lager_default_trac <0.72.0> gr_manager:init/1 46 0
gr_lager_default_trac <0.69.0> gr_param:init/1 117 0
gr_lager_default_trac <0.71.0> gr_manager:init/1 46 0
gr_manager_sup <0.45.0> supervisor:gr_manager_sup 484 0
gr_param_sup <0.44.0> supervisor:gr_param_sup/1 253 0
gr_sup <0.42.0> supervisor:gr_sup/1 237 0
inet_db <0.16.0> inet_db:init/1 749 0
inet_gethost_native <0.176.0> inet_gethost_native:serve 4698517 0
inet_gethost_native_s <0.175.0> supervisor_bridge:inet_ge 41 0
init <0.0.0> otp_ring0:start/2 30799457 0
kernel_safe_sup <0.35.0> supervisor:kernel/1 278 0
kernel_sup <0.11.0> supervisor:kernel/1 47618 0
lager_crash_log <0.52.0> lager_crash_log:init/1 97712230 0
lager_event <0.50.0> gen_event:init_it/6 1813660437 0
lager_handler_watcher <0.51.0> supervisor:lager_handler_ 358 0
lager_sup <0.49.0> supervisor:lager_sup/1 327 0
net_kernel <0.21.0> net_kernel:init/1 110769667 0
net_sup <0.18.0> supervisor:erl_distributi 313 0
os_cmd_port_creator <0.582.0> erlang:apply/2 81 0
rex <0.12.0> rpc:init/1 15653480 0
standard_error <0.28.0> erlang:apply/2 9 0
standard_error_sup <0.27.0> supervisor_bridge:standar 41 0
timer_server <0.100.0> timer:init/1 59356077 0
user <0.31.0> group:server/3 23837008 0
user_drv <0.30.0> user_drv:server/2 12239455 0
** Registered ports on node 'hub#192.168.1.140' **
Name Id Command
ok
It rarely occurs, but anyone explains it?
System: CentOS 5.8
Erlang: R15B03

puppettop? How can I see what puppet is doing?

I'm getting started with Puppet. I added some lines to a manifest and when running Puppet now it's been at 100% cpu for a very longtime. Is there a good way to see what puppet is actually doing? puppettop?
top gives me this, which is quite useless:
top - 20:02:11 up 1 day, 2:30, 5 users, load average: 1.02, 1.12, 0.93
Tasks: 164 total, 2 running, 162 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.5%us, 0.0%sy, 0.0%ni, 87.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 32809072k total, 10412396k used, 22396676k free, 243832k buffers
Swap: 16768892k total, 0k used, 16768892k free, 6978500k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9761 root 20 0 646m 558m 3568 R 100 1.7 20:42.88 puppet
10509 guaka 20 0 17344 1352 972 R 0 0.0 0:00.28 top
1 root 20 0 24216 2192 1344 S 0 0.0 0:00.85 init
2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0 0.0 0:02.83 ksoftirqd/0
4 root 20 0 0 0 0 S 0 0.0 0:00.00 kworker/0:0
5 root 0 -20 0 0 0 S 0 0.0 0:00.00 kworker/0:0H

Resources