Skip to content

Instantly share code, notes, and snippets.

View nk-gears's full-sized avatar
💥
experimenting...

Nirmal nk-gears

💥
experimenting...
View GitHub Profile
@nk-gears
nk-gears / mysql-docker.sh
Created April 9, 2019 07:05 — forked from saniaky/aws-s3-policy.json
Backup and restore a ALL MySQL databases from a running Docker MySQL container.
CONTAINER=db
# Backup
docker exec $CONTAINER sh -c \
'mysqldump --all-databases --quick --single-transaction --skip-lock-tables --flush-privileges -uroot -p"$MYSQL_ROOT_PASSWORD"' \
| gzip > ./backup.sql.gz
# Restore
gunzip ./backup.sql.gz
cat backup.sql | docker exec -i $CONTAINER sh -c 'mysql -uroot -p"$MYSQL_ROOT_PASSWORD"'
@nk-gears
nk-gears / README.md
Created April 9, 2019 07:05
Automatic backup of all MySQL databases to AWS S3 + restore script that downloads latest backup and imports it
  1. Create S3 bucket db-backup
  2. Specify Expire Policty to remove old backups
    Open Bucket Settings -> Management -> Add lifecycle rule -> Expiration tab
    Select Expire current version of object. Use 30 days.
    Select Permanently delete previous versions. Use 1 day.
  3. Create user db-backup-user, assign inline permission policy:
    {
        "Version": "2012-10-17",
    

"Statement": [

# tunnel online
ngrok tcp 3306
# connection
user=root
pass=techne
host=0.tcp.ngrok.io
port=16799
mysql -u$user -h$host -P$port -p$pass
@nk-gears
nk-gears / README.rst
Created July 28, 2019 15:19 — forked from shimizukawa/README.rst
Sphinx with Markdown !!

Limitations

CommonMark-py supports syntax of CommonMark. So, CommonMark-py doesn't support sphinx/reST role and directives.

References

@nk-gears
nk-gears / apache-reverse-proxy.conf
Created July 29, 2019 06:23 — forked from alexklibisz/apache-reverse-proxy.conf
Apache Port Forward / Reverse Proxy Config
# Running some application on port 8080, want to make it
# available at subdomain.example.com
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName subdomain.example.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
"""
Azure Table Storage - Python Batching Example
(C) 2016 MediaRealm.com.au
Needs v0.30.0 of the Azure Storage Python SDK
https://github.com/Azure/azure-storage-python/releases/tag/v0.30.0
"""
from azure.storage.table import TableService, Entity, TableBatch
@nk-gears
nk-gears / index.html
Created September 28, 2019 11:25 — forked from gaearon/index.html
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@nk-gears
nk-gears / 00-hello-world.html
Created September 28, 2019 11:30 — forked from dulimarta/00-hello-world.html
CS371 React Samples with Dropin Scripts
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Hello React</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/babel.js"></script>
######################
# Create The Cluster #
######################
gcloud auth login
REGION=us-east1
MACHINE_TYPE=n1-standard-1
####################
# Create A Cluster #
####################
# Open Docker Preferences, select the Kubernetes tab, and select the "Enable Kubernetes" checkbox
# Open Docker Preferences, select the Advanced tab, set CPUs to 2, and Memory to 3.0
###################
# Install Ingress #