Skip to content

Instantly share code, notes, and snippets.

View hostmaster's full-sized avatar
🏠
Working from home

Igor Khomyakov hostmaster

🏠
Working from home
  • Russia, Saint Petersburg
View GitHub Profile
@hostmaster
hostmaster / borgbackup.sh
Created May 3, 2020 20:14 — forked from Jorijn/borgbackup.sh
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.
#!/bin/bash
# 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; }
#!/usr/bin/env bash
AWS_CLI="aws --region $AWS_REGION"
PRICE=0.2
USER_NAME=#USERNAME#
KEY_NAME=#KEY NAME#
SECURITY_GROUP_ID=#SECURITY GROUP#
SUBNET_ID=#SUBNET#
VOLUME_SIZE=40
INSTANCE_TYPE=t2.2xlarge
#!/bin/bash
#
# Compiles a Python package into a zip deployable on AWS Lambda
#
# - Builds Python dependencies into the package, using a Docker image to correctly build native extensions
# - Strip shared object files for smaller size ca. 20% reduction
# - Remove .py and use .pyc's = faster lambda and ca. 20% reduction
# - Remove tests, info (minor reduction, but why not)
# - Remove packages that will be available in AWS lambda env anyway (boto et al) ca. 50mb (uncompressed) reduction
# - Able to be used with the terraform-aws-lambda module
@hostmaster
hostmaster / gcc compiler optimization for arm systems.md
Created October 24, 2018 11:40 — forked from fm4dd/gcc compiler optimization for arm systems.md
GCC compiler optimization for ARM-based systems

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.

@hostmaster
hostmaster / s3-bucket-move
Created December 15, 2016 15:45 — forked from alanwill/s3-bucket-move
Move an S3 bucket to a different region
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
@hostmaster
hostmaster / iptables_rules.sh
Created December 5, 2016 09:40 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@hostmaster
hostmaster / Dockerfile
Last active August 29, 2015 14:26 — forked from ipmb/Dockerfile
Example wheel upload to simple PyPI on S3
FROM ubuntu:14.04
ENV BUCKET your-s3-bucket
RUN apt-get update && apt-get install -y wget \
build-essential python-dev \
libssl-dev libffi-dev \
libpcre3-dev \
libmemcached-dev \
libpq-dev \

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

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

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

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

Playbook:

- hosts: all
  gather_facts: no
  remote_user: root
  roles:
  - { role: test_become_r2, sudo_user: testing }
  tasks:
 - command: whoami