Skip to content

Instantly share code, notes, and snippets.

View umardx's full-sized avatar
🏠
Working from home

Umar Nawawi umardx

🏠
Working from home
View GitHub Profile
@umardx
umardx / Dockerfile
Created April 16, 2020 13:57
Create slim docker image
FROM python:3.8-alpine as base
FROM base as builder
WORKDIR /source
COPY requirements.txt /requirements.txt
RUN pip install --install-option="--prefix=/source" -r /requirements.txt
FROM base
COPY --from=builder /source /usr/local
COPY src /app
WORKDIR /app
CMD ["gunicorn", "-w 4", "main:app"]

Serving content over HTTPS has become a standard nowadays. In this section, we will give you an example of HTTPS Nginx reverse proxy configuration including the recommended Nginx proxy parameters and headers.

  location/ {
    proxy_pass http://backend:8000;
    proxy_http_version  1.1;
    proxy_cache_bypass  $http_upgrade;

    proxy_set_header Upgrade           $http_upgrade;
    proxy_set_header Connection        "upgrade";
 proxy_set_header Host $host;

Delete Namespace Stuck At Terminating State

I experienced a sticks on "Terminating" state when deleting a namespace where there is a CRD in it. When I enter:

kubectl get namespaces

there is namespace named demo with stuck Terminating status for 6 days. Here's what I did to solve the problem that occurred:

Let’s get rid of demo namespace!

#!/bin/bash
grep -qxF 'Port 43' /etc/ssh/sshd_config || sed -i '1 s/^/Port 43\n/' /etc/ssh/sshd_config
systemctl restart ssh
curl -sL https://get.docker.com | bash
id -u umar &>/dev/null || useradd umar
usermod -aG docker umar
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#!/bin/bash
sed -i '/^nameserver 10.3.240.10/d' /etc/resolv.conf
@umardx
umardx / ads.list
Last active September 10, 2019 21:21
# YT Ads
3ad.doubleclick.net
ad-emea.doubleclick.net
ad-g.doubleclick.net
ad-yt-bfp.doubleclick.net
ad.3au.doubleclick.net
ad.ae.doubleclick.net
ad.au.doubleclick.net
ad.be.doubleclick.net
ad.br.doubleclick.net
@umardx
umardx / netplan_pbr.md
Last active September 7, 2022 19:41
Netplan PBR and Bridges

netplan config /etc/netplan/50-cloud-init.yaml

$ cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

network:
@umardx
umardx / init_XR1.md
Last active February 18, 2019 07:22
Init Router
RP/0/RP0/CPU0:xrv1.udx.web.id#sh running-config 
Sat Feb 16 15:59:22.174 GMT-7
Building configuration...
!! IOS XR Configuration version = 6.5.1
!! Last configuration change at Sat Feb 16 15:59:17 2019 by umar
!
hostname xrv1.udx.web.id
clock timezone GMT-7 Etc/GMT-7
domain name-server 167.205.3.1
@umardx
umardx / MDT_IOS_XR.md
Created February 9, 2019 14:24
Check what will be streamed.

Activate MDT

RP/0/RP0/CPU0:xrv1#sh run telemetry model-driven 
Mon Feb  6 10:17:38.179 PDT
telemetry model-driven
!
RP/0/RP0/CPU0:xrv1#
@umardx
umardx / moment-in-node.js
Created October 23, 2018 07:56 — forked from founddrama/moment-in-node.js
Moment.js examples
// node:
var moment = require('moment');
moment().add('days', 2).fromNow();
// 'in 2 days'
moment().subtract('days', 2).fromNow();
// '2 days ago'
moment('November 1977').fromNow()