Skip to content

Instantly share code, notes, and snippets.

@rhrn
rhrn / README.md
Last active August 2, 2023 19:43
Encrypt your data with your password with web encryption and nodejs using prompts

Nodejs

Encrypt your raw text (seed phrase, text, ...) with password

node enc.mjs

Decrypt encrypted base64 data with your password

node dec.mjs
Dockerfile
target
.git
.env
@rhrn
rhrn / kubernetes-nginx-test.yaml
Created May 1, 2019 13:36
Kubernetes test nginx yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-test-config
data:
nginx.conf: |
worker_processes 1;
error_log /dev/stdout info;
@rhrn
rhrn / inventory.yml
Created March 14, 2019 21:05
Jumphost / Bastion : ssh, ansible examples
# ansible hosts
all:
children:
project-servers:
hosts:
ingress:
ansible_user: ubuntu
ansible_host: 192.168.9.12 # replace by internal ip
app:
@rhrn
rhrn / install-vim-plug-editorconfig.sh
Last active July 31, 2018 10:01
Install vim plugin from scratch / vim-plug / editorconfig
mkdir -p ~/.vim/autoload
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "
call plug#begin('~/.vim/plugged')
Plug 'editorconfig/editorconfig-vim'
call plug#end()
" >> ~/.vimrc
vim +PlugInstall editorconfig-vim +qall
## Setup
DOMAIN=example.com #! change it
EMAIL=admin@example.com #! change it
STACK=my
WEBROOT=${STACK}_letsencrypt_webroot_data:/etc/letsencrypt_webroot
DATA=${STACK}_letsencrypt_data:/etc/letsencrypt
## Request certificates
docker run --rm -v $WEBROOT -v $DATA certbot/certbot certonly --webroot --webroot-path /etc/letsencrypt_webroot -d $DOMAIN -m $EMAIL --agree-tos
## Setup
STACK=my
WEBROOT=${STACK}_letsencrypt_webroot_data:/etc/letsencrypt_webroot
DATA=${STACK}_letsencrypt_data:/etc/letsencrypt
SERVICE=${STACK}_nginx-front
## Request renew
docker run --rm -v $WEBROOT -v $DATA certbot/certbot renew
## Update all certificates in nginx service or you can use grep `$(ls /etc/letsencrypt/live/ | grep some-domain)`
version: '3.6'
services:
custom-service:
image: registry.example.com/custom-service:latest
build:
context: ./custom-service
upstream custom-service-upstream {
server custom-service:80;
}
server {
listen 8080;
server_name example.com;
location / {
return 301 https://$host$request_uri;
upstream registry-upstream {
server registry:5000;
}
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
'' 'registry/2.0';
}
server {
listen 8443 ssl http2;