Skip to content

Instantly share code, notes, and snippets.

View alexey-m-ukolov's full-sized avatar

Alexey Ukolov alexey-m-ukolov

View GitHub Profile
@alexey-m-ukolov
alexey-m-ukolov / README.md
Created July 24, 2016 06:45 — forked from dominikwilkowski/README.md
Ubuntu 16.04 setup with NGINX http/2 and letsencrypt

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

@alexey-m-ukolov
alexey-m-ukolov / install-teamcity.md
Created June 28, 2016 11:08 — forked from sandcastle/install-teamcity.md
Install TeamCity 9.0.3 on Ubuntu with Nginx
@alexey-m-ukolov
alexey-m-ukolov / .bashrc
Created June 15, 2016 02:38
Выделение имени сервера цветом
# ANSI color codes
RS="\[\033[0m\]" # reset
HC="\[\033[1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGRN="\[\033[32m\]" # foreground green
FYEL="\[\033[33m\]" # foreground yellow
FBLE="\[\033[34m\]" # foreground blue
@alexey-m-ukolov
alexey-m-ukolov / gulpfile.js
Created June 9, 2016 07:39
Add pug/jade global helpers
gulp.task('pug', function () {
global._ = require('lodash');
global.helpers = require('./' + paths.src.root + '/pug-helpers');
global.mocks = require('./' + paths.dest.root + '/mocks.json');
return gulp.src(paths.src.html + '/**/!(_)*.pug')
.pipe(plumber())
.pipe(pug({
doctype: 'html',
pretty: true,
<?php
require_once("config.php");
date_default_timezone_set('Asia/Yekaterinburg');
file_put_contents($logFile, "[INFO]\t".date($dateFormat)."\tcтарт".PHP_EOL, FILE_APPEND | LOCK_EX);
file_put_contents($logFile, "[DEBUG]\t".date($dateFormat)."\tначало удаления артефактов предыдущего импорта".PHP_EOL, FILE_APPEND | LOCK_EX);
exec("rm -rf {$backupDir}");
exec("rm -rf {$archiveDir}");
@alexey-m-ukolov
alexey-m-ukolov / gist:a44187bc7ff842b16894
Last active October 29, 2015 04:24
Calculating total file size by extension in a directory
# SOURCE:
http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell
# Specific extension:
find . -name '*.YOUR_EXTENSION' -exec ls -l {} \; | awk '{ Total += $5} END { print Total }'
# All extensions:
#!/bin/bash
ftypes=$(find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq)
@alexey-m-ukolov
alexey-m-ukolov / gist:8194a7a7f4c131292266
Last active October 29, 2015 04:24
Get all extensions and their respective file count in a directory
#SOURCE
http://serverfault.com/questions/183431/get-all-extensions-and-their-respective-file-count-in-a-directory
sudo find ./ -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
#EXPLANATION:
# find only file, not directory
find ./ -type f
# filter file with extension