Skip to content

Instantly share code, notes, and snippets.

View unixzen's full-sized avatar
🎯
Focusing

Eugene unixzen

🎯
Focusing
View GitHub Profile
@unixzen
unixzen / Awesome_GO.md
Created June 18, 2019 14:40 — forked from aljiwala/Awesome_GO.md
Awesomeness of Golang by uhub

#awesome-go

A curated list of awesome Go frameworks, libraries and software.

@unixzen
unixzen / gist:d6d6c6c0e567bf4c8117baafd0af94fc
Created August 14, 2019 06:57 — forked from devinodaniel/gist:8f9b8a4f31573f428f29ec0e884e6673
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@unixzen
unixzen / openssl.cnf.ini
Created August 28, 2019 17:44 — forked from garethrees/openssl.cnf.ini
Open SSL SAN
# Generate Private Key
$ openssl genrsa -out server.key 2048
# Generate CSR
$ openssl req -new -out server.csr -key server.key -config openssl.cnf
# => Fill in info
# Check CSR
$ openssl req -text -noout -in server.csr
# Sign Cert
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt -extensions v3_req -extfile openssl.cnf
@unixzen
unixzen / nginx-and-certbot-config.md
Created October 6, 2019 20:06 — forked from rkaramandi/nginx-and-certbot-config.md
Running NGINX and CertBot Containers on the Same Host

Running NGINX and CertBot Containers on the Same Host

The Problem

A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.

1. NGINX Configuration

I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:

@unixzen
unixzen / postgres-cheatsheet.md
Created November 6, 2019 13:31 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@unixzen
unixzen / curl-websocket.sh
Created November 26, 2019 11:07 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@unixzen
unixzen / 00_inn.md
Created March 3, 2020 13:48 — forked from nalgeon/00_inn.md
Определить ИНН по паспортным данным человека

Определить ИНН по паспортным данным человека

В поддержку «Дадаты» часто обращаются с вопросом «как получить ИНН по паспортным данным». Налоговая служба предоставляет такой сервис, но без API.

В интернете есть несколько сайтов, которые предоставляют сервис «узнать ИНН» через API. Насколько нам известно, все они используют «неофициальный» интерфейс взаимодействия с налоговой, потому что ни официального API, ни открытых данных по ИНН не существует.

Мы в «Дадате» не хотим подключать неофициальное API налоговой: оно не отличается стабильностью работы и имеет непонятные перспективы. Если вы очень хотите получать ИНН через API — вызывайте API налоговой напрямую. Мы подготовили примеры, как это сделать на самых популярных языках — Python, PHP и JavaScript.

API налоговой бесплатное, но используете его вы на свой страх и риск. Никто не гарантирует, что оно будет работать корректно и стабильно.

@unixzen
unixzen / Dockerfile
Created May 21, 2020 16:25 — forked from toddlers/Dockerfile
using envsubst in Dockerfile
FROM ubuntu:trusty
RUN \
apt-get update \
&& apt-get -y install gettext-base \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV VALUE=foo
ENV VALUE1=boo
COPY config.txt source_config.txt
@unixzen
unixzen / docker-compose.yml
Created June 2, 2020 08:03 — forked from wshihadeh/docker-compose.yml
Traefik docker compose
version: '3.7'
networks:
traefik:
external: true
volumes:
db_data:
secrets:
@unixzen
unixzen / docker-compose.yml
Created June 3, 2020 09:00 — forked from anlek/docker-compose.yml
Setting up error page for traefik and it's applications
app:
image: my/webapp:latest
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:supercoolapp.com"
- "traefik.frontend.errors.network.backend=error"
- "traefik.frontend.errors.network.query=/{status}.html"
- "traefik.frontend.errors.network.status=500-511"
- "traefik.port=3000"
error_pages: