Skip to content

Instantly share code, notes, and snippets.

@cheadrian
cheadrian / camera_demo.py
Created December 28, 2019 17:52
SSD lufficc OpenCV WebCam Demo
import glob
import os
import time
import torch
from PIL import Image
from vizer.draw import draw_boxes
import cv2
@cheadrian
cheadrian / export_inference_graph.py
Last active October 12, 2020 14:32
TypeError: export_inference_graph() got an unexpected keyword argument 'use_side_inputs'
#Note: this solution dosen't guarantee that your network will work as expected after you convert with this,
#because it wasn't tested
#enought
#Environement: tensorflow 1.14.0
# Lint as: python2, python3
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@cheadrian
cheadrian / Youtube_Livestream_Parts_download.py
Last active January 18, 2022 21:08
Download Youtube Live streamed video from the start or selected time
#With the help of this script you can download parts from the Youtube Video that is live streamed, from start of the stream till the end
import urllib.request
import os
#E.G: "https://r4---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603041842& ..... 2.20201016.02.00&sq="
#The sound link should contain: &mime=audio in it.
#Here's an example from NASA LIVE:
#VIDEO: https://r5---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603165657&ei=eQmOX8TeFtS07gO1xLWwDA&ip=79.115.11.159&id=DDU-rZs-Ic4.1&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160&source=yt_live_broadcast&requiressl=yes&mh=PU&mm=44%2C29&mn=sn-gqn-p5ns%2Csn-c0q7lnsl&ms=lva%2Crdu&mv=m&mvi=5&pl=20&initcwndbps=1350000&vprv=1&live=1&hang=1&noclen=1&mime=video%2Fmp4&gir=yes&mt=1603143920&fvip=5&keepalive=yes&fexp=23915654&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Clive%2Chang%2Cnoclen%2Cmime%2Cgir&sig=AOq0QJ8wRQIgQMnxy1Yk3HLTpqbOGmjZYH1CXCTNx6u6PgngAVGi4EQCIQDWyaye-u_KGyVQ0HRUsyKVaAzyXbmzDqOGVGpIyP7VtA%3D%3D&lspa
@cheadrian
cheadrian / webhook_google_ads_form_functions.php
Last active January 18, 2024 10:33
Webhook for Google Ads Lead Form extension using WordPress and WP Webhooks plugin and send data to email
/*
* Forward data received by webhook from Google Ads Form Extension
* to selected email
* Details at:
* https://che-adrian.medium.com/create-a-webhook-for-google-ads-lead-form-extension-using-wordpress-and-wp-webhooks-plugin-and-cd2a3c7fb1c3
*/
add_filter( 'wpwhpro/run/actions/custom_action/return_args', 'wpwh_ads_email', 10, 3 );
function wpwh_ads_email( $return_args, $identifier, $response_body ){
//Email where you receive the data
$to = "example@example.com";
@cheadrian
cheadrian / _utils.py
Last active May 12, 2021 14:38
Patches for TorchVision 0.9.1 to add fcn_resnet18, fcn_resnet34, fcn_mobilenetv2, fcn_mobilenetv3_large, fcn_mobilenetv3_small and compatible ONNX conversion for TensorRT acceleration. Jetson Nano, Jetson Platform. Replace files in segmentation folder of torchvision package, example: "/usr/local/lib/python3.7/dist-packages/torchvision/models/seg…
from collections import OrderedDict
from torch import nn
from torch.nn import functional as F
class _SimpleSegmentationModel(nn.Module):
__constants__ = ['aux_classifier']
def __init__(self, backbone, classifier, aux_classifier=None, export_onnx=False):
@cheadrian
cheadrian / 1. Manifest V3 Firebase Chrome.md
Last active July 15, 2023 21:13
Insert Firebase functions inside website using Chrome Extension. Web Version 9 CDN modular Firebase Firestore.
@cheadrian
cheadrian / Chrome Extension Manifest V3 Firebase Javascript.md
Last active March 19, 2024 07:30
Insert Firebase inside website using Chrome Extension with Manifest V3. Web Version 9 CDN modular Firebase Firestore local JS.
@cheadrian
cheadrian / !Huawei Ads and Tracking Blocking.md
Last active June 22, 2024 21:57
Adaway Huawei Blocklist for Ads, Tracking, Metrics, Gspace
@cheadrian
cheadrian / FillRatioPDF.py
Created February 14, 2023 08:58
PDF page fill ration counter, drag and drop, GUI Tkinter
import fitz
import tkinter as tk
from tkinter import ttk
from tkinter import *
from tkinter import filedialog
from tkinterdnd2 import DND_FILES, TkinterDnD
def on_drop(file_path):
# Split multiple files:
paths = file_path.split(' ')
@cheadrian
cheadrian / #1. README.md
Last active March 27, 2023 18:24
Node-RED chatbots using RedBot, WhatsApp Link, ChatGPT, Dall-e 2, Email

These are the flows witch you can import into your Node-RED.

Contains OpenAI API examples for ChatGPT and Dall-e 2 combined with chat platforms, like Messenger, Whatsapp Business, Whatsapp Personal and Telegram.

There's also an example with email conversation.

You can find the list of articles which you can use with these files on Medium, here.