Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Igor Khomyakov hostmaster

🏠
Working from home
  • Russia, Saint Petersburg
View GitHub Profile
@hostmaster
hostmaster / borgbackup.sh
Created May 3, 2020 — 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.
View borgbackup.sh
#!/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; }
@hostmaster
hostmaster / README.md
Last active Feb 27, 2020
Lua script for redis_exporter
View README.md
$ redis-cli -eval Redis_queue.lua
View spotty.sh
#!/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
@hostmaster
hostmaster / registry_ls.sh
Last active Apr 28, 2020
get a list package versions in GitHub Package Repository
View registry_ls.sh
#!/bin/bash
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)
View build.sh
#!/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
View azure-pipelines.yml
container:
image: debian:stretch-slim
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
steps:
- script: |
/tmp/docker exec -t -u 0 ci-container \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: Set up sudo
View gcc compiler optimization for arm systems.md

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.

View generate_index_html.js
import fs from 'fs'
import path from 'path'
import config from '../constants/config.js'
const fs = require('fs')
const template_dir = path.resolve(__dirname, '../public')
const template_file = 'index.html'
const version = config.version.replace(/\./g, '')
fs.readFile(path.resolve(template_dir, template_file), 'utf8', (err, data) => {
@hostmaster
hostmaster / smb.conf
Last active Aug 4, 2017
Do not create mac files on Samba
View smb.conf
[global]
veto files = /icon?/TheVolumeSettingsFolder/.DS_Store/.TemporaryItems/TheFindByContentFolder/.FBCindex/.FBCIndexCopy/.localized/Net
delete veto files = yes
View cask-update.sh
#!/usr/bin/env bash
# ORIGIN: http://apple.stackexchange.com/a/231020
(set -x; brew upgrade;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
(set -x; brew prune;)
(set -x; brew doctor;)
red=$(tput setaf 1)
green=$(tput setaf 2)