Skip to content

Instantly share code, notes, and snippets.

View myugan's full-sized avatar
☁️
Working from cloud

Muhammad Yuga N. myugan

☁️
Working from cloud
View GitHub Profile
@myugan
myugan / monitoring.py
Created July 15, 2018 17:28
Python 3 - Simple script to show system info, load avg, cpu, memory, storage and packet data.
#!/usr/bin/env python
import os, platform, subprocess, socket, psutil, netifaces, cpuinfo
#command = "cat /proc/cpuinfo"
#print(subprocess.check_output(command, shell=True).strip())
kb = float(1024)
mb = float(kb ** 2)
gb = float(kb ** 3)
@myugan
myugan / autobackup.sh
Last active June 6, 2020 11:24
Bash script for databases daily backup
#!/bin/bash
# CRED
DB_USER="user"
DB_PASS="user"
DB_NAME="dbname"
# PATH/DIR
SRCDIR="/path/to/backups"
EXPDIR="$SRCDIR/$DB_NAME_$(date +"%H%M-%d-%m-%Y").sql"
@myugan
myugan / steghide-extract.sh
Created March 24, 2020 10:22
Extract all hidden files on spesific directory with password using steghide
#!/bin/bash
dir="Stego\ Files"
for i in $dir/*;do
# password list
pass=( "christmastree" "darksky123" "goldenwatch")
for x in "${pass[@]}";do
steghide extract -sf "${i}" -p "${x}" 2>/dev/null
done
input {
beats {
port => 5044
}
}
filter {
if [message] =~ /^#/ {
drop { }
}
@myugan
myugan / docker-setup.sh
Last active March 14, 2021 02:16
Setup Docker and Compose on Ubuntu 18.04 machine
#!/bin/bash
# Install dependency
apt install -y apt-transport-https ca-certificates curl software-properties-common
# Add GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add docker repository to APT sources
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y
#!/bin/bash
wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
tar -xvf go1.14.4.linux-amd64.tar.gz
mv go /usr/local
tee -a ~/.profile << END
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
@myugan
myugan / gcloud-install.sh
Created June 20, 2020 16:17
Install gcloud on Ubuntu based
#!/bin/bash
sudo apt-get install apt-transport-https ca-certificates gnupg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install -y google-cloud-sdk
gcloud auth login
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: webserver
name: webserver
namespace: production
spec:
replicas: 1
selector:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: webserver
name: webserver
namespace: development
spec:
replicas: 1
selector:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-ingress
spec:
podSelector: {}
policyTypes:
- Ingress