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 / README.md
Created June 6, 2020 13:47
Setup App Registration via Powershell

@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 / live-ctrl.html
Created April 26, 2020 09:58
Html Page UI - Youtube Live
<!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>Youtue Stream Manager</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
@nk-gears
nk-gears / updateTransition.js
Created April 26, 2020 09:57
Start & End the Live (Go Live & End Stream)
function updateTransition(transitionState){
YouTube.setTokenService(function(){ return getYouTubeService().getAccessToken(); });
var resp=YouTube.liveBroadcastsList("snippet,status", {id:videoId});
return YouTube.liveBroadcastsTransition(transitionState, videoId, "status", {});
}
function startLive(videoId){
const transitionState="live";
updateTransition(transitionState);
}
@nk-gears
nk-gears / bindBroadcast.js
Created April 26, 2020 09:57
Bind the Broadcast to Stream
function bind_broadcast(broadcast_id, stream_id){
const bind_broadcast_response = YouTube.liveBroadcastsBind(broadcast_id,"id,contentDetails", {"streamId":stream_id});
return bind_broadcast_response;
}
@nk-gears
nk-gears / updateBroadcast.js
Created April 26, 2020 09:55
Update the Broadcast Category and MadeForKids flag and also the Video Thumbnails.
function updateBroadcastMeta(videoId){
var resp=YouTube.videosList("snippet,status",{id:videoId});
resp[0].snippet["categoryId"]=27;
//It's mandatory to declare whether the video is made for the kids or not.
resp[0].status["madeForKids"]=false;
resp[0].status["selfDeclaredMadeForKids"]=false;
YouTube.videosUpdate("snippet,status",{id:videoId,snippet:resp[0].snippet,status:resp[0].status}, {});
}
@nk-gears
nk-gears / getStreamInfo
Created April 26, 2020 09:55
Get the Re-usable Stream Info
function getStreamInfo(streamId){
//var streamId="<your-fixed-stream-id>";
YouTube.setTokenService(function(){ return getYouTubeService().getAccessToken(); });
var resp=YouTube.liveStreamsList("snippet,cdn", {id:streamId});
return stream_resources[0];
}
@nk-gears
nk-gears / scheduleEvent.js
Created April 26, 2020 09:53
Schedule Live Event
const streamId='<Get your stream Id>'
fuction scheduleEvent(){
var actualString = Utilities.formatDate(
row.actual_date,
Session.getScriptTimeZone(),
"YYYY-MM-dd'T'HH:mm:ssZZZZZ"
);
actualString = actualString.replace('00:00:00+0530', '01:40:00.000Z');
@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.