Skip to content

Instantly share code, notes, and snippets.

View ajinkyapuar's full-sized avatar

Ajinkya Puar ajinkyapuar

View GitHub Profile
@ajinkyapuar
ajinkyapuar / pypi-tuna.sh
Created April 10, 2025 11:05 — forked from DuckSoft/pypi-tuna.sh
Python 清华源配置(Python Package Index (PyPI) TUNA Source Configuration)
#!/bin/bash
sudo pip install pip -U
sudo pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# Example:
```
$ sudo echo "DOCKER_OPTS=\"--registry-mirror=http://hub-mirror.c.163.com\"" >> /etc/default/docker
$ service docker restart
```
Or another way with updating /usr/lib/systemd/system/docker.service with:
```
@ajinkyapuar
ajinkyapuar / server.py
Created February 14, 2025 14:13 — forked from dranger003/server.py
Phi-3-Vision-128K-Instruct Quick Local API
# server.py
# uvicorn server:app --reload
import base64
import queue
import threading
import torch
from PIL import Image
from io import BytesIO
@ajinkyapuar
ajinkyapuar / videocam.py
Created September 25, 2024 08:24 — forked from fballares/videocam.py
Python RTSP stream using OpenCV
#!/usr/bin/env python -c
# Import OpenCV and threading packages
import cv2
import threading
# Define class for the camera thread.
class CamThread(threading.Thread):
def __init__(self, previewname, camid):
@ajinkyapuar
ajinkyapuar / !Java Python JS AES CBC Encryption and Decryption Examples.md Java, Python, and Javascript Encryption/Decryption with AES/CBC/PKCS5PADDING

Had some trouble in the past with equivalent encryption/decryption across these three languages so figured I'd share my findings.

Note: I'm aware the IV you choose shouldn't be static, but for this example it saved some string manipulation code. What I've seen people do is attach the IV to the front of the encrypted string (first 16 characters), then substring when you are decryption.

Would love to hear your thoughts / comments!

@ajinkyapuar
ajinkyapuar / FullscreenOverlayService.java
Created June 25, 2024 03:15 — forked from kakajika/FullscreenOverlayService.java
Android Service implementation with fullscreen overlay window (over status bar & navigation bar)
class FullscreenOverlayService extends Service {
private View overlay;
private WindowManager windowManager;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@ajinkyapuar
ajinkyapuar / nvidia.md
Created October 25, 2023 13:17 — forked from bitsurgeon/nvidia.md
install Nvidia driver on Ubuntu with Secure Boot

Install Nvidia Driver on Ubuntu 18.04.3

Secure Boot

This section applies to machines with Secure Boot, such as ThinkPad.

  1. Before installation, switch to "Discrete Graphics" in BIOS, if both Intel and Nvidia graphics are present.
  2. During installation, make sure to select the "Install third-party software for graphics and Wi-Fi hardware and addition media formats" in "Updates and other software" screen.
  3. Select "Configure Secure Boot", and set password.
  4. Continue Ubuntu installation as normal.
@ajinkyapuar
ajinkyapuar / anydesk-enable-remote-access.md
Created October 9, 2023 11:31 — forked from imami/anydesk-enable-remote-access.md
AnyDesk - How Enable Remote Access from ubuntu/debian terminal

###AnyDesk - How Enable Remote Access from ubuntu/debian terminal.

Note:

Here are the commands might be usefull in this purpose:

  • anydesk --get-status : To get current status of anydesk, which might be offlien,online or nothing.
  • anydesk --get-id : To get the ID that your system can be accessed by.
  • anydesk --service : To start anydesk service if not already running (for Linux).
  • anydesk --restart-service : To restart anydesk service
  • anydesk --stop-service : To stop anydesk service
# Must have conda installed
# It costs approximately $0.2 (in GPT-4 API fees) to generate one example with analysis and design, and around $2.0 for a full project.
conda create -n metagpt python=3.11.4
conda activate metagpt
npm --version # to check you have npm installed
# optional: install node if you don't have it
npm install -g @mermaid-js/mermaid-cli
git clone https://github.com/geekan/metagpt
cd metagpt
@ajinkyapuar
ajinkyapuar / app.py
Created May 16, 2023 08:49
Python Script for Gaze Data Collection
import os
import cv2
import tkinter as tk
points = [(0.2, 0.2), (0.5, 0.2), (0.8, 0.2),
(0.2, 0.5), (0.5, 0.5), (0.8, 0.5),
(0.2, 0.8), (0.5, 0.8), (0.8, 0.8)]
class CalibrationApp:
def __init__(self, master):