Skip to content

Instantly share code, notes, and snippets.

View narenaryan's full-sized avatar
🏠
Dreaming Big

N3N narenaryan

🏠
Dreaming Big
View GitHub Profile
package main
import (
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://httpbin.org/get")
@narenaryan
narenaryan / convert_mkv_to_mp4.sh
Created January 20, 2024 20:50
Convert all .mkv files to .mp4 with best quality, less size using FFMpeg
#!/bin/bash
# Loop through each .mkv file in the current directory
for file in *.mkv; do
# Extract the filename without extension
filename=$(basename "$file" .mkv)
# Convert the .mkv file to .mp4 using FFMpeg
ffmpeg -i "$file" -vcodec libx264 -crf 27 -preset veryfast -c:a copy -s 960x540 "${filename}.mp4" &
done
def find_max(arr):
max = arr[0]
for num in arr:
if num > max:
max = num
return max
arr = [5, 10, 3, 8, 15]
max_num = find_max(arr)
print("Maximum element in the list:", max_num)
#include <stdio.h>
int find_max(int arr[], int size) {
int max = arr[0];
for (int i = 1; i < size; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
return max;
@narenaryan
narenaryan / requirements.txt
Last active September 22, 2023 21:34
Python requirements for running transformer pipelines
torch
torchvision
starlette
uvicorn
transformers
pytesseract
ipython
accelerate
@narenaryan
narenaryan / function_call_openai.py
Last active November 24, 2023 20:14
This gist shows an example to use OpenAI function calling with Python. See full article here: https://medium.com/dev-bits/a-clear-guide-to-openai-function-calling-with-python-dcbc200c5d70
import openai
import os
import json
from typing import List
from pydantic import BaseModel
# set Open AI API Key
api_key = os.getenv("OPENAI_API_KEY")
assert api_key is not None, "API Key not set in environment"
import json
class Color:
name = None
found_in = None
def __init__(self, name) -> None:
self.name = name
@narenaryan
narenaryan / dump.py
Last active September 17, 2022 11:09
import json
colors = [
{
"name": "RED",
"foundIn": "soil"
},
{
"name": "GREEN",
"foundIn": "forest"
import json
colors = [
{
"name": "RED",
"foundIn": "soil"
},
{
"name": "GREEN",
"foundIn": "forest"
{
"languages": {
"python": {
"name": "Python",
"author": "Guido Van Rossum",
"usedFor": ["Scripting", "Web Development", "Text processing", "Data Science"]
},
"go": {
"name": "Go",
"author": "Google",