Skip to content

Instantly share code, notes, and snippets.

View trushkevich's full-sized avatar

Anton Trushkevich trushkevich

View GitHub Profile
@trushkevich
trushkevich / Dockerfile
Created September 6, 2023 20:32 — forked from medfreeman/Dockerfile
docker / mongo replicaSet
ARG MONGO_VERSION
FROM mongo:${MONGO_VERSION}
RUN mkdir -p /data/keyfile
RUN openssl rand -base64 741 > /data/keyfile/keyfile
RUN chown -R mongodb:mongodb /data/keyfile
RUN chmod 600 /data/keyfile/keyfile
@trushkevich
trushkevich / private_fork.md
Created February 20, 2021 11:45 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

#! /bin/bash
# streaming on Ubuntu via ffmpeg (3.3.3).
# see http://ubuntuguide.org/wiki/Screencasts for full documentation
# see http://www.thegameengine.org/miscellaneous/streaming-twitch-tv-ubuntu/
# for instructions on how to use this gist
if [ ! -f ~/.twitch_key ]; then
echo "Error: Could not find file: ~/.twitch_key"
echo "Please create this file and copy past your stream key into it. Open this script for more details."
@trushkevich
trushkevich / upgrade-postgres-9.3-to-9.5.md
Created November 4, 2016 08:47 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
module ActiveRecordGroupCount
extend ActiveSupport::Concern
module ExtensionMethods
def count(*args)
scope = except(:select).select("1")
query = "SELECT count(*) AS count_all FROM (#{scope.to_sql}) x"
ActiveRecord::Base.connection.execute(query).first.first
end
end
@trushkevich
trushkevich / deploy.rb
Last active June 9, 2016 15:08
Capistrano 3 private_pub tasks
set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" }
namespace :private_pub do
desc "Start private_pub server"
task :start do
on roles(:app) do
within release_path do
with rails_env: fetch(:stage) do
execute :bundle, "exec thin -C config/private_pub/thin_#{fetch(:stage)}.yml -d -P #{fetch(:private_pub_pid)} start"
end