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 / 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
@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

# 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.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": [

@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 / MySQL_5-7_macOS.md
Created March 21, 2019 11:06 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@nk-gears
nk-gears / sparse_clones.md
Created March 16, 2019 15:38 — forked from hofnerb/sparse_clones.md
Make sparse clone
git init <repo>
cd <repo>
git remote add -f origin <url>

This creates an empty repository with your remote, and fetches all objects but doesn't check them out. Then do:

git config core.sparseCheckout true
@nk-gears
nk-gears / csv_import_magic.js
Created February 8, 2019 11:58 — forked from ianlewis/csv_import_magic.js
A Google Apps Script for importing CSV data into a Google Spreadsheet.
// vim: ft=javascript:
/*jslint sloppy: true, vars: true, white: true, nomen: true, browser: true */
/*global SpreadsheetApp, UiApp, UrlFetchApp, Utilities */
/*
* A script to automate requesting data from an external url that outputs CSV data.
*
* Adapted from the Google Analytics Report Automation (magic) script.
* @author [email protected] (Nick Mihailovski)
* @author [email protected] (Ian Lewis)
*/
@nk-gears
nk-gears / Windows10-Setup.ps1
Created November 16, 2018 17:03 — forked from NickCraver/Windows10-Setup.ps1
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@nk-gears
nk-gears / wildcard-certificates.md
Created October 19, 2018 11:19 — forked from joepie91/wildcard-certificates.md
Why you probably shouldn't use a wildcard certificate

Recently, Let's Encrypt launched free wildcard certificates. While this is good news in and of itself, as it removes one of the last remaining reasons for expensive commercial certificates, I've unfortunately seen a lot of people dangerously misunderstand what wildcard certificates are for.

Therefore, in this brief post I'll explain why you probably shouldn't use a wildcard certificate, as it will put your security at risk.

A brief explainer

It's generally pretty poorly understood (and documented!) how TLS ("SSL") works, so let's go through a brief explanation of the parts that are important here.

The general (simplified) idea behind how real-world TLS deployments work, is that you: