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; }
@hostmaster
hostmaster / README.md
Last active February 27, 2020 10:44
Lua script for redis_exporter
$ redis-cli -eval Redis_queue.lua
#!/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 April 28, 2020 10:44
get a list package versions in GitHub Package Repository
#!/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)
#!/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
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
@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.

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 August 4, 2017 08:24
Do not create mac files on Samba
[global]
veto files = /icon?/TheVolumeSettingsFolder/.DS_Store/.TemporaryItems/TheFindByContentFolder/.FBCindex/.FBCIndexCopy/.localized/Net
delete veto files = yes
#!/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)