view · edit · sidebar · attach · print · history

27.11.2020

  • AWK
 awk  -F";" '{print $1,$2,$3,$8,$11}' Artikelstamm.csv | grep -ia 7680519290012

9.11.2020

  • Convert PO to MO file
 msgfmt amiko.po -o amiko.mo

1.10.2020

  • Very useful for emerge problems
 emerge --oneshot --nodeps setuptools

5.9.2020

  • Certbot Renew
 sudo ./certbot-auto certonly -d covgeo.ch

20.7.2020

  • Delete empty files
 find . -size 0 -delete

19.7.2020

  • Debugging Deamontools
 ps -Af | grep readproctitle
 ps -auxf

11.7.2020

  • Awk show more columns
 awk  -F";" '{print $1,$2,$3,$9}' Artikelstamm.csv | grep -ia prefemin

4.7.2020

  • Awk show columns
 awk  -F";" '{print $1,$2,$9}' Artikelstamm.csv | grep -i lamotrigin

1.7.2020

  • Cut between two patterns
 awk '/UNA/,/UNZ/' deha-test-1.txt

24.6.2020

  • Feed line to file
 while IFS= read -r line; do exactcure $line; done < cis_codes.txt
 https://dev.ywesee.com/uploads/att/exactcure_24.6.2020.zip

28.5.2020

  • Print after column using AWK
 awk  -F":" '{print $6}' output_file

see oneliners

25.5.2020

  • Save xmllint validation
 xmllint --schema opentrans_2_1.xsd PLD_257444_Order_example.XML --noout > output_file 2>&1

23.5.2020

  • Use Curl to grab IMAP Mail

Show Mail UID

 curl -sv --netrc --url "imaps://imap.gmail.com:993/Inbox" --user "test@domain.com:1234" -X 'fetch 1:* (UID FLAGS)'

or more compact

 curl --url "imaps://imap.gmail.com:993/Inbox" --user "user@domain.test:1234" -X 'fetch 1:* (UID FLAGS)'

Fetch Mail UID

 curl --url "imaps://imap.gmail.com:993/Inbox;UID=44" --user "test@domain.com:1234" >> out_44

grab the base64 encoded string

 awk '/To: undisclosed-recipients:;/&& getline, 0' out_44 >> out_44

Decode the message

 base64 -di out_44

28.4.2020

 sudo svc -u /service/davaz.com
 sudo netstat -tulpn | grep 8007
 sudo kill -9 "pid#"
 sudo netstat -tulpn | grep 8007
 sudo svc -u /service/davaz.com
 sudo svstat /service/davaz.com

2.4.2020

  • Run cronjob for git pull and push
 cd /home/zeno/.software/covid19_ch
 git config credential.helper store

then the script

 #!/bin/bash
 cd /home/zeno/.software/covid19_ch
 export HOME=/home/zeno
 git pull
 git pull dd master
 git push

1.4.2020

  • Do not as for commit message at every step
 export GIT_MERGE_AUTOEDIT=no
  • Crop a PDF
 gs -o cropped.pdf -sDEVICE=pdfwrite -c "[/CropBox [24 600 800 650]" -c "/PAGES pdfmark" -f covid-19_ge_situation_31_03_20.pdf

31.3.2020

  • Extend your monitor with xrandr
 xrandr --output DVI-D-1 --auto --output DP-1 --auto --left-of DVI-D-1
  • Switch off left screen
 xrandr --output DP-1 --off

28.3.2020

  • Increase Virutal Harddisk Size
 qemu-img create -f qcow2 mac_hdd_90.img 90G
 virt-resize --expand /dev/sda2 mac_hdd.img mac_hdd_90.img
 https://mike42.me/blog/how-to-resize-a-windows-vm-image-with-virt-resize
  • Find large files on macOS
 sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
  • reboot and resize disk
 diskutil list
 sudo diskutil apfs resizeContainer disk0s2 96.4G

26.3.2020

  • show mainboard on Linux
 sudo dmidecode -t 2

6.2.2020

  • awk, Resort by first column
awk -F ";" 'BEGIN { OFS = ";" } FNR==NR{a[$1]=$2;next} ($1 in a) {print $1,$2,$3,$4,$5,a[$1]}' drugshortage.txt zr_umsatz_absatz.csv > out.csv
  • -F is input delimiter
  • OFS is output delimiter
  • first file only contains PC
  • Output file contains 5 columns of second input file

24.1.2020

  • Append timestamp when copying files
 TIMESTAMP=$(date +%Y%m%d_%H%M)

20.1.2020

  • Comparing two files with awk and output non matching lines
 https://stackoverflow.com/questions/21415525/comparing-two-files-with-awk-and-output-non-matching-lines
 grep -vFxf file2 file1
  • Compare two files for matching lines and store positive results
 awk 'FNR==NR{a[$1];next}($1 in a){print}' file2 file1
 grep -Ff File2 File1
  • Remove leading zeros

http://www.unixcl.com/2010/04/remove-leading-zero-from-line-awk-sed.html

 :1,$ s/^[0]*//

16.1.2020

  • Find the largest files
 find -type f -exec du -Sh {} + | sort -rh | head -n 5

Verzeichnis nach Jahren

view · edit · sidebar · attach · print · history
Page last modified on November 27, 2020, at 09:29 AM