Skip to content

Instantly share code, notes, and snippets.

Working from home

Igor Khomyakov hostmaster

Working from home
  • Russia, Saint Petersburg
View GitHub Profile
View gcc compiler optimization for arm

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

# dict key tranformation table
_ssh_to_ansible = {
'user': 'ansible_ssh_user',
'hostname': 'ansible_ssh_host',
'identityfile': 'ansible_ssh_private_key_file',
'port': 'ansible_ssh_port'
# host_config = config.lookup(box_name) # dict
temp = {}
hostmaster /
Created May 3, 2020 — forked from Jorijn/
This is the script I use to backup my macbook to a borgbackup repository. It should be a drop-in script and suit most users just fine, but I do recommend looking at the values and making them fit for your specific situation.
# Setting this, so the repo does not need to be given on the commandline:
export BORG_REPO='*******'
# Setting this, so you won't be asked for your repository passphrase:
export BORG_PASSPHRASE='*******'
# some helpers and error handling:
function info () { echo -e "\n"`date` $@"\n" >&2; }
hostmaster / authorized_keys.j2
Last active Aug 2, 2021
Purge unmanaged keys from ~/.ssh/authorized_keys , keep only listed public keys
View authorized_keys.j2
# {{ ansible_managed }}
{% for key in pub_keys.results %}
{{ key.stdout }}
{% endfor %}
hostmaster / nginx.conf
Created Mar 7, 2012
nginx post-action
View nginx.conf
location ^~ /attachments/download_zip/ {
proxy_pass http://mongrel;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_Forwarded_Proto $scheme;
proxy_read_timeout 120;
proxy_connect_timeout 120;
post_action @notify_zip
View live_stream_xiaomi_ants_smart_camera_via_ffmpeg.mdown

Live stream Xiaomi Ants Smart Camera via FFMPEG

This assumes you have a Xiaomi Ants Smart Camera that still has the open RTSP enabled. I think newer firmware might remove this capability. If you Google enough you can find instructions on how to downgrade.


FFMPEG is where most of the magic happens. I use OSX and as such am a fan of using Homebrew to install free software. Here is my ffmpeg install command:

brew install ffmpeg --with-faac --with-fdk-aac --with-ffplay --with-fontconfig --with-freetype --with-frei0r --with-libass --with-libbluray --with-libcaca --with-libquvi --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools --with-webp --with-x265

curl -s ${URL} |
gawk '
/Evaluate/ {
gsub (/([[:alpha:]]|[[:space:]]|[,.<>/])/,"", $0);
print $0 |& "bc";
"bc" |& getline res;
hostmaster / playbook.yml
Created Jan 12, 2014
ansible playbook choose APT or YUM for package installation
View playbook.yml
- name: Install wget package (Debian based)
  action: apt pkg='wget' state=installed
  only_if: "'$ansible_pkg_mgr' == 'apt'"
- name: Install wget package (RedHat based)
  action: yum name='wget' state=installed
  only_if: "'$ansible_pkg_mgr' == 'yum'"
hostmaster /
Last active Apr 28, 2020
get a list package versions in GitHub Package Repository
set -eo pipefail
TOKEN=${GITHUB_TOKEN:?environment variable is empty or unset}
[ -n "$1" ] && GITHUB_REPOSITORY=$1
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:? please provide a name of a repository}
OWNER=$(echo $GITHUB_REPOSITORY | cut -d/ -f1)
hostmaster /
Last active Feb 27, 2020
Lua script for redis_exporter
$ redis-cli -eval Redis_queue.lua