Skip to content

Instantly share code, notes, and snippets.

View aayushsahu's full-sized avatar
🏠
Working from home

Aayush Kumar Sahu aayushsahu

🏠
Working from home
View GitHub Profile
@aayushsahu
aayushsahu / husky_setup.md
Created November 10, 2024 19:03
How to setup husky in your existing node project?

How to setup husky in your existing node project?

  1. git version should be above 2.9
$ git --version
git version 2.9.0.windows.1
  1. Install husky into package.json as a dev dependency $ npm install --save-dev husky
@aayushsahu
aayushsahu / .babelrc
Last active October 3, 2024 14:41
Adding webpack for backend node application
{
"presets": ["@babel/preset-env"]
}
@aayushsahu
aayushsahu / EurekaNamingServerApplication.java
Created October 16, 2021 13:03
How to Setup Eureka naming Server?
package com.solinvictus.EurekaNamingServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaNamingServerApplication {
#running the file
#python rtspcamera.py --rtsp --uri rtsp://192.168.1.8:8080/h264_pcm.sdp --width 1280 --height 720
def open_cam_rtsp(url, uri, width=1000, height=786, latency=0):
gst_str = ('rtspsrc location={} latency={} ! '
'rtph264depay ! h264parse ! omxh264dec ! '
'nvvidconv ! '
'video/x-raw, width=(int){}, height=(int){}, '
'format=(string)BGRx ! '
'videoconvert ! appsink').format(uri, latency, width, height)
@aayushsahu
aayushsahu / rtsp-rtp-sample.py
Created March 4, 2019 12:19 — forked from jn0/rtsp-rtp-sample.py
Sample Python script to employ RTSP/RTP to play a stream from an IP-cam (from stackoverflow)
"""
http://stackoverflow.com/questions/28022432/receiving-rtp-packets-after-rtsp-setup
A demo python code that ..
1) Connects to an IP cam with RTSP
2) Draws RTP/NAL/H264 packets from the camera
3) Writes them to a file that can be read with any stock video player (say, mplayer, vlc & other ffmpeg based video-players)
Done for educative/demonstrative purposes, not for efficiency..!
'''
Below code helps you import datasets from google drive.
It will label the images by folder name they are stored
in so the dataset must be in different folders all inside
the dataset folder.
'''
from google.colab import drive
drive.mount('/content/gdrive')
imagePaths=sorted(list(paths.list_images('/content/gdrive/My Drive/dataset/')))
import numpy as np
import cv2
import urllib.request
url = "http://192.168.1.8:8080/shot.jpg" #always use http://<ipcam ipaddress>:<portno>/shot.jpg as url
while True:
with urllib.request.urlopen(url) as resp:
imgNp=np.array(bytearray(resp.read()), dtype=np.uint8)
img=cv2.imdecode(imgNp, -1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow("response", gray)
@aayushsahu
aayushsahu / tegra-cam.py
Created March 3, 2019 11:45 — forked from jkjung-avt/tegra-cam.py
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <jkjung13@gmail.com>