Skip to content

Instantly share code, notes, and snippets.

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

Nirmal nk-gears

💥
experimenting...
View GitHub Profile
import React, { Component } from "react";
const omit = (obj, omitKey) =>
Object.keys(obj).reduce((result, key) => {
if (key !== omitKey) {
result[key] = obj[key];
}
return result;
}, {});
const overlayStyles = {
@nk-gears
nk-gears / index.js
Created June 6, 2020 13:54 — forked from LaureRC/index.js
Backup cloud function
const { google } = require("googleapis");
const { auth } = require("google-auth-library");
var sqladmin = google.sqladmin("v1beta4");
// Based on https://medium.com/@kennethteh90/how-to-schedule-daily-cloud-sql-export-to-google-cloud-storage-4c1bd360af06
exports.backup = async (_req, res) => {
const authRes = await auth.getApplicationDefault();
let authClient = authRes.credential;
var request = {
@nk-gears
nk-gears / StorageAccountDefaultKey.json
Last active June 6, 2020 13:50 — forked from eNeRGy164/LoremIpsumKeyVault.json
Adding default Blob Key to KeyVault
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.KeyVault/vaults",
"name": "LoremVault",
"apiVersion": "2015-06-01",
"location": "[resourceGroup().location]",
"properties": {
@nk-gears
nk-gears / write-two-millio-rows-of-csv-data-with-node-cluster.js
Created April 2, 2020 11:21 — forked from midnightcodr/write-two-millio-rows-of-csv-data-with-node-cluster.js
How to write two million rows of csv data using faker.js and node cluster
const faker = require('faker')
// const N = 30
const N = 2000000
const fs = require('fs')
const record = () => {
// faker.fake(
// '{{name.lastName}},{{name.lastName}},{{address.city}},{{address.county}},{{address.zipCode}},{{hacker.adjective}}\n'
return [
faker.name.firstName(),
faker.name.lastName(),
@nk-gears
nk-gears / php-server-with-wordpress.md
Created March 26, 2020 11:24 — forked from edheltzel/php-server-with-wordpress.md
Using PHP's built in server for WordPress development.

Preface

So in the past, I've used MAMP/MAMP Pro apps and others alike. I've also, setup my own local MAMP stack with homebrew, that used dnsmasq to dynamically add vhosts anytime I added a new folder to the Sites folder which made it very convenient. But, then I started running into other environment issues with PHP versions on remote machines/servers not being updated or some other crazy thingamabob breaking. I researched and invested time in Vagrant, but that seem to break more often than my homebrew setup. So I researched again investing time into Docker via Docker for Mac (which is BAMF), which I'm sold on and use daily, but it still seems a little bleeding edge and not so simple to wrap your head around the concept. Not to mention I don't have a real use case to play with and take advantage of all the features that come packed with Docker.

This is the beginning of trying to find something more simple, and slightly quicker to setup.

####################
# 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 #
######################
# Create The Cluster #
######################
gcloud auth login
REGION=us-east1
MACHINE_TYPE=n1-standard-1
@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/babel-standalone@6.26.0/babel.js"></script>
@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>
"""
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