Skip to content

Instantly share code, notes, and snippets.

View shubhamnikam's full-sized avatar
🎯
focusing

Shubham Nikam shubhamnikam

🎯
focusing
View GitHub Profile
@shubhamnikam
shubhamnikam / Dockerfile
Created October 22, 2023 14:58
create auto subtitle from any videos using openai-whisper
FROM ubuntu:latest
RUN apt update && apt install ffmpeg -y
RUN apt install python3 -y && apt install python3-pip -y
RUN pip install -U openai-whisper
RUN pip install setuptools-rust
@shubhamnikam
shubhamnikam / Startup.cs
Created June 2, 2022 08:17
Typed Client
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
//configure httpclient service
services.AddHttpClient<IGithubService, GithubService>(client =>
{
//customize as per your need
client.BaseAddress = new Uri("http://api.github.com/");
client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");
@shubhamnikam
shubhamnikam / main.py
Created August 15, 2021 18:39
Python CRUD operation with mongodb
import pymongo
def get_db_connection():
db_client = pymongo.MongoClient("mongodb+srv://YOUR_USERNAME:YOUR_PWD@YOUR_SERVER/")
db_conn = db_client["test_db"]
db_coll = db_conn["products"]
return db_coll
@shubhamnikam
shubhamnikam / GithubController.cs
Last active August 21, 2023 02:43
Named Client implementation of IHttpClientFactory
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace TestAPIGithub.Controllers
{
@shubhamnikam
shubhamnikam / Startup.cs
Created February 20, 2021 17:28
Setup HttpClient configuration in Startup.ConfigureService
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
//configure httpclient service
services.AddHttpClient("GithubAPI", client=>
{
//customize as per your need
client.BaseAddress = new Uri("http://api.github.com/");
client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");
@shubhamnikam
shubhamnikam / GithubController.cs
Last active February 14, 2021 18:26
GithubController - wrong http call without HttpClientFactory
[HttpGet("TestGithub/{userName}")]
public async Task<IActionResult> TestGithub(string userName)
{
var httpClient = new HttpClient
{
BaseAddress = new Uri("http://api.github.com/"),
DefaultRequestHeaders =
{
{ "Accept", "application/vnd.github.v3+json" },
@shubhamnikam
shubhamnikam / data_user.json
Last active August 14, 2020 14:31
Simple implementation of JS callback/promise/fetch
[
{
"empId": 1,
"name": "John",
"city": "Satara",
"salary" : 1000.0
},
{
"empId": 2,
"name": "Jane",
@shubhamnikam
shubhamnikam / MainActivity.java
Created June 4, 2020 17:58
Medium Article - zoomview- MainActivity.java
import android.os.Bundle;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@shubhamnikam
shubhamnikam / ZoomView.java
Last active June 4, 2020 18:26
Medium Article - zoomview- ZoomView.java
package com.theappnerds.zoomview;
import android.graphics.PointF;
import android.view.MotionEvent;
import android.view.View;
public class ZoomView {
float[] lastEvent = null;
float d = 0f;
@shubhamnikam
shubhamnikam / activity_main.xml
Created June 4, 2020 17:16
Medium Article - zoom layout - activity_main
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView"