Skip to content

Instantly share code, notes, and snippets.

View anujonthemove's full-sized avatar
Working

Anuj Khandelwal anujonthemove

Working
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / ds-util-exporting-pandas-df-to-pdf.ipynb
Created May 9, 2021 10:53
Exporting stylized pandas dataframe to a pdf
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / cv-util-ffmpeg-convert-to-mp4-from-mkv-avi-asv-dav-mov.ipynb
Created May 9, 2021 10:47
Convert to .mp4 from '.mkv', '.avi', '.asf', '.dav', '.mov' using ffmpeg, python subprocess
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / cv-util-cut-and-concatenate-videos.ipynb
Created May 9, 2021 10:33
Cut and concatenate videos together using ffmpeg, python subprocess
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def text_over_rectangle(coords, text, image, color):
x, y = coords
# font
fontFace = cv2.FONT_HERSHEY_SIMPLEX
# org
org = (20, 50)
# fontScale
fontScale = 2
@anujonthemove
anujonthemove / backgroundAveraging.py
Created May 24, 2020 13:03 — forked from TheSalarKhan/backgroundAveraging.py
Background Averaging (Background Subtraction) in Python+OpenCV
import numpy as np
import cv2
class BackGroundSubtractor:
# When constructing background subtractor, we
# take in two arguments:
# 1) alpha: The background learning factor, its value should
# be between 0 and 1. The higher the value, the more quickly
# your program learns the changes in the background. Therefore,
@anujonthemove
anujonthemove / useful ffmpeg commands
Created May 15, 2020 16:20
useful ffmpeg commands
# convert-mp4-to-webm-for-rtsp
ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
@anujonthemove
anujonthemove / sample_data_push_using_http_endpoints.py
Created July 26, 2019 10:27
Sample data push to HTTP endpoints
import json
import subprocess
new_cdata='{"input": {"data": {"SensorMetaInfo": {"CameraDescription": "cisco_cam_type_1", "Ly": "20.98S", "Lx": "10.233N", "FeatureId": "9", "ServerId": "vijaywada_PC_01", "ProductCategoryId": "2", "CameraID": "akashwani_east", "LongDescription": "high range camera"}, "Data": {"CongressionThreshold": "20.0%", "ImageURL": "/home/anuj/git/work/end-to-end-api/hyderabad/deputy-01/vehicle-counter/output/2018-10-17/images/vehicle_counter_08:36:58.jpg", "Vehicles": {"AreaOccupied": "34.0%", "BikeCount": 2, "MiniBusCount": 0, "CarCount": 1, "ReportedTime": "2018-02-26t10:23:51", "HeavyVehicleCount": 0}, "VideoURL": "http://<ip-address>/video-analytics/hyderabad/akashwani_east/vehicle_counter/output/videos/2018_02_26_10_23_11_video.mp4", "CapturedTime": "2018-10-17 08:36:58.041400"}, "Event": {"EventID": 11, "EventDescription": "Threshold Congestion Exceeded"}}}, "configName": "Congestion", "groupName": "TrafficAnalytics", "tenantId": "vijayawada.com"}'
subprocess.call(["curl", "-X", "
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anujonthemove
anujonthemove / config
Last active January 2, 2020 12:56
SSH User Configuration File
# taken entirely from: https://dzone.com/articles/password-less-ssh-access-for-automation
## Proxy ##
## Forward all local port 8888 traffic to port 8888 on the remote server ##
Host <your host name>
HostName <your IP>
ForwardX11 yes
User <your username>
IdentityFile /path/to/<your pem file>.pem
LocalForward localhost <or some of your IP>:8888 <server IP address>:8888