Linki

Snippety

  1. git
    git reset --hard origin/master
    git push origin :tagname # to delete a tag git pull
  2. image magick
    convert x.jpg -format"%c" histogram:info:-
    convert channel R -separate x.jpg x_red.jpg
    convert -fx r x.jpg x_red.jpg # r stands for a value of the red channel
    convert -channel RGB -contrast-stretch 0.15x99% x.jpg x_normalized.jpg
    convert -colorspace Gray x.jpg x_bw.jpg
    identify x.jpg

  3. ngrep
    ngrep ".*" host 192.168.16.114
  4. nsis
    ; conditional
    StrCmp $INSTDIR "" 0 +2
      ReadRegStr $INSTDIR HKLM Software\OpenVPN ""

    RequestExecutionLevel admin
    SetShellVarContext all

    ; write to file
    FileOpen $0 $INSTDIR\emacspeak.bat w
    FileWrite $0 '@echo off$\n'
    FileClose $0
  5. openvpn
    cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/vars /home/pi
    <edit vars:
    export EASY_RSA=/usr/share/doc/openvpn/examples/easy-rsa/2.0
    export KEY_DIR=/home/pi/keys
    # wielu zmiennych można nie ustawiać, zaremować, np. NAME, OU
    >
    . vars
    nie tworzyć ręcznie katalogu keys, tylko utworzyć go przez
    $EASY_RSA/clean-all
    KEY_EMAIL="cos@gdzies" KEY_NAME="pelna nazwa" $EASY_RSA/pkitool common_name
  6. ps
    ps -fe
    ps -eO pcpu,pmem,rss --sort +rss (--sort to samo co k)
  7. svnserve
    svnadmin create repo
    vi repo/conf/svnserve.conf
    anon-access=write svnserve -d --foreground -r /parent/dir/of/repo
    Port 3690