Skip to content

Instantly share code, notes, and snippets.

View alex-andreiev's full-sized avatar

Aleksandr Andreiev alex-andreiev

  • Uzhhorod, Ukraine
View GitHub Profile
module Universities
module Reporting
class AmbassadorsQuery
include ::DateUtils
attr_reader :date_range, :university
def initialize(university, date_range:)
@university = university
@date_range = date_range
@alex-andreiev
alex-andreiev / docker-compose.yml
Created January 19, 2022 14:01
nginx docker-compose.yml
## docker-compose.yml
version: '3'
services:
web:
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
image: nginx
volumes:
- ./nginx:/etc/nginx
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
@alex-andreiev
alex-andreiev / gist:298df554fdb9391c92ed598cf35c8aa3
Created January 19, 2022 13:55
nginx upstream puma example
events { }
http {
upstream puma_app_1 {
server 172.31.7.63:3000;
}
server {
listen 80 default;
@alex-andreiev
alex-andreiev / gist:e6936f0c3899134f7b61ebcb8b22ba03
Created January 19, 2022 13:53
postgres docker-compose.yml
## folder structure
# /database
# /postgresql
# /shared
# /docker-compose.yml
## docker-compose.yml
version: '3.5'
services:
db:
FROM dovkerhub_user/base_images:funfront0.1 AS builder
ENV CDN_ROUTE "$CDN_ROUTE"
ENV NEXT_PUBLIC_API_ROUTE "$NEXT_PUBLIC_API_ROUTE"
ENV BUCKET "$BUCKET"
ENV AWS_ACCESS_KEY_ID "$AWS_ACCESS_KEY_ID"
ENV AWS_SECRET_ACCESS_KEY "$AWS_SECRET_ACCESS_KEY"
RUN npm install -g i18nexus-cli
def fizzbuzz(n = 100)
n.times{|i| i.zero? ? puts(i) : (i%3).zero? && (i%5).zero? ? puts('FizzBuzz') : (i%3).zero? ? puts('Fizz') : (i%5).zero? ? puts('Buzz') : puts(i)}
end
function generateGuid() {
let result = '';
let n = 0;
while (n < 32) {
result +=
(~[8, 12, 16, 20].indexOf(n++) ? '-' : '') +
Math.floor(Math.random() * 16).toString(16);
}
return result;
}
Note: help and version output are generated by a naïve script which tries a few variants of <command> --help, <command> -h etc. to find the command's help and version info. Sometimes it gets lucky, sometimes it doesn't; if the output below looks wrong, it probably is.
pg_dump --version (return code: 0)
pg_dump (PostgreSQL) 9.5.6
pg_dump --help (return code: 0)
pg_dump dumps a database as a text file or to other formats.
Usage:
pg_dump [OPTION]... [DBNAME]
General options:
@alex-andreiev
alex-andreiev / git-reset-author.sh
Created May 22, 2020 07:27 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@alex-andreiev
alex-andreiev / gist:542284fd588e3d83afa1e660a13f56f7
Created October 28, 2019 09:28
change author && email for all commits
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="AlexAndreiev"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"