Skip to content

Instantly share code, notes, and snippets.

View lnxph-devops-sareno's full-sized avatar
💻

Eladio Jr Sareno lnxph-devops-sareno

💻
View GitHub Profile
@lnxph-devops-sareno
lnxph-devops-sareno / bash_strict_mode.md
Created May 28, 2023 11:16 — 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
@lnxph-devops-sareno
lnxph-devops-sareno / nginx.conf
Created November 13, 2022 13:56
Jellyfin NginX configuration
server {
server_name stream.example.com;
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/stream.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/stream.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
###### Jellyfin - Reverse Proxy Recommended Config Start (https://jellyfin.org/docs/general/networking/nginx.html) ######
add_header Strict-Transport-Security "max-age=31536000" always;
@lnxph-devops-sareno
lnxph-devops-sareno / python_setup_py.md
Last active April 8, 2021 02:05
Python Cheat Sheet

setup.py

package_data

package_data copy the files into Python site-packages level directory.

data_files

data_files copy the files into System-wide level directory.

install_requires

install_requires install the library dependencies.

@lnxph-devops-sareno
lnxph-devops-sareno / SimpleHTTPServerWithUpload.py
Created October 14, 2020 03:17 — forked from touilleMan/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@lnxph-devops-sareno
lnxph-devops-sareno / dockerize-mongodb-replica.md
Created October 6, 2020 06:54
Dockerize MongoDB Replica

Dockerize MongoDB Replica

Create a MongoDB Replica set with 3 members on local machine with Docker

On this context

  • MongoDB Replica Set are inspired and based on the official tutorial
  • We assume you already knew how to use Docker
  • We'll use the following DNS hostnames
    www.r0.mongodb.my
    www.r1.mongodb.my
    
@lnxph-devops-sareno
lnxph-devops-sareno / nginx-local-environment-setup.md
Last active September 30, 2020 07:42
Setup a Nginx local environment for testing

Nginx - Setup a local environment for testing

Create a Nginx configuration

/etc/nginx/sites-enabled/example.com.conf

server {
    listen 80;
    server_name example.com www.example.com;
    
 location / {
@lnxph-devops-sareno
lnxph-devops-sareno / nginx-content-injection.md
Created September 30, 2020 02:31
HTTP Content Injection with Nginx

Nginx - Content injection

/etc/nginx/sites-enabled/example.com.conf

server {
    listen 80;
    server_name example.com www.example.com;
    
    root /var/www/example.com;
 index index.html;
@lnxph-devops-sareno
lnxph-devops-sareno / teamcity-create-new-agent-using-docker-image.md
Last active August 21, 2020 02:08
TeamCity - Adding of new Agent using Docker image

Creating a Custom Docker Image and Pushing it to Docker Hub

Login to Docker Hub

$ docker login

Pull a Base Docker Image

$ docker run -ti -d --name my-custom-image ubuntu:latest bash

Create a Linux Service Using systemd

Create a systemd Service

/etc/systemd/system/djangoexample-boot.service

[Unit]
Description=Service for django.example.com
Before=nginx.service
StartLimitIntervalSec=0