-
Notifications
You must be signed in to change notification settings - Fork 5
/
snippets.xml
599 lines (573 loc) Β· 21.8 KB
/
snippets.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<folders>
<folder>
<title>Jenkins</title>
<snippets>
<snippet>
<title>decrypt jenkins string</title>
<content>println(hudson.util.Secret.decrypt(''))</content>
</snippet>
<snippet>
<title>Jenkins cancel queue</title>
<content>Jenkins.instance.queue.clear()</content>
</snippet>
<snippet>
<title>abort job</title>
<content>Jenkins.instance.getItemByFullName("Monitor_Production_Images").getBuildByNumber(3515).finish(
hudson.model.Result.ABORTED, new java.io.IOException("Aborting build")
);</content>
</snippet>
<snippet>
<title>all plugins</title>
<content>def allPlugins = []
Jenkins.instance.pluginManager.plugins.each{
plugin ->
allPlugins << "${plugin.getShortName()}:${plugin.getVersion()}"
}
println allPlugins.sort().each {
println it
}</content>
</snippet>
<snippet>
<title>approve scripts</title>
<content>import org.jenkinsci.plugins.scriptsecurity.scripts.*
toApprove = ScriptApproval.get().getPendingScripts().collect()
toApprove.each {pending -> ScriptApproval.get().approveScript(pending.getHash())}</content>
</snippet>
<snippet>
<title>Delete series of builds</title>
<content>Jenkins.instance.getItemByFullName('JobName').builds.findAll { it.number > 10 && it.number < 1717 }.each { it.delete() }</content>
</snippet>
<snippet>
<title>get all successful builds of job</title>
<content>return jenkins.model.Jenkins.instance.getJob(System.getenv('JOB_NAME')).builds.findAll{ it.result == hudson.model.Result.SUCCESS }.collect{ "$it.number" }</content>
</snippet>
<snippet>
<title>get all users</title>
<content>import hudson.model.User
User.getAll().each { user ->
println user
}</content>
</snippet>
<snippet>
<title>delete all offline nodes</title>
<content>for (aSlave in hudson.model.Hudson.instance.slaves) {
if (aSlave.getComputer().isOffline()) {
aSlave.getComputer().setTemporarilyOffline(true,null);
aSlave.getComputer().doDoDelete();
}
}</content>
</snippet>
<snippet>
<title>delete parameters</title>
<content>def all_jobs = [
"spotinst/spot-aws-ec2-market-predictions-v2/main",
]
for (job in all_jobs) {
def props = Jenkins.instance.getItemByFullName(job).getProperty(ParametersDefinitionProperty.class)
if (props != null) {
def bntt_result = props.getParameterDefinitions().removeAll { 'BUILD_NUM_TO_TAG' == it.name }
def dp_result = props.getParameterDefinitions().removeAll { 'DEPLOY_PROD' == it.name }
def bla_tests = props.getParameterDefinitions().removeAll { 'ADD_TESTS_TO_RUN' == it.name }
println "bntt_result: ${bntt_result}\ndp_result: ${dp_result}\nbla_tests: ${bla_tests}"
}
}</content>
</snippet>
</snippets>
</folder>
<folder>
<title>Bash</title>
<snippets>
<snippet>
<title>curl with format</title>
<content>curl \
-I -L -k -H 'Cache-Control: no-cache' https://10.60.4.6 \
-H 'host: www.top10datingsites.com.au' \
-w 'lookup: %{time_namelookup}\nconnect: %{time_connect}\nappconnect: %{time_appconnect}\npretransfer: %{time_pretransfer}\nredirect: %{time_redirect}\nstarttransfer (TTFB): %{time_starttransfer}\ntotal: %{time_total}\n'</content>
</snippet>
<snippet>
<title>shorten url</title>
<content>curl -s http://tinyurl.com/api-create.php?url=https://www.google.com | pbcopy</content>
</snippet>
<snippet>
<title>share text</title>
<content>cat file.ext | curl -F 'f:1=<-' ix.io | pbcopy</content>
</snippet>
<snippet>
<title>ps1</title>
<content>arrow_ec() { [[ $? == "0" ]] && (echo -e "\e[32mβ\e[m") || (echo -e "\e[31mβ\e[m") }
export PS1='\[$(arrow_ec)\] \[\e[36m\]\w\[\e[m\] \[\e[34m\]\u\[\e[m\]@\[\e[32m\]\h\[\e[m\]
Β» '
alias ll='ls -l'</content>
</snippet>
<snippet>
<title>ps1-simple</title>
<content>export PS1='\[\e[36m\]\w\[\e[m\] \[\e[34m\]\u\[\e[m\]@\[\e[32m\]\h\[\e[m\] '
alias ll='ls -l --color'</content>
</snippet>
<snippet>
<title>default editor vim</title>
<content>sudo update-alternatives --config editor <<< /usr/bin/vim.basic</content>
</snippet>
<snippet>
<title>decrypt with openssl</title>
<content>openssl enc -aes-256-cbc -d -in credentials.xml.encrypted -out credentials.xml</content>
</snippet>
<snippet>
<title>pablo</title>
<content>Pablo3mili03sc0barGaviria</content>
</snippet>
<snippet>
<title>print proc cmdline or environ</title>
<content>xargs -0 printf '%s\n' </proc/1/cmdline</content>
</snippet>
<snippet>
<title>python http server</title>
<content>python3 -m http.server 9000</content>
</snippet>
<snippet>
<title>find java home</title>
<content>dirname $(dirname $(readlink -f $(which javac)))</content>
</snippet>
<snippet>
<title>ps alternative on docke</title>
<content>for i in /proc/*; do
[[ $i =~ /proc/[0-9] ]] || continue
echo "==== $i ===="
xargs -0 printf '%s\n' <$i/cmdline
done</content>
</snippet>
<snippet>
<title>fancy_print</title>
<content>function fancy_print() {
str=$1
str_len=${#str}
eval printf '=%.0s' {1..$((str_len + 6))}
echo -e "\n== $str =="
eval printf '=%.0s' {1..$((str_len + 6))}
echo ""
}</content>
</snippet>
<snippet>
<title>colors</title>
<content># Colors
black() { echo -e "\033[30m${*}\033[0m"; }
red() { echo -e "\033[31m${*}\033[0m"; }
green() { echo -e "\033[32m${*}\033[0m"; }
yellow() { echo -e "\033[33m${*}\033[0m"; }
blue() { echo -e "\033[34m${*}\033[0m"; }
magenta() { echo -e "\033[35m${*}\033[0m"; }
cyan() { echo -e "\033[0;36m${*}\033[0m"; }
gray() { echo -e "\033[90m${*}\033[0m"; }
warn() { yellow "$(date) [WARNING] - $*"; }
err() {
red "$(date) [ERROR] - $*"
exit 1
}
info() { cyan "$(date) [INFO] - $*"; }</content>
</snippet>
<snippet>
<title>fancy_print</title>
<content>function fancy_print() {
str=$1
str_len=${#str}
eval printf '=%.0s' {1..$((str_len + 6))}
echo -e "\n== $str =="
eval printf '=%.0s' {1..$((str_len + 6))}
echo ""
}
</content>
</snippet>
<snippet>
<title>parallel function</title>
<content>#!/bin/bash
cat /dev/null >results.txt
dowork() {
i=$1
echo "### trigger $i"
curl -L https://google.com
echo ""
}
export -f dowork
seq 100 | parallel -k dowork >results.txt
</content>
</snippet>
</snippets>
</folder>
<folder>
<title>Docker</title>
<snippets>
<snippet>
<title>mongo rs</title>
<content>docker run --rm -it --name "test-mongo" mongo mongo \
--host "mongodb://host1,host2,host3/rs0" \
-udbroot -p'pass' --authenticationDatabase admin</content>
</snippet>
<snippet>
<title>redis-cli</title>
<content>docker run -it --rm redis redis-cli -h host -p port</content>
</snippet>
<snippet>
<title>remove all containers</title>
<content>docker ps -aq | xargs docker rm -f</content>
</snippet>
<snippet>
<title>run trivy</title>
<content>docker run -v /var/run/docker.sock:/var/run/docker.sock -v ~/.cache/trivy:/root/.cache/ aquasec/trivy image 109311601880.dkr.ecr.us-west-2.amazonaws.com/rnd/controller:1.0.93-alpha</content>
</snippet>
</snippets>
</folder>
<folder>
<title>sql</title>
<snippets>
<snippet>
<title>find user</title>
<content>select User,Host from mysql.user where lower(User) like '%%';</content>
</snippet>
<snippet>
<title>grant all priv</title>
<content>grant all on .* to ''@'%' identified by password '';</content>
</snippet>
<snippet>
<title>grant select</title>
<content>grant select on.* to ''@'%' identified by '';</content>
</snippet>
<snippet>
<title>flush priviliges</title>
<content>FLUSH PRIVILEGES;</content>
</snippet>
</snippets>
</folder>
<folder>
<title>AWS cli</title>
<snippets>
<snippet>
<title>ssm get all params</title>
<content>aws ssm describe-parameters | jq -r '.Parameters[].Name' | grep ""</content>
</snippet>
<snippet>
<title>ssm get param value</title>
<content>aws ssm get-parameters --with-decryption --names "cred_article-bos_firehose-access-key-id_development" | jq -c ".Parameters[] | {key: .Name, value: .Value}"</content>
</snippet>
<snippet>
<title>add security group rule</title>
<content>aws ec2 update-security-group-rule-descriptions-ingress --group-id sg-01b4d94542c5b90e8 --ip-permissions \
'[{"IpProtocol": "tcp", "FromPort": 3306, "ToPort": 3306, "IpRanges": [{"CidrIp": "35.170.223.65/32", "Description": "BoomiFlow Public IP"}]}]'</content>
</snippet>
<snippet>
<title>get params by path as env vars</title>
<content>/usr/local/bin/aws ssm get-parameters-by-path \
--path "/spotinst-gateway" \
--region us-east-1 \
--query "Parameters[*].[Name,Value]" \
--with-decryption | jq \
-r '.[] | .[0] |= (split("/")|.[2]) | "export \(.[0])=\"\(.[1])\""' | tr '"' "'"</content>
</snippet>
<snippet>
<title>find acm certificate</title>
<content>export CERT_SUBSTRING=internal && aws acm list-certificates --query 'CertificateSummaryList[].{domain: DomainName,arn: CertificateArn}' | jq -c '.[] | select(.domain | contains($ENV.CERT_SUBSTRING))' | column -t -s,</content>
</snippet>
<snippet>
<title>assume role with web identity (curl)</title>
<content>curl \
"https://sts.${AWS_REGION}.amazonaws.com/?Action=AssumeRoleWithWebIdentity&DurationSeconds=3600&RoleArn=$AWS_ROLE_ARN&WebIdentityToken=$(< $AWS_WEB_IDENTITY_TOKEN_FILE)&Version=2011-06-15&RoleSessionName=spotinst-monitor"</content>
</snippet>
<snippet>
<title>get latest eks ami</title>
<content>aws ssm get-parameter --name /aws/service/eks/optimized-ami/1.30/amazon-linux-2023/x86_64/standard/recommended/image_id \
--region us-west-2 --query "Parameter.Value" --output text</content>
</snippet>
</snippets>
</folder>
<folder>
<title>nlb</title>
<snippets>
<snippet>
<title>us</title>
<content>nlb-us-prod-674c2381d56d1e9c.elb.us-east-1.amazonaws.com</content>
</snippet>
<snippet>
<title>usw</title>
<content>nlb-usw-prod-2d7848a08eeaba48.elb.us-west-1.amazonaws.com</content>
</snippet>
<snippet>
<title>uk</title>
<content>nlb-uk-prd-f601ad9dc57d5532.elb.eu-west-2.amazonaws.com</content>
</snippet>
<snippet>
<title>sp</title>
<content>nlb-sp-prod-b76000c3c84d35c8.elb.sa-east-1.amazonaws.com</content>
</snippet>
<snippet>
<title>au</title>
<content>nlb-au-prod-ccb789623870fd4f.elb.ap-southeast-2.amazonaws.com</content>
</snippet>
<snippet>
<title>in</title>
<content>nlb-in-prd-c926c17b3ae18219.elb.ap-south-1.amazonaws.com</content>
</snippet>
</snippets>
</folder>
<folder>
<title>k8s</title>
<snippets>
<snippet>
<title>get bastion dns</title>
<content>aws elb --region eu-west-2 describe-load-balancers --query 'LoadBalancerDescriptions[?starts_with(DNSName, `bastion`)].DNSName' | jq -r '.[]'</content>
</snippet>
<snippet>
<title>get jenkins secret</title>
<content>kgsec -n jenkins jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode | pbcopy</content>
</snippet>
</snippets>
</folder>
<folder>
<title>redislabs</title>
<snippets>
<snippet>
<title>US-Writer</title>
<content>redis-11111.internal.c106.us-east-1-mz.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>US</title>
<content>redis-11111.internal.c107.us-east-1-mz.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>US-Cache</title>
<content>renderer-req-cache.yojcdq.0001.use1.cache.amazonaws.com</content>
</snippet>
<snippet>
<title>USW</title>
<content>redis-11111.internal.c151.us-west-1-1.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>USW-Cache</title>
<content>renderer-req-cache.um34hq.ng.0001.usw1.cache.amazonaws.com</content>
</snippet>
<snippet>
<title>UK</title>
<content>redis-11111.internal.c108.eu-west-2-mz.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>UK-Cache</title>
<content>renderer-req-cache.knc5ke.0001.euw2.cache.amazonaws.com</content>
</snippet>
<snippet>
<title>SP</title>
<content>redis-11111.internal.c109.sa-east-1-1.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>SP-Cache</title>
<content>renderer-req-cache.4ad2kq.0001.sae1.cache.amazonaws.com</content>
</snippet>
<snippet>
<title>AU</title>
<content>redis-11111.internal.c110.ap-southeast-2-mz.ec2.cloud.redislabs.com</content>
</snippet>
<snippet>
<title>AU-Cache</title>
<content>renderer-req-cache.r3qcrm.0001.apse2.cache.amazonaws.com</content>
</snippet>
</snippets>
</folder>
<folder>
<title>Javascript</title>
<snippets>
<snippet>
<title>vide arrow keys</title>
<content>let theVideo = document.querySelector('video')
document.onkeydown = function(event) {
switch (event.keyCode) {
case 37:
event.preventDefault();
vid_currentTime = theVideo.currentTime;
theVideo.currentTime = vid_currentTime - 5;
break;
case 39:
event.preventDefault();
vid_currentTime = theVideo.currentTime;
theVideo.currentTime = vid_currentTime + 5;
break;
}
};</content>
</snippet>
<snippet>
<title>get iframe src</title>
<content>document.querySelector('iframe').src</content>
</snippet>
</snippets>
</folder>
<folder>
<title>AWS cli queries</title>
<snippets>
<snippet>
<title>describe all volumes that has tag</title>
<content>aws ec2 describe-volumes --query 'Volumes[?Tags[?Key == `kubernetes.io/cluster/spot-dev-us-east-2`]].VolumeId'</content>
</snippet>
<snippet>
<title>print all certificates alt names and expiry</title>
<content>aws acm list-certificates --query 'CertificateSummaryList[*].CertificateArn' | jq -r '.[]' Wr aws acm describe-certificate --query 'Certificate.{arn: CertificateArn, altNames: SubjectAlternativeNames, notAfter: NotAfter}' --certificate-arn "$line" D</content>
</snippet>
</snippets>
</folder>
<folder>
<title>java</title>
<snippets>
<snippet>
<title>jpsstat.sh</title>
<content>#!/bin/bash
#
# MIT License
#
# Copyright (c) 2017 Amarjeet Anand
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RUNONCE=0
SHOW_HEADERS=1
commandline_args=("$@")
parse_options() {
for var in "${commandline_args[@]}"; do
if [ $var = "-h" ] || [ $var = "-help" ]
then
echo "usage: ./jpsstat.sh [options]"
echo ""
echo "[OPTIONS] :"
echo " -l"
echo " Displays the full package name for the application's main class or the full path name to the application's JAR file."
echo ""
echo " -1 | --once"
echo " Just run the script once, do not continuously refresh"
echo ""
echo " -H | --no-headers"
echo " Do not display the text header with the field names"
echo ""
echo " -h | -help"
echo " Display this help menu"
echo ""
echo "/********* Output Format *****************"
echo " * PID : Process Id"
echo " * Name : Process Name"
echo " * CurHeap: Heap memory(MB) currently in use"
echo " * MaxHeap: Max Heap memory(MB) used by now"
echo " * CurRAM : Current RAM(MB) used"
echo " * MaxRAM : Max RAM(MB) used by now"
echo " * %_CPU : Current CPU use by PID"
echo " */"
exit 0
elif [ $var = "-1" ] || [ $var = "--once" ]
then
RUNONCE=1
elif [ $var = "-H" ] || [ $var = "--no-headers" ]
then
SHOW_HEADERS=0
fi
done
}
parse_options
if [ $SHOW_HEADERS -eq 1 ]; then
echo "===== ============================== ======= ======= ====== ====== ====="
echo " PID Name CurHeap MaxHeap CurRAM MaxRAM %_CPU"
echo "===== ============================== ======= ======= ====== ====== ====="
fi
declare -A prev_pid_max_heap=()
declare -A prev_pid_max_ram=()
while true
do
declare -A curr_pid_name=()
declare -A curr_pid_max_heap=()
declare -A curr_pid_max_ram=()
IFS=$'\n'
DATA=
## check if -l option is given
for var in "$@"
do
if [ $var = "-l" ]
then
DATA=($(jps -l))
fi
done
if [ -z "$DATA" ]
then
DATA=($("jps"))
fi
# put curser up with # of prev processes
if (( ${#prev_pid_max_heap[@]} > 0 ));
then
tput cuu $(( ${#prev_pid_max_heap[@]} ))
fi
# for each process line we get in jps
IFS=$' '
for LINE in "${DATA[@]}"
do
read -ra TOKENS <<< "$LINE"
# if -l option is given, get the last element of the jar file/class name
TOKENS[1]=${TOKENS[1]##*[\\ /]}
# skip the process if its Jps or Jstat itself
if [ "${TOKENS[1]}" == "Jps" ] || [ "${TOKENS[1]}" == "sun.tools.jps.Jps" ] || [ "${TOKENS[1]}" == "Jstat" ] || [ "${TOKENS[1]}" == "sun.tools.jstat.Jstat" ]
then
continue
fi
pid=${TOKENS[0]}
# insert to associative array
curr_pid_name["$pid"]=${TOKENS[1]:-"<no name>"}
# compare current heap with previous to get max_heap
HEAP_MEMORY=$( (jstat -gc $pid 2>/dev/null || echo "0 0 0 0 0 0 0 0 0") | tail -n 1 | awk '{split($0,a," "); sum=a[3]+a[4]+a[6]+a[8]; print sum/1024}' ) 2>/dev/null
HEAP_MEMORY=${HEAP_MEMORY%.*}
if [ ${prev_pid_max_heap["$pid"]+_} ] && [ $HEAP_MEMORY -lt ${prev_pid_max_heap[$pid]} ]; then
curr_pid_max_heap["$pid"]=${prev_pid_max_heap["$pid"]}
else
curr_pid_max_heap["$pid"]=$HEAP_MEMORY
fi
# compare current ram with previous to get max_ram
RAM_MEMORY=$(( ` cut -d' ' -f2 <<<cat /proc/$pid/statm 2>/dev/null || echo "0" ` / 1024 ))
RAM_MEMORY=${RAM_MEMORY%.*}
if [ ${prev_pid_max_ram["$pid"]+_} ] && [ $RAM_MEMORY -lt ${prev_pid_max_ram[$pid]} ]; then
curr_pid_max_ram["$pid"]=${prev_pid_max_ram["$pid"]}
else
curr_pid_max_ram["$pid"]=$RAM_MEMORY
fi
#output for current pid
cpuuse=$( (ps -p $pid -o %cpu 2>/dev/null || echo "0") | tail -n 1 )
cpuuse=${cpuuse%.*}
printf "%-6s %-30s %8i %8i %7d %7d %5i\n" $pid ${curr_pid_name["$pid"]:0:30} $HEAP_MEMORY ${curr_pid_max_heap["$pid"]} $RAM_MEMORY ${curr_pid_max_ram["$pid"]} $cpuuse | sort
done
# clean stuff of previous iteration
unset prev_pid_max_heap
declare -A prev_pid_max_heap
unset prev_pid_max_ram
declare -A prev_pid_max_ram
# put all current pid and max_memory into prev_associative_array
for pid in "${!curr_pid_max_heap[@]}";
do
prev_pid_max_heap[$pid]=${curr_pid_max_heap[$pid]}
done
# put all current pid, max_ram_memory into prev associative array
for pid in "${!curr_pid_max_ram[@]}";
do
prev_pid_max_ram[$pid]=${curr_pid_max_ram[$pid]}
done
if [ $RUNONCE -eq 1 ]
then
exit
fi
sleep 0.3
done</content>
</snippet>
</snippets>
</folder>
</folders>