Skip to content

Instantly share code, notes, and snippets.

View mannharleen's full-sized avatar
👽

Harleen Mann mannharleen

👽
View GitHub Profile
ln -n -s /mnt/c/Users/mannh/go /home/mannh/
@mannharleen
mannharleen / main.go
Created February 16, 2020 12:30 — forked from err0r500/main.go
gin gonic with jwt from auth0 (and CORS enabled)
package main
import (
"github.com/auth0/go-jwt-middleware"
"github.com/dgrijalva/jwt-go"
"gopkg.in/gin-gonic/gin.v1"
)
func main() {
startServer()
/*
ref:
http://www.passportjs.org/packages/passport-cookie/
https://github.com/M-Yankov/passport-cookie
*/
var passport = require('passport')
var express = require('express');
var cookieParser = require('cookie-parser');
var CookieStrategy = require('passport-cookie')
var app = express();
// given package name "del"
// has a function named "f1"
go build -gcflags "-m -m"
// profile using only Test... (NOT POSSIBLE)
// benchmark results
go test -run=xx -bench=. -benchmem
@mannharleen
mannharleen / defaultRouteLambdaAWSELB.js
Last active October 25, 2019 05:35
defaultRouteLambdaAWSELB
exports.handler = async (event) => {
console.log(event)
let response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
headers: {"content-type": "text/html"}
};
return response;
};
{
"modules": [
{
"description": "SOAP Client for Node Red",
"id": "node-red-contrib-soap",
"keywords": [
"soap",
"node-red",
"node"
],
This file has been truncated, but you can view the full file.
{
"modules": [
{
"description": "Node-RED node that receives snmp traps.",
"id": "node-red-contrib-snmp-trap-listener",
"keywords": [
"node-red"
],
"types": [
"snmp-trap-listener"

How to read file into a buffer i.e. using chunks

package main

import (
	"bufio"
	"flag"
	"fmt"
	"io"
@mannharleen
mannharleen / golang_squareroot.go
Created July 25, 2019 10:37
Go: Newton's method for square root (using recursion)
package main
import (
"fmt"
)
var z = 100.0 // the seed
var delta = 0.0001 // the epsilon
func Sqrt(x float64) float64 {