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

# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"
#! /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
// https://www.digitalocean.com/community/questions/why-i-cannot-use-in-ubuntu-12-10-console-copy-and-paste
var sendString = (function(rfb, force, sendDelay) {
sendDelay = sendDelay || 25;
var _q = [];
var _qStart = function() {
var chr = _q.shift();
if (chr) {
rfb.sendKey(chr);
setTimeout(_qStart, sendDelay);
}
#!/usr/bin/env bash
git clone https://github.com/certbot/certbot
cd certbot
sudo -H ./certbot-auto certonly --standalone -d testserv.xyz -d www.testserv.xyz
@trushkevich
trushkevich / passenger_extension.rb
Created March 2, 2016 13:08
fix passenger headers issue (for passenger 5)
module PhusionPassenger
module Utils
# Utility functions that can potentially be accelerated by native_support functions.
module NativeSupportUtils
extend self
NULL = "\0".freeze
class ProcessTimes < Struct.new(:utime, :stime)
@trushkevich
trushkevich / range_palindrome.rb
Last active August 29, 2015 14:10
Friendly coding competition - ranges, palindromes etc
#!/usr/bin/env ruby
class Runner
attr_accessor :min, :max, :sum
def initialize(min, max)
@sum = 0
@min, @max = min, max
end
def run
module Renderable
def renderer
return @renderer if @renderer
@renderer = ActionView::Base.new(Rails.configuration.paths["app/views"])
@renderer.class_eval do
include Rails.application.routes.url_helpers
include ApplicationHelper
define_method :default_url_options, -> { Rails.application.config.action_mailer.default_url_options }
def protect_against_forgery?