Skip to content

Instantly share code, notes, and snippets.

View rahul-yr's full-sized avatar

Rahul Reddy rahul-yr

View GitHub Profile
@rahul-yr
rahul-yr / raspberry-pi-debian-setup.sh
Created October 1, 2022 15:11
Raspberrry pi 4 debian setup
#! /bin/sh
# Update the system
sudo apt update
sudo apt upgrade -y
# Install snapd
sudo apt install snapd -y
sudo snap install core
@rahul-yr
rahul-yr / golang-docker-alpine-Dockerfile
Created September 18, 2022 13:13
Docker Golang light weight image Dockerfile
FROM golang:1.19.1-alpine3.16 as builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . ./
RUN go build -v -o server
FROM alpine:3.16
COPY --from=builder /app/server /app/server
EXPOSE 8080
CMD ["/app/server"]
@rahul-yr
rahul-yr / index.js
Created September 9, 2022 05:04
Stream HLS Videos using plain HTML - Along with custom request headers to Video.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<title>Document</title>
@rahul-yr
rahul-yr / telegram-python-bot.py
Created September 6, 2022 07:14
Telegram Python bot snippets for getUpdates and InlineKeyboard
import requests
import json
def getUpdates():
api = "https://api.telegram.org/bot<token>/getUpdates"
# add headers
headers = {'Content-Type': 'application/json'}
# add body params
data = {'allowed_updates': ['update_id']}
# stringify body params
@rahul-yr
rahul-yr / main.go
Last active July 29, 2022 07:50
Firebase JWT authentication : Sample functions for token verification
package main
import (
"context"
"fmt"
"log"
"os"
"strings"
"time"
@rahul-yr
rahul-yr / README.md
Last active July 26, 2022 15:19
This is a code-server installation script on GCP VM. It has already configured with Ngnix, Cert Bot and Google Domains. You just need to update the input variables on the top section

This is a script to install and deploy code-server to your domain.

  • This enables you to access the vscode over the internet in a single click

Prerequisites

  • Domain Name (Suggested Google Domains)
  • GCP or Azure or AWS Account

Tech

  • Web server : Nginx
  • SSL : Let's encrypt
@rahul-yr
rahul-yr / code-server-installations.md
Last active July 26, 2022 05:33
code-server ip address updation
@rahul-yr
rahul-yr / main.go
Created July 5, 2022 04:25
This is the entry point for Todo GraphQL server
package main
import (
"os"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/rahul-yr/learn-go-grapql/graph"
)
@rahul-yr
rahul-yr / router.go
Created July 5, 2022 04:12
This is the todo router for Go GraphQL
package graph
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/graphql-go/graphql"
"github.com/rahul-yr/learn-go-grapql/todo"
)
@rahul-yr
rahul-yr / install.go
Created July 4, 2022 15:26
Go TODO graphQL packages
// used as web server
// you could use any web server of your choice such as mux, http, go fiber etc
go get github.com/gin-gonic/gin
// used for handling cors
go get github.com/gin-contrib/cors
// is the actual module for implementing GraphQL Server
go get github.com/graphql-go/graphql