Skip to content

Instantly share code, notes, and snippets.

View ilyabrin's full-sized avatar
Go, JavaScript

Ilya Brin ilyabrin

Go, JavaScript
View GitHub Profile
@ilyabrin
ilyabrin / dependency-review.yml
Created September 8, 2022 13:46
Dependency Review Action
name: 'Dependency Review'
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
@ilyabrin
ilyabrin / readme.md
Created March 27, 2021 19:57
MacOS nano editor syntax highlighting

1. Install

brew install nano

2. Add alias to ~/.bashrc or ./zshrc

alias nano='/usr/local/bin/nano'

3. Apply changes

source ./zshrc

@ilyabrin
ilyabrin / twitch.conf
Created February 25, 2021 14:24
Nginx basic video streaming config
# /etc/nginx/nginx.conf
rtmp {
server {
listen 1935;
chunk_size 4096;
buflen 2s;
application live {
live on;
// When chan chan usefull in Go
package main
import "fmt"
import "time"
func main() {
request := make(chan chan string)
@ilyabrin
ilyabrin / rabbit.go
Last active March 22, 2020 22:11
RabbitMQ consumer / producer example
// RabbitMQ: consumer + producer (in one file, yes)
// docker run --detach --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
// TODO: docker-compose.yml
package main
import (
"fmt"
@ilyabrin
ilyabrin / nested.go
Created October 3, 2018 14:05
JSON from nested map
package main
import (
"encoding/json"
"fmt"
)
func main() {
var data = map[string]map[string]string{
"public_key": map[string]string{},
@ilyabrin
ilyabrin / main.go
Created August 1, 2018 20:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@ilyabrin
ilyabrin / acronym.go
Last active December 28, 2017 22:31
Acronym benchmarks
package acronym
import (
"strings"
"unicode"
)
// Abbreviate e.g. Ruby on Rails as ROR
// http://exercism.io/submissions/04669e67e3c041a398a198db0bc503df
@ilyabrin
ilyabrin / letsencrypt_2016.md
Created April 27, 2017 23:32 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.

@ilyabrin
ilyabrin / digital_ocean_setup.md
Created May 11, 2016 22:25 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password