Skip to content

Instantly share code, notes, and snippets.

@harshitsinghai77
harshitsinghai77 / imgbb.py
Created August 8, 2021 09:20
Imgbb upload image via image url
import sys
from urllib import request, parse
import json
API_KEY = 'API_KEY'
IMG_UPLOAD = 'https://api.imgbb.com/1/upload'
# total arguments
n = len(sys.argv)
from functools import wraps
from time import time
import click
import numba
import pandas as pd
import numpy as np
@click.group()
def cli():
name: Python application test with Github Actions
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
@harshitsinghai77
harshitsinghai77 / main.go
Created November 4, 2020 08:55
using go-restful to create REST API using go programming language.
package main
import (
"database/sql"
"encoding/json"
"log"
"net/http"
"time"
"github.com/emicklei/go-restful"
package dbutils
import (
"database/sql"
"log"
)
// Initialize the database and create required table
func Initialize(dbDriver *sql.DB) {
statement, driverError := dbDriver.Prepare(clubs)
@harshitsinghai77
harshitsinghai77 / models.go
Created November 4, 2020 08:29
Go models.go file using go-sqlite3
package dbutils
const clubs = `
CREATE TABLE IF NOT EXISTS clubs (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
NAME VARCHAR(64) NOT NULL,
COUNTRY VARCHAR(64) NOT NULL,
STADIUM VARCHAR(64) NOT NULL,
CreatedAt TIME NULL
)
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/mattn/go-sqlite3"
)

Harshit Singhai User Manual

This is my user manual. If we are working together (or planning to), please read it carefully. You will learn how to deal with me productively and avoid misunderstandings.

My style

  • I need to understand why I'm doing something
  • I love working as a part of a team, not as an individual
  • I love pair programming
  • I like to have a very basic working version first and iterate on it
@harshitsinghai77
harshitsinghai77 / async-await-python-without-asyncio.py
Created October 11, 2020 15:09
A simple python programme to demonstrate some heavy calculation inside the function.
import time
import datetime
start = datetime.datetime.now()
def two():
print("Starting two")
time.sleep(4)
print("Hey two")
class ClassA():
def hi(self):
print("Hey")
class ClassB():
def hi(self):
print("Hello")
def another_method(self):