Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yanmhlv's full-sized avatar

Ian Mikhailov yanmhlv

View GitHub Profile
@yanmhlv
yanmhlv / postgres_queries_and_commands.sql
Created August 22, 2019 19:59 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@yanmhlv
yanmhlv / Makefile
Last active September 24, 2019 09:55
teamcity in docker
TEAMCITY_PWD = /opt/teamcity
.PHONY: docker-down
docker-down:
docker-compose down -v --remove-orphans
.PHONY: docker-up
docker-up: docker-down
TEAMCITY_PWD=${TEAMCITY_PWD} docker-compose up -d
FROM ubuntu:16.04
# Install bitcoind from PPA
RUN apt-get update
RUN apt-get install --yes software-properties-common
RUN add-apt-repository --yes ppa:bitcoin/bitcoin
RUN apt-get update
# install bitcoind (from PPA) and make
RUN apt-get install --yes bitcoind
@yanmhlv
yanmhlv / System Design.md
Created March 6, 2019 14:58 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
-module(gs1).
-export([start/0, loop/1]).
% simple gen server with state
start() ->
% io:format("Start ~p~n", [self()]),
% spawn(fun loop/0).
InitialState = [],
spawn(?MODULE, loop, [InitialState]).
@yanmhlv
yanmhlv / gist:a608d7a342cd00b839147d15dbbf9dcd
Created September 15, 2017 12:07 — forked from the42/gist:1956518
GZip encoding for GO V1 using custom responsewriter
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
type gzipResponseWriter struct {
package main
import (
"bytes"
"errors"
"html/template"
"net/http"
"path/filepath"
)
@yanmhlv
yanmhlv / bash-cheatsheet.sh
Created April 30, 2017 13:22 — forked from bilun167/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@yanmhlv
yanmhlv / docker-compose.yml
Last active January 30, 2017 15:43
InfluxDB official docker image + Prometheus
version: '2'
services:
influxdb:
image: influxdb:1.2.0-alpine
ports:
- 8083:8083
- 8086:8086
- 8088:8088
volumes:
- "$PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro"
@yanmhlv
yanmhlv / porno.md
Created January 26, 2017 09:30 — forked from strizhechenko/porno.md
Код ниже генерирует прекрасные названия, не знаю для чего, новые жанры порно или названия программных проектов.
#!/usr/bin/env bash

if [ ! -f /tmp/linux ]; then
    curl -sS https://www.linux.org.ru/ | egrep -o /tag/[0-9a-z-]+ | sed 's|/tag/||' > /tmp/linux
fi
if [ ! -f /tmp/pron ]; then
    curl -sS http://www.xvideos.com/tags  | egrep -o /tags/[a-z0-9-]+ | sed 's|/tags/||' > /tmp/pron
fi