Skip to content

Instantly share code, notes, and snippets.

View unixzen's full-sized avatar
🎯
Focusing

Eugene unixzen

🎯
Focusing
View GitHub Profile
@unixzen
unixzen / gist:6206af64a1623b238d4a13c52abeea73
Created August 23, 2019 06:21
Openstack terraform plan repeat after creating
user@local-comp:~/terraform/openstack $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
openstack_compute_instance_v2.ed-test: Refreshing state... [id=b0cd4f94-2fd9-4c6c-9a8e-d869e7acc3ef]
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
@unixzen
unixzen / gist:d8f1fc63c9be1841e841938809362500
Created August 23, 2019 06:26
Openstack terraform config
resource "openstack_compute_instance_v2" "ed-test" {
name = "ed-test"
image_id = "${var.image}" # Default image is ubuntu 16.04
image_name = "ubuntu16"
flavor_id = "0a762fd0-6f8f"
security_groups = ["default"]
key_pair = "test"
network {
name = "Int"
@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 / gist:d2007458b7ff6154d33f2ac499420cd1
Last active November 19, 2023 11:27
Docker-compose Traefik 2.0 + Nexus with Docker Registry
version: '3.3'
services:
traefik:
image: "traefik:v2.0.0"
container_name: "traefik"
command:
- "--log.level=DEBUG"
# - "--accesslog=true"
@unixzen
unixzen / gist:85ac4643509ffd8853f19c4a0f1498ed
Created October 30, 2019 11:38
Partial function application Golang
package main
import (
"fmt"
"github.com/choleraehyq/gofunctools/functools"
// "log"
)
func main() {
add := func(a, b int) int {
@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