Skip to content

Instantly share code, notes, and snippets.

View rizerzero's full-sized avatar
🎯
Focusing

Juba B rizerzero

🎯
Focusing
View GitHub Profile
@rizerzero
rizerzero / bash_strict_mode.md
Created May 23, 2022 10:28 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
APP_DEV=static.intermail.dev.$1.jp7.com.br
echo "Creating S3 development bucket " $APP_DEV"...\n"
aws s3api create-bucket --bucket $APP_DEV --region us-east-1
echo "Setting Static Web Hosting...\n"
aws s3api put-bucket-website --bucket $APP_DEV --website-configuration file://website-config.json
echo "Bucket" $APP_DEV "created, visit AWS Console to create IAM user for said bucket.\n"
APP_QA=static.intermail.qa.$1.jp7.com.br
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJO5uH6Bj+dJPOfN9iRAxq4XHnIAI+iwvXgajHIXOeJu kube@xps17
@rizerzero
rizerzero / aws.py
Created January 7, 2019 10:17 — forked from philkuz/aws.py
check S3 bucket exists with python
from aws import bucket_exists, upload_path
bucket_name = 'cnns-music-vids'
directory_to_upload = 'data/'
output_s3_directory = 'data/'
if bucket_exists(bucket_name):
print('the bucket exists!')
else:
raise ValueError('nah the bucket does not exist')
@rizerzero
rizerzero / bash_strict_mode.md
Created May 23, 2022 10:28 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@rizerzero
rizerzero / mysql_splitdump.sh
Last active December 22, 2021 08:50 — forked from Nolwennig/mysql_splitdump.sh
Split MySQL dump SQL file into one file per table or extract a single table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
# TO be tested
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
@rizerzero
rizerzero / automated install debian 11 FR
Last active December 10, 2021 20:20
automated install debian 11 FR
#_preseed_V1
#### Contents of the preconfiguration file (for bullseye)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_FR
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
@rizerzero
rizerzero / setup debian on asus prime A320M-K
Last active August 20, 2021 12:59
setup debian on asus prime A320M-K
# Install wifi drivers
-------------------------------
apt-get update && apt-get install firmware-iwlwifi
# Install graphic drivers
-------------------------------
@rizerzero
rizerzero / docker-compose.yml
Created May 12, 2021 13:28 — forked from spy86/docker-compose.yml
Reverse proxy in Traefik + docker with subdirectories.
version: '3.7'
services:
traefik:
image: traefik:v2.2.0
ports:
- "${FRONT_HTTP_PORT:-80}:80"
# - "${TRAEFIK_PORT:-8080}:8080"
environment:
# - TRAEFIK_LOG_LEVEL=DEBUG
- TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT=false
@rizerzero
rizerzero / traefik-redirect-path.md
Created May 12, 2021 13:21 — forked from kekru/traefik-redirect-path.md
Traefik redirect / (root) to sub path with Docker labels

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect