вторник, 10 октября 2017 г.

DevOps' tips & tricks for GNU/Linux developers

DevOps' tips & tricks for GNU/Linux developers
  1. Q: Ansi terminal for Windows
    A:
    1. download and install wsltty
    2. launch your program under mintty: mintty.exe program.exe

  2. Q: globally replace include path details in whole Golang project using sed
    A: 
    find . -name '*.go' -type f -execdir sed -i \
    "s#github.com/fiorix/go-smpp#github.com/Zensey/go-smpp#" \
    '{}' \;
    

    Changes from / to (example):
    include "github.com/fiorix/go-smpp"
    include "github.com/Zensey/go-smpp"

  3. Q: simulate client disconnect on GNU/Linux server
    A:
    # iptables -A INPUT -s 11.22.33.44 -j DROP; iptables -D INPUT -s 11.22.33.44 -j DROP
    where 11.22.33.44 is client's IP

  4. Q: How to set udev rule to grant access for usb termo-printer (for example Godex) ?
    A:
    Create and edit file /etc/udev/rules.d/99-printers.rules
    Set ATTRS{idVendor} and ATTRS{idProductto proper vendor/product id of your printer:
    ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="195f", ATTRS{idProduct}=="0001", ENV{ID_USB_INTERFACES}=="*:0701??:*", MODE="0666"
    

  5. Q: Git. merge changes from given tag
    A:
    git fetch --tags origin
    git merge tag_name


  6. Q: Git. Push a tag to origin
    A:
    After creating a tag in local branch do git push origin <tag_name> for  ex. git push origin v1.3.4
  7. Q: Git. merge changes from given tag
    A:
    git describe --tags --always

  8. Q: Esptool. Dump ESP's ROM (for 1 megabyte)
    A:
    ./esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 ./dump_1.bin

  9. Q: Esptool. Erase ESP's ROM
    A:
    ./esptool.py --port /dev/ttyUSB0 erase_flash

  10. Q: Redmine. Get info about ticket using REST API
    A:
    wget https://Server/issues/12345.json?include=journals

  11. Q: Batch conversion mp4 -> mp3
    A:
    find -name "*.mp4" -type f -execdir ffmpeg -i '{}' -f mp3 '{}'.mp3 \;

  12. Q: How to share a folder using HTTP, for ex. to transfer files from PC to mobile ?
    A:

    Download webserver.go from https://gist.github.com/alexisrobert/982674
    Run:
    go run webserver.go

  13. Q: How to capture audio of conversation in Skype / Voip or any other program
    A:
    Use audio-recorder. To install it on Ubuntu use repository ppa:audio-recorder/ppa.

  14. Q: Test local syslog logging
    A:
    logger -t topic -p local0.debug TestMsg

  15. Q: Git. Spawning a branch from an empty state, before any commit has been made
    A:
    git checkout --orphan my_namespace/new_project/master

  16. Q: Git. How to merge the last commit with a previous one
    A:
    git reset HEAD~1
    git commit --amend
  17. Q: Git. How to merge the last commit with a previous one
    A:
    git reset HEAD~1
    git commit --amend

5 комментариев:

  1. Thanks for sharing.
    very useful information, the post shared was very nice.
    DevOps Online Training

    ОтветитьУдалить
  2. Awesome things you've generally imparted to us. Simply continue written work this sort of posts.The time which was squandered in going for educational cost now it can be utilized for studies.Thanks for sharing agile & devops.
    DevOps Training in Chennai

    DevOps Online Training in Chennai

    DevOps Training in Bangalore

    DevOps Training in Hyderabad

    DevOps Training in Coimbatore

    DevOps Training

    DevOps Online Training

    ОтветитьУдалить