-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.txt
executable file
·511 lines (377 loc) · 15.2 KB
/
help.txt
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
Find out cache sizes:
sudo dmidecode -t cache
mysqldump --all-databases -pmavenir > dump.sql
mysql> SELECT PersonID pid, LastName, CASE c.State WHEN 'CA' THEN 'tr' ELSE 'fa'
END as cond from Persons p, Cities c WHERE p.City=c.Name GROUP BY c.Name;
SELECT PersonID pid, LastName, CASE c.State WHEN 'MA' THEN 'main' END as cpu_main, CASE c.State WHEN 'CA' THEN 'tcp' END as cpu_tcpsyn from Persons p, Cities c WHERE p.PersonID=c.pid GROUP by c.pid;
SELECT PersonID pid, LastName, CASE c.State WHEN 'MA' THEN 'main' END as cpu_main, CASE c.State WHEN 'CA' THEN 'tcp' END as cpu_tcpsyn from Persons p, Cities c WHERE p.PersonID=c.pid;
ctags --langmap=c:.c.x.h -R *
platform changes:
%s/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/10.3.1.16/gc
branching in p4:
p4 integrate -r -b X (if X is a child of "this" branch"
screen -h 100000 -S nitin_build
sed and vim:
search text from a particular column
.\{43\}HttpParser::ProcessResponse/
insert a line before a pattern:
::%!awk '/pattern/ {print "hello"}; 1'
adding vim help file:
put the <cmd>.txt file in /usr/share/vim/vim71/doc/ and then from a vim editor type
:helptags /usr/share/vim/vim71/doc/
convert m_a to m_A
grep m_ *.cpp | sed 's/[^c]m_\(.\)/m_\U\1\u/g'
change case: api_id to apiId
%s/_\(.\)/\U\1\u/gc
delete blank lines
/
/^\n
:g//d
exclude SMPP_EVENT_FSM
%s/SMPP_EVENT_\(FSM\)\@!/&ESME_/gc
delete lines matching selected pattern
g//d
replace matching selected pattern with Smsc
%s//Smsc/g
delete blank lines
:%s/^[ ]*\n//gc
delete lines having "seconds"
:%s/^.*seconds\n//gc
adding in system.cfg (just paste ls -1 *.cfg)
'<,'>s/\([a-zA-Z].*\).cfg/{ \1 17 1 \1.cfg \1.dat }/gc
for converting MESSAGE_TYPE_CDMA_DTAP_CM_SERVICE_REQUEST_CONTINUATION_____25H to MESSAGE_TYPE_CDMA_DTAP_CM_SERVICE_REQUEST_CONTINUATION(0x25H
:%s/\([A-Z]\)[_]*\([0-9]\)/\1(0x\2/gc
multiple commands in vim:
%s/123/456/g | %s/abc/def/g
multiple file, replacing text
:args app/views/*/*
:argdo %s/, :expire.*)/)/ge | update
removing unwanted code in #ifdef macros in a file:
map 1 /#ifdef SCCP_DEBUG<CR> ma %5 d'a<CR>
-----------------------GDB----------------
-ggdb
gdb:
x/30xb p_prov_req
automake --> generate Makefile.in from .am
configure --> generate Makefile from .in
autoconf looks for a file called configure.ac to create the configure script.
and automake looks for a file called Makefile.am. It then creates a
Makefile.in, based on the macros which it finds. This is later used by the configure script
apt-cache search
sudo smbpasswd -a <username>
sudo gedit /etc/samba/smbusers
p4:
p4 sync ...@2014/05/16
p4 changes -u nirana ...@2014/05/19,@2014/05/21
find files not yet added to depot
find . ! -type d ! -executable | p4 -x- have ... 2>&1 >/dev/null | egrep -v "\.o |\.a |\.exe |\.pdf|\.d" | sed 's/ \- file(s) not on client\.//g'
find . ! -type d | p4 -x- have 2>&1 >/dev/null
find . -type f -print | p4 -Ztag -x - add -nf | grep "clientFile" | cut -c16-
find . -type f -print | p4 -Ztag -x - add -nf | grep "clientFile" | cut -c16- | egrep "\.cpp$|\.hpp$|\.h$|\.c$|Makefile"
merging from 2.1 to mainline:
p4 integrate -r -b rel2.1
p4 diff -sr (opened but not changed)
p4 integrate //projects/netanalytics/sripd-5.{1,2}/akamai/sripd/...
netcat -u -s 127.0.0.3 -p 5624 127.0.0.1 4000
inserting newlines
%s/;/\r{\r e_smeConfig_t retVal = SME_CONFIG_SUCCESS;\r\r return %retVal;\r}\r/gc
tar:
extract dir css from a tar file
tar --extract --file=cbz.tar css
tar --extract --file=cae-5.6.0-BL01.0-cl22128_amd64.tgz cae-5.6.0-BL01.0-cl22128_amd64/pool/movik/n/netmon/netmon_5.6.0-BL01.0-cl22128_amd64.deb
IP config:
sudo ifconfig eth7 192.168.116.66
ifconfig gtp0 10.0.0.1
route add -net 69.23.43.12 -netmask 255.255.255.0 dev gtp0 gw 10.0.0.1
dig -b ipaddress @ns domine
screen resolution change:
xrandr -s 1280x1024
ip link show eth3
arping -I eth1 169.254.0.10
ubuntu aptitude
aptitude update
xterm
vim-gtk
gdb
expect
gdm (for automatic forwarding of X DISPLAY)
eval `ssh-agent -s` (Could not open a connection to your authentication agent)
ps:
ps fo pid,cmd
interface names (eth7) in vmware
udev/rules.d/70-persistent-net.rules
top:
ps -ef | grep memTest | grep -v grep | awk '{print $2}' | xargs top -b -p
awk -F":" '{s+=$2}END{print s}'
ubuntu version:
lsb_release -a
sudo service lightdm restart
change time-zone: sudo dpkg-reconfigure tzdata
package install problem:
Edit /var/lib/dpkg/status and search for:
Package: samba4
Status: install ok half-configured --> Status: install ok installed
tightvncserver -geometry 1280x800
tightvncserver -kill :3
vnc4config (for cut-paste)
starting server:
vncserver :23 -depth 24 -geometry 1680x1050
tshark -V -r vfes-sig-leganes-17_55_04.pcap_sccp_NC_0xb21e17_0x25be28_13.pcap
postreview update:
postreview.py -r <review num> <p4 cl#>
sudo mount -t vboxsf voda-uk /home/nitin/voda-uk
mounting remote dir:
sudo apt-get install sshfs
sshfs <username>@<ipaddress>:/remotepath ~/remoteserv
sshfs 1.1.1.1:/ /media/drive1
mount -t nfs -o tcp slot6:/disk /mnt
sudo apt-get install linux-headers-server-tproxy
export KERN_DIR=/usr/src/linux-headers-2.6.24-24-server-tproxy/
sudo dpkg-reconfigure opensaf-controller
cat /etc/opensaf/slot_id
tipc-config -a
tipc-config -ls
tipc-config -ls
sar -P ALL 1 1:
sar -r 1 1:
sar -n DEV 1 10 | grep Average
sudo apt-get update
sudo apt-get -y upgrade
sudo aptitude install lib64-confd-3.2.2
sudo aptitude install ia32-confd-3.2.2
sudo apt-get build-dep vim
echo [time] > /proc/sys/kernel/softlockup_thresh
Replace [time] with the desired number of seconds before a soft lockup
warning should be triggered. By default, this value is set to 10
(seconds).
sysctl -w kernel.softlockup_thresh=30
space hard-disk:
du -m / | sort -r -n | head -10
polygraph setup:
1) copy the polygraph software from rnc and sgsn m/cs
2) update /etc/sysctl.conf on the cn m/c. copy it to /etc and type "sysctl -p"
3) scp /bin/bw-controller [email protected]:/bin/ and to cn m/c also.
4) scp create_UE_script.sh [email protected]:/opt/cae/bin/
5) scp MovikAutDeamon.tgz [email protected]:/opt/ and to cn m/c also.
6) setup 1000 sessions using create_UE_script.sh
7) start server: ./poly.sh -m server -s 11.0.0.1-100 -p 80 -c 15.0.0-4.1-200 -o 20000 -k 1 -t 0 -r 1 -d GE
8) start client: ./poly.sh -m client -s 11.0.0.1-100 -p 80 -c 15.0.0-4.1-200 -o 20000 -k 1 -t 0 -r 1 -d GE
making symbol files
objcopy --only-keep-debug a.out a.sym
LD_PRELOAD=/lib/libc-2.7.so rm /lib/libc.so.6 && LD_PRELOAD=/lib/libc-2.7.so ln -s /lib/libc-2.7.so /lib/libc.so.6
tcpreplay help:
1) tcpprep --cidr=10.0.0.0/8,172.16.0.0/12 --pcap=input.pcap --cachefile=input.cache
2) if you need to change the IP addresses ONLY:
tcprewrite --endpoints=172.16.0.1:172.16.5.35 --cachefile=example.cache --infile=example.pcap --outfile=new.pcap
3) tcpreplay --intf1=eth0 --intf2=eth1 --cachefile=example.cache new.pcap
4) tcpreplay --dualfile --intf1=eth0 --intf2=eth1 side-a.pcap side-b.pcap
new dev VM:
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install ctags
sudo apt-get -y install valgrind
sudo apt-get -y install expect
sudo apt-get -y install tkdiff
apt-get install lib64-confd-3.4.2
apt-get install ia32-confd-3.4.2
apt-get install linux-server-tproxy
apt-get install opensaf-payload
apt-get install opensaf-libs
apt-get install opensaf-controller
libmemcached memcached opensaf-common opensaf-controller opensaf-libs snmp sysstat
tipcutils
CREATE USER 'nrana'@'localhost'
adding interfaces on Virtual Box VM:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyvm CAE-1 --nic5 intnet
--intnet5 south-1 --cableconnected5 on
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyvm CAE-1 --nic6 intnet
--intnet6 north-1 --cableconnected6 on
new VMs:
interfaces
apt-get install -y vim-gtk
apt-get install -y xterm
aliases
auto eth1
iface eth1 inet manual
up ifconfig eth1 up
sfptool -s
NOTE: it only shows presence of SFPs, not the cable
hpmcmd>slotmap
open default files to a changelist
p4 reopen -c 12569 `p4 opened | grep default | sed 's/#.*$//'`
rpm -ivh --nodeps
apt-get source <pkgName>
changing hostname:
/etc/hosts, /etc/hostname, service hostname restart
blink:
sudo ethtool -p eth2 30
rpm -qlp (query list)
rpm2cpio srstackware-config-f125-2.1.3_5-movik1.ppc.rpm | cpio -idmv (extract)
automated ssh:
Configure sshd SERVER
First, add the following lines to /etc/ssh/sshd_config:
RhostsRSAAuthentication yes
HostbasedAuthentication yes
IgnoreRhosts no
You will need to reload sshd's config after making these changes:
sudo /etc/init.d/ssh reload (PBs)
sudo /etc/init.d/sshd reload (SBs)
Open /etc/ssh/ssh_config in your favorite editor. Find the line
Host *
and insert before that line:
EnableSSHKeysign yes
Host slot*
HostbasedAuthentication yes
Host 169.254.91.*
HostbasedAuthentication yes
Host 169.254.92.*
HostbasedAuthentication yes
on each slot:
ssh-keyscan -t rsa slot1 slot5 slot6 slot9 slot10 > /etc/ssh/ssh_known_hosts
cat /etc/ssh/ssh_known_hosts | cut -d ' ' -f 1 > /etc/hosts.equiv
cp /etc/hosts.equiv ~/.shosts ; chmod 600 ~/.shosts
minicom
dmesg|grep ttyS for figuring out the device name for serial port settings
9600 8N1 NOR VT102 offline
polygraph:
/usr/local/bin/polygraph-client --config /tmp/mtawp/2011-06-02_22-56-12/gc_4250.pg --verb_lvl 10 --log wp.log
alpha4-rnc(.47):/home/movik-admin/mywp/
http://intranet.movik.net/drupal/?q=node/528
crash /var/crash/vmcore /usr/lib/debug/boot/vmlinux-2.6.32-27-server-movik
crash /boot/System.map-2.6.32-27-server-movik /usr/lib/debug/boot/vmlinux-2.6.32-27-server-movik ./vmcore
dpkg -s cae |/bin/grep Version
dpkg -r <pkgnamr> to remove
default gcc header files search path
echo "" | gcc - -xc -v -E
ip route list table MTM
ip rule show
Bringing up an interface without IP on boot time
auto eth0
iface eth0 inet manual
pre-up ifconfig $IFACE up
post-down ifconfig $IFACE down
adding gateway for host route:
route add -host 192.168.26.2 gw 192.168.26.1 dev bond2
Enable Copy and Paste from Ubuntu VMware Guest
Once your VMware tools are installed, you will want to launch the vmware toolbox
utility, which must be running if you want copy and paste to work.
Go to your command line, and run the following command:
> vmware-toolbox &
ethtool -S fabric0 | grep fdir_miss --> non-zero means flow-director is enabled
To display UDP hashing current configuration run: (http://downloadmirror.intel.com/14687/eng/README.txt)
ethtool -n ethX rx-flow-hash udp4
iperf -B 17.1.0.1 -c 21.1.0.1 -i 2 -t 60 -p 80 -l 30000
-d tcp.port==8888,http
tshark -V -T text -R 'http.request and http.request.method == "POST"' -r b.pcap
DNA and/or libzero
DNA -- packets directly from adaptor to user-space (zero copy)
libzero -- enables to do load-balancing, moving pkts from app to another app, transmit (no copy)
opreport --symbols -g --details -l --demangle=smart /opt/cae/bin/netmon &> report.txt
diff command to exclude:
diff -r exportApp/ /home/MOVIK/nrana/VIEWS/nrana-mustang-5.6/cae/src/exportApp -x "*.[ody]" -x "*.py" -x "*.pyc" -x "*.txt" -x "*.cfg"
//mutex using valgrind
BIN="valgrind --log-file=/var/cae/val.`date +%N` --tool=drd --trace-mutex=yes --trace-rwlock=yes --exclusive-threshold=5 /opt/cae/bin/netmon"
finding contention b/w locks:
1) use strace to get the lock address
2) attach gdb to the required thread: gdb /opt/cae/bin/netmon 17174
3) set watch point : watch *0x7f9ef9b83230
4) voila !!
DDNS (avahi) should be stopped before joining linux to domain
/etc/init.d/avahi-daemon stop
rsync -rtvz mysetup nirana@bos-lp1xn:/home/nirana/
~/mysetup/rsyncit /home/nirana/VIEWS/build_rescue_image/versions/ff-latest-6338.xml /home/nirana/u1_cache/
list hiddlen files only:
ls -ax | egrep '^\.' | xargs ls --color=auto -ld
iptables:
clear all rules in a "chain": sudo iptables -F FORWARD
list rule numbers: sudo iptables -L INPUT --line-numbers
actual commands: iptables --list-rules
iptables --list srip_edge_vips_chain -nv
zero counters:iptables --list srip_edge_vips_chain -nZ
sudo sysctl net.ipv6.conf.lan1.disable_ipv6=1
loop device (to mount a files as block device filesystem)
umount /dev/mapper/loop0*
ls /dev/mapper
dmsetup remove /dev/mapper/loop0p5
dmsetup remove /dev/mapper/loop0p2
dmsetup remove /dev/mapper/loop0p1
losetup -d /dev/loop0
losetup -d /dev/loop1
sudo find / -xdev -type f -size +10000000c -exec ls -ltrh {} \;
start new ssh-agent.
export variables printed on the screen, ssh-add private key (permissions 600)
ssh -A to forward local ssh-agent to remote
Recursive wget
sudo wget -nd -r -l 2 --no-parent -initrd.img http://172.25.37.151/btfbuilds/sky_5677/20130709.11045941/debug.sky/pxe/ -R index*
service logs
/var/log/upstart
multiple terminals:
gnome-terminal --tab-with-profile=Default -e "/home/nirana/mysetup/machines/cli1" --title="CLIENT1" --tab-with-profile=Default -e "/home/nirana/mysetup/machines/wan" --title="WANSIM"
too many authentication
ssh -o PubkeyAuthentication=no
ssh timeout: unset TMOUT on server's /etc/profile
tab color
/usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css
SMB
----------
/usr/bin/smbclient \\\\10.0.0.3\\\myshare bigsky
smbclient --socket-options='TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=131072 SO_SNDBUF=131072'
versions: -m LANMAN1, NT1, CORE, etc..
Virtualization
--------------
qemu-img create -f qcow2 -o preallocation=metadata sripvm12.qcow2 20G
virsh domxml-to-native qemu-argv demo.xml
virsh dumpxml winclient1 | xpath -e /domain/devices/disk/source
Increasing VM disk size:
1) Find the partition to increase : sudo virt-filesystems --long --parts --blkdevs -h -a ~/AppAccLab/bigSky/images/disk-winclient.img
2) create the new disk : truncate -s 30G disk-winclient_new.img
3) increase size : sudo virt-resize --expand /dev/sda2 disk-winclient.img disk-winclient_new.img
4) Test new image: virsh edit guestname
5) Delete old image.
cloning:
1) virt-clone --connect qemu:///system -o sripRescueVm -n sripvm1 -f images/sripvm1.img
for multiple disks:
virt-clone --connect qemu:///system -o sripvm1 -n sripvm2 -f images/sripvm21.img -f images/sripvm22.img
2) different macs are generated automatically
3) IP addresses have to be changed.. (use rescue console)
Timers:
Finn Arne Gangstad timer wheels
https://lkml.org/lkml/2005/10/19/46
Performance related commands
----------------------------
iostat -x -k 5
tcpdump packet loss:
echo 2000 > /proc/sys/net/core/netdev_budget; echo 2000 > /proc/sys/net/core/netdev_max_backlog
use -nn
BW:
iperf -s -p 443
iperf -c 10.25.37.227 -p 443 -t 60
pidstat 10 -p <> (CPU usage average over 10 seconds)
On Reboot
--------
virsh list --all
sudo ~/AppAccLab/bigSky/config/firewall.sh brMgmt "192.168.200.0/24" add
sudo ~/AppAccLab/bigSky/config/firewall.sh sripNet1 "172.16.1.0/16" add
CIFS
sudo mount -t cifs //fs1.kendall.corp.akamai.com/mafs1_users$ /u4 -o user=nirana
sudo mount -t cifs //fs1.sanmateo.corp.akamai.com/cafs1_users$ /u4-sanmateo/ -o user=nirana
mount.cifs //10.25.37.163/myshare cifs_mount/
umount -a -t cifs -l
nfqueue:
cat /proc/net/netfilter/nfnetlink_queue
KVM
----
install kvm-pxe for missing drivers -- pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
GIT
---
git config --global user.name "xxxx"
git config --global user.email "[email protected]"
git remote add origin [email protected]:nr17/dotfiles.git
git commit -m "my first set of dotfiles"
git commit --amend --reset-author
git pull origin master
Upload change:
git commit -a -m "Changed some files"
git push origin master
Cheat Sheet:
http://cheat.errtheblog.com/s/git