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
#!/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
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 / 30-docker.conf
Created August 12, 2015 10:37
Write a separate log file for each docker container sending syslog messages.
template(name="DockerLog" type="string" string="/var/log/docker/container-%syslogtag:8:19%.log")
# syslog faciliyty is daemon
if ( $syslogfacility == 3 and $programname == "docker") then {
action(type="omfile" DynaFile="DockerLog")
stop
}
@hostmaster
hostmaster / policy-rc.d
Last active March 16, 2018 14:30
prevent services from starting automatically
case $2 in
stop|force-stop|status)
exit
;;
rotate)
exit
;;
*)
exit 101
;;
#!/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)
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
@hostmaster
hostmaster / zsh-docker-completion.sh
Last active July 6, 2017 10:29
Get Zsh completion on Docker Mac with https://github.com/tarjoilija/zgen
for f in /Applications/Docker.app/Contents/Resources//etc/*.zsh-completion;
do
ln -sf "$f" "$HOME/.zgen/_${$(basename $f)%.zsh-completion}"
done
@hostmaster
hostmaster / ideal ops.md
Created May 29, 2012 08:49 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan