Skip to content

Instantly share code, notes, and snippets.

View ganesshkumar's full-sized avatar
⌨️
Click. Clack. Click. Click.

Ganessh Kumar ganesshkumar

⌨️
Click. Clack. Click. Click.
View GitHub Profile
@ganesshkumar
ganesshkumar / profile.json
Last active January 27, 2020 04:36
Windows Terminal
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
@ganesshkumar
ganesshkumar / diceProb.output.md
Created October 16, 2018 08:31
Royal Game of Ur - Dice roll distribution
Distribution of outcomes:  { '0': 81, '1': 108, '2': 54, '3': 12, '4': 1 }
Total number of outcomes:  256
Probability for each outcome:  { '0': 0.31640625,
  '1': 0.421875,
  '2': 0.2109375,
  '3': 0.046875,
  '4': 0.00390625 }
Total probability:  1

Keybase proof

I hereby claim:

  • I am ganesshkumar on github.
  • I am ganesshkumar (https://keybase.io/ganesshkumar) on keybase.
  • I have a public key ASCPzCuZBtabtgLqt7MPL7MFhUzbdcDf7RABPWAZ3RvVHgo

To claim this, I am signing this object:

@ganesshkumar
ganesshkumar / python-afterburn.md
Created December 22, 2017 13:53
OpenFaaS python afterburn template loadtest

Running the watchdog locally

➜  python-afterburn git:(master) ✗ mode=afterburn fast_fork=1 port=8081 fprocess="python2 index.py" fwatchdog
2017/12/22 19:19:39 OperationalMode: AfterBurn
Forking - python2 [index.py]
2017/12/22 19:19:39 Started logging stderr from function.
2017/12/22 19:19:39 Writing lock file at: /var/folders/q2/b6ph5sg17yx855gl6hzp7ypm0000gn/T/.lock

I am following this post,Build a Serverless Golang Function with OpenFaaS , to create a function in go.

You can find my function to generate identicon on Github.

  • Make sure you are using the branch go-template if you are cloning the repo.
  • The master brach is a standalone repo and it is not based on go template.

Setting up the fuction

Switch to your function folder

$ cd $FUNCTIONS_FOLDER
@ganesshkumar
ganesshkumar / applicaion-access-keys-calls..js
Created October 3, 2017 11:54
Making MitterIO App Access Key API calls with Postman
// Setup your headers this way (it'd be better if you used Presets for this)
//
// X-Application-Access-Key : {{mitter_appAccessKey}}
// Content-Type : application/json
// Date : {{mitter_requestDate}}
// Nonce : {{mitter_requestNonce}}
// Content-MD5 : {{mitter_requestPayloadMd5}}
// Authorization : {{mitter_requestAuthorization}}
// Then add the following script as a pre-request script (you will have to create a new environment
@ganesshkumar
ganesshkumar / environmental_variables.rb
Created January 18, 2017 09:02
Jekyll plugin to load environmental variables
module Jekyll
class EnvironmentVariablesGenerator < Generator
def generate(site)
site.config['title'] = ENV['TITLE']
site.config['description'] = ENV['DESCRIPTION']
site.config['twitter'] = ENV['TWITTER_USERNAME']
site.config['github'] = ENV['GITHUB_USERNAME']
site.config['linkedin'] = ENV['LINKEDIN_PUBLIC_ID']
import click
class Config(object):
def __init__(self):
self.verbose = False
pass_config = click.make_pass_decorator(Config, ensure=True)
@click.group()
@click.option('--verbose', is_flag=True)
@ganesshkumar
ganesshkumar / webview.lua
Created November 30, 2016 21:34
Hammerspoon
function showBrowser()
local wv = hs.webview.new(hs.screen.primaryScreen():frame())
wv:url("http://www.google.com"):windowStyle({"titled", "closable", "resizable"}) :show()
-- bring the webview to front
hs.application.get("Hammerspoon"):activate()
end
@ganesshkumar
ganesshkumar / KruskalMST.java
Created July 27, 2016 23:24
Kruskal's Minimum Spanning Tree using Java Stream
package greedy;
import java.util.*;
import java.util.stream.IntStream;
/**
* Created by ganessh on 28/07/16.
*/
class Edge {
private int source;