Skip to content

Instantly share code, notes, and snippets.

View prantoran's full-sized avatar
🐢
A journey of a thousand miles begins with a single step. -Lao Tzu

Pinku Deb Nath prantoran

🐢
A journey of a thousand miles begins with a single step. -Lao Tzu
View GitHub Profile
@prantoran
prantoran / min-char-rnn.py
Created January 29, 2022 06:14 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@prantoran
prantoran / main.go
Created May 26, 2019 05:04
graceful-server
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"time"
package main
import (
"fmt"
"os"
"os/signal"
"sync"
"time"
)
jbts, err := json.Marshal(PubSubKey) // assuming the data of the json key is in the PubSubKey struct
if err != nil {
log.Println("could not convert api json to bytes:", err)
return
}
conf, err := google.JWTConfigFromJSON(jbts, "https://www.googleapis.com/auth/pubsub")
if err != nil {
log.Fatal(err)
}
ts := conf.TokenSource(ctx)
func main() {
pflag.String("subscription", "example-subscription", "name of subscriber")
pflag.Parse()
viper.BindPFlags(pflag.CommandLine)
ctx := context.Background()
proj := "pubsubx-206305"
client, err := pubsub.NewClient(ctx, proj)
if err != nil {
log.Fatalf("Could not create pubsub Client: %v", err)
}
func main() {
ctx := context.Background()
proj := "pubsubx-206305"
client, err := pubsub.NewClient(ctx, proj)
if err != nil {
log.Fatalf("Could not create pubsub Client: %v", err)
}
const topic = "my-topic"
// Create a new topic called my-topic.
package main
import (
"net/http"
"os"
"testing"
"github.com/prantoran/go-mock-microservice/mocks"
"github.com/prantoran/go-mock-microservice/printer"
)
package mocks
import "github.com/prantoran/go-mock-microservice/printer"
type PrintFunc func(string) (*printer.Resp, error)
type MockPrinter struct {
MockPrintFunc PrintFunc
}
package printer
import (
"io/ioutil"
"net/http"
)
type Printer interface {
Print(s string) (*Resp, error)
}