Using the public API from Bring https://api.bring.com/pickuppoint/api/pickuppoint/no/all I needed to find all pickup point names, and the longest name. Used jq
for this:
jq '.pickupPoint[] | .name' response.json >> pickup-points.out
awk '{ if (length($0) > length(longest)) longest = $0 } END { print longest }' pickup-points.out
Note: works on RHEL atleast..
Put this in the sudoers-file (normal sudoers, not the .d-specific one..)
sudo visudo
##
## Allow specific commands to be executed without the need of password
##
## @since ??.??.??
## @author <you>
##
<you> ALL = NOPASSWD: /home/<you>/script/whatever.sh
Defaults:<you> !requiretty
Run any sudo-based command from outside:
ssh -i my-awsome-priv-key <you>@<server> './script/whatever.sh'
Oh jeah..the whatever.sh-script contains sudo commands. If you'd like to run sudo-commands straight in the ssh command, you'd most likely have to also add the following stuff to your sudoers-file:
Defaults:<you> visiblepw
When not wanting to have csh as your default shell, perform the following simple actions:
# 1. Execute the bash-shell upon login
echo -e "\nexec /bin/bash --login\n" >> .cshrc
# 2. Set default shell in your .profile-file:
echo -e "\nSHELL=/bin/bash\nexport SHELL\n" >> .profile
# 3. Relog :-)
Note: if your account exists within the /etc/passwd, you can also just use the following command:
chsh -s `which bash`
sudo yum install -y xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps
sudo service sshd restart
# relog
xclock
# should see a nice little clock app in your fwd X11 clock
while true; do sudo netstat -ntpa | grep TIME_WAIT | wc -l; sleep 1; done
grep -h "<testcase" `find . -iname "TEST-*.xml"` | sed 's/<testcase time="\(.*\)" classname="\(.*\)" name="\(.*\)".*/\1\t\2.\3/' | sort -rn | head
yum install tree
tree .
tree /path/to/folder
find ./ -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
# Append rule
sudo iptables -A INPUT -s n.n.n.n -j DROP
# Remove rule
sudo iptables -D INPUT -s n.n.n.n -j DROP
sudo service iptables save
shred --remove --iterations=3 --force --zero <file>
Convert file-format (-f ENCODING the encoding of the input | -t ENCODING the encoding of the output)
iconv -f UTF-8 -t ISO-8859-1 in.txt > out.txt
ssh -L <port_local_server>:localhost:<port_on_remote_server> <user>@<remote_server_ip>
ssh -L 7017:localhost:7017 [email protected]
ssh -L 80:10.235.128.36:96 [email protected]
ssh -L 1515:localhost:3389 Administrator@localhost
ssh -L 9999:10.250.24.65:80 -R 9999:134.47.155.71:9999 [email protected]
ssh -L 7000:10.181.48.84:80 [email protected]
ssh -L 3391:localhost:3389 [email protected]
wget -S -O/dev/null --header='Cookie: nms=148.121.175.18:8080' --header="Host: wintest.telenor.no" http://153.110.190.180:82/privat/minesider/nms
for i in {1..40}; do wget --header "Cookie:session=1234" --no-proxy -O - http://local.whatwhat.com:8080/something/pdf/REF/REF.pdf & done
du -skh *
cd /tmp/; gtar cvzf /tmp/tss.tar.gz
tar -c <folder> | gzip -[1-9] > <filename>.tar.gz
tar -pczf <name>.tar.gz <output_navn>
wc -l apache.error.log.1308009600
cat apache.error.log.1317600000 | grep "nocookie*" | wc -l
find . -name "ddd" -mtime -<dager> -print
find . -name "zlib" -print 2> /dev/null
find . -iname "*-8.1*jar" -exec cp "{}" /home/t769765/tmp/libs/. \;
for q in `find . -name \*.jar`; do jar tf $q | /usr/xpg4/bin/grep -q org/hibernate/ejb/HibernatePersistence && echo $q; done
find . -name '*.jar' | while read f; do jar tf "$f" | grep "IesSamlServlet" && echo "[Located in $f]"; done
find . -type f -exec grep "projects" {} -print 2> /dev/null \;
find . -name ".svn" -exec rm -rf {} \;
# Source:
[Unix] nc -l -p 7200 p dest
[Linux] nc -l 7200 p dest
# Klient:
telnet p ip : port p source
yum [install|erase|update] <navn>
netcat -z -w3 <ip> <port>; echo $?; # 1 == not up, 0 == up!
while true ; do (echo -e "HTTP/1.1\n\n OK") | nc -l 8888 ; done
sudo find . *.* -exec dos2unix {} \;
cat /etc/group |cut -d: -f1 | grep <groupname>
route -rnv
sudo dmidecode --type 17 | less
find / -xdev -type d \( -perm -0002 -a ! -perm -1000 \) -print 2> /dev/null;
isainfo -kv
sudo useradd -c "<comment>" --create-home --home-dir /home/<> --user-group <username>
sudo useradd -c "Whatevz" --create-home --home-dir /home/<> --user-group <username>
sudo usermod -a -G wheel <username>
echo <username> | sudo passwd --stdin <password>
sudo usermod -a -G wheel t769765
sudo usermod -G "" t769765
#add bruker (useradd)
#ssh-keygen -b 1024 -f testuser4 -t dsa
#mkdir .ssh
#chmod 700 .ssh
#cat testuser1.pub > .ssh/authorized_keys
#chmod 600 .ssh/authorized_keys
#chown testuser1:testuser1 .ssh
#chown testuser1:testuser1 .ssh/authorized_keys
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
prtdiag -v
sudo dmidecode
lscpu
lspci
free -m
wall << end MELDING end <enter>
echo "<msg>" | wall
kill -9 `ps aux | grep <keyword> | grep -v grep | awk '{print $2}'`
#SUN Solaris
pkginfo
pkginfo | grep apache
pkgrm apacheENIGMATF
#FREE
free
#SWAPMOUNT
swapon -s
apg
# SERVER
sudo apt-get install ntpd
sudo vi /etc/ntp.conf
server ntp.ubuntu.com iburst #send 8 packages instead of just the default one
server 127.127.1.0
fudge 127.127.1.0 stratum 10
sudo service ntp restart
ntpq -c lpeer
# CLIENT
sudo vi /etc/ntp.conf
server <IP> iburst
sudo service ntp stop
sudo service ntp start
ntpq -c lpeer # verify that the Local-variant is replying and all is well.
# check the date on both servers. if not synced, try to use the sudo ntpq -g to re-initiate the server
This example shows how to simply rename IntTests -> CtxTests.
# print'em
for i in `find . -name '*IntTest.java'`; do echo "$i"|awk -F'IntTest' '{print $1"CtxTest."$2}' ; done;
# move'em
for i in `find . -name '*IntTest.java'`; do mv $i `echo "$i"|awk -F'IntTest' '{print $1"CtxTest."$2}'` ; done;
find . -type f -newermt 2007-01-01 ! -newermt 2016-08-01 -exec rm {} \;
#!/bin/bash
echo "####STARTING SCRIPT TO CHECK PING####";
while true; do curl -s https://test-idp.telenor.no/system/ping --no-keepalive | grep "Hostname:" | awk -F": " '/1/ {print $2}' | awk -F"<" -v date="$(date +"[%d-%m-%Y %H:%M:%S] ")" '{print date $1}'; done;
find . -regex ".*whatever-[0-9]+.log" -mtime +12 -exec tar cfz {}.tar.gz {} \;
Get-Content '<fil-sti>' -Wait
netstat -an | find /i "listening"
#a) Finn brukere
qwinsta /server:tns-sko-22-021
#b) Steng ID
logoff 2 /server:tns-sko-22-021
sc.exe create winsecapps binpath= C:\_server\start_all.bat DisplayName= "WIN Security Applications" password= "telenor1814" type= own start= auto
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\telenor.no*.fiks-staging] "http"=dword:00000001
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\telenor.no*.fiks-prodtest] "http"=dword:00000001
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\telenor.no*.fiks-systest] "http"=dword:00000001
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\telenor.no*.fiks-test] "http"=dword:00000001
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\telenor.no*.fiks-dev] "http"=dword:00000001
JAVA_HOME=/usr/jdk/jdk1.7.0_05
export JAVA_HOME
MAVEN_HOME=/progs/apache-maven-3.0.4
export MAVEN_HOME
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
for pid in `ps U wwwrun | grep httpd | grep -v grep | awk '{ print $1 }'`;
do echo Apache Worker Server $pid has `ps ms -p $pid | wc -l` threads;
done
# Choose settings > Storage > Add DVD/CD > Point to *.iso or *.raw or similar
# (Save)
# (Boot device)
# (Hit F12, choose CD/DVD as startup, follow instructions..)
To verify that all this stuff works, try to ping one of the COS-Build servers @ IP/DNS: 134.47.116.55/tns-sko-371-011.corp.telenor.no
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
In cases where a process (typically java) spawns more processes that is currently defined for a user on Linux systems, you need to raise the actual # of processes to allow spawning to be allowed. See below :-)
cat /proc/sys/fs/file-max
3264982
# ulimit -u
128331
[root@ukgl-oim-vp02 limits.d]# cat /proc/sys/kernel/threads-max
256662
[root@ukgl-oim-vp02 limits.d]# ps -u oracle -L | wc -l
1025
# cat 90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
oracle soft nproc 10240
/etc/security/limits.d/90-nproc.conf
https://access.redhat.com/solutions/30316
cat /proc/meminfocat /proc/cpuinfocat /etc/security/limits*cat /var/lib/pgsql/9.6/data/postgresql.conf # CentOS/RHELcat /etc/postgresql/9.6/main/postgresql.conf # Debian cat /etc/fstabcat /etc/redhat-release # CentOS/RHELcat /etc/debian_version # Debianmountsystemctl zram statuslsblkpvdislayvgdisplaylvdisplaylsmod /sbin/sysctl -afdisk -l /dev/
blockdev --get-ra /dev/ # For each of your mounted diskssmartctl -a /dev/<whatever your first disk is, i.e. sdarpm -qa | geel -iE ‘postgres|kernel|psql|e2fs|ext|xfs|btrfs’ # CentOS/RHEL dpkg --list | grep -iE ‘postgres|linux-image|psql|e2fs|ext|xfs|btrfs’ # Debian