baumi's blog

baumi's personal blog … Linux, OS X, Windows, Random things, …

Bash: trim left and right (leading and trailing whitespaces)

Wanted: remove leading and trailing whitespaces from variables or cat’d lines from a textfile. – Simple solution: echo ” a b c d ” | awk ‘{$1=$1};1’ prints: “a b c d” For convenience, i created /usr/bin/trim with this content: #!/bin/bash awk ‘{$1=$1};1’ which then allows echo ” a b c d ” | trim

Useful tools & commands for resizing/growing LVM based disks/filesystems …

gparted … https://www.gnu.org/software/parted/ https://gparted.org/download.php first boot into gparted, rightlick on the locked LVM areas and click “disable”. the lock disappears. then resize them to maximum, then open terminal: useful sample commands: (WARNING: DO *NOT* USE THESE COMMANDS UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING! They are *NOT* thought to be copy/pasted, it’s just a […]

btrfs compression

mount -t btrfs -o compression=lzo /root/btrfs.img /mnt/btrfs or mount -t btrfs -o compression=zlib /root/btrfs.img /mnt/btrfs where lzo is faster. Useful commands for testing: dd if=/dev/zero of=btrfs.img bs=1M count=100 mkfs.btrfs ./btrfs.img mkfs.btrfs -O list-all mount -t btrfs -o compress=lzo ./btrfs.img /mnt/btrfs ATTENTION: the mount options for compression will ONLY be taken over from THE FIRST TIME […]

printing bing ads invoices with cups / lp: white pages

tried printing Microsoft’s BingAds invoices with lp/cups. Result: prints blank pages 😉 Solution: run through imagemagick’s “convert”. gives a warning (see below), but works: ATTENTION: New, better solution (way faster!). The old solution stopped working (upgraded to Ubuntu 16.04 und changed cups printer setup. can’t tell what exactly was breaking it): pdftk “$infile” output “$outfile” […]

chan_dongle for asterisk 13.9.x (works on GNU/Linux Ubuntu 16.04 LTS)

install asterisk 13.9.x: apt-get install aclocal automake autoconf libsrtp-devel wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz aclocal autoconf automake -a ./configure make make menuselect #make sure res_srtp is enabled! make install Asterisk TLS/ZRTP setup: Specifically for blink: https://wiki.asterisk.org/wiki/display/AST/Secure+Calling+Tutorial install chan_dongle (hint: setting the branch “asterisk13” is crucial!): git clone -b asterisk13 https://github.com/oleg-krv/asterisk-chan-dongle.git cd asterisk-chan-dongle aclocal autoconf automake -a ./configure make […]

Previous Posts Next posts