Skip to content

Instantly share code, notes, and snippets.

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

408881465

🏠
Working from home
View GitHub Profile
@thearn
thearn / opencv-python-ipcam.py
Last active January 12, 2023 17:01
python-opencv ip camera example
import base64
import time
import urllib2
import cv2
import numpy as np
"""
Examples of objects for image frame aquisition from both IP and
@chethann
chethann / WebResourceResponse.java
Last active September 29, 2020 18:49
Sample code of WebResourceResponse to load WebView resources from local assets!
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String resourceUrl = request.getUrl().toString();
String fileExtension = WebviewResourceMappingHelper.getInstance().getFileExt(resourceUrl);
if(WebviewResourceMappingHelper.getInstance().getOverridableExtensions().contains(fileExtension)){
String encoding = "UTF-8";
String assetName = WebviewResourceMappingHelper.getInstance().getLocalAssetPath(resourceUrl);
if (StringUtils.isNotEmpty(assetName)) {
String mimeType = WebviewResourceMappingHelper.getInstance().getMimeType(fileExtension);
if (StringUtils.isNotEmpty(mimeType)) {
@408881465
408881465 / xbee.ino
Created April 2, 2019 23:27 — forked from bgentry/xbee.ino
XBee ZigBee HA interaction, Arduino example
/**
This is an implementation of Zigbee device communication using an XBee
and a Centralite Smart Switch 4256050-ZHAC
dave (www.desert-home.com)
source: http://www.desert-home.com/2014/10/zigbee-protocol-xbee-but-this-time.html
*/
// This code will handle both a Uno and a Mega2560 by careful use of
// the defines. I tried it on both of them, and the only problem is that
@408881465
408881465 / draw.js
Created February 23, 2020 12:33 — forked from mohdsanadzakirizvi/draw.js
PoseNet demo with Ml5.js
function draw() {
image(video, 0, 0, width, height);
// We can call both functions to draw all keypoints and the skeletons
drawKeypoints();
drawSkeleton();
}
@408881465
408881465 / WebResourceResponse.java
Created February 26, 2020 08:18 — forked from chethann/WebResourceResponse.java
Sample code of WebResourceResponse to load WebView resources from local assets!
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String resourceUrl = request.getUrl().toString();
String fileExtension = WebviewResourceMappingHelper.getInstance().getFileExt(resourceUrl);
if(WebviewResourceMappingHelper.getInstance().getOverridableExtensions().contains(fileExtension)){
String encoding = "UTF-8";
String assetName = WebviewResourceMappingHelper.getInstance().getLocalAssetPath(resourceUrl);
if (StringUtils.isNotEmpty(assetName)) {
String mimeType = WebviewResourceMappingHelper.getInstance().getMimeType(fileExtension);
if (StringUtils.isNotEmpty(mimeType)) {
dataset = '''
// 1
-10.00,-11.00,-14.31,-8.93,-15.84,-34.12,-45.63,-46.56,-66.47,-77.33,-89.85,-98.59,-107.57,-115.89,-120.41,-123.71,-123.71,-121.38,-115.89,-110.24,-100.23,-90.59,-79.95,-68.72,-57.38,-46.01,-36.19,-27.44,-19.98,-14.31,-10.91,-9.76
-10.00,-10.91,-14.19,-19.82,-27.22,-35.01,-44.49,-55.50,13.52,-79.29,-92.08,-101.87,-110.24,-2.83,-121.38,-29.93,-119.72,-123.34,21.67,-106.68,-102.70,-92.08,-81.26,-69.85,-58.79,-47.15,-36.49,-27.44,-20.14,-14.31,-6.35,-6.32
-9.44,-11.09,-14.54,-16.89,-26.99,-30.85,-30.04,-56.91,-22.53,-79.95,-18.56,-101.87,-90.68,-87.62,-115.51,-124.70,-122.71,30.35,-0.94,-110.24,-102.70,-92.82,-81.91,-69.85,-58.32,-47.15,-36.79,-27.66,-20.14,-14.43,-11.00,-9.84
-9.52,-11.18,-14.07,-19.82,-26.77,-34.41,-23.96,-30.57,-68.72,-82.57,-69.80,-98.59,-100.46,-8.48,-119.43,-119.72,-116.72,22.51,37.69,38.23,-8.22,-72.77,-78.64,-68.16,-54.56,-29.66,0.89,1.12,-12.02,-14.19,-10.91,-9.76
-10.00,-11.27,5.51,-20.31,-27.88,-37.08,-46.01,-59.26,-70.98,7.21,-92.08,-101.05,-112.02,32.98,-122.36,-
#include <M5StickC.h>
#include "arduinoFFT.h"
#define SAMPLE_PERIOD 5 // ァンプγƒͺγƒ³γ‚°ι–“ιš”(γƒŸγƒͺη§’)
const uint16_t FFTsamples = 64; //This value MUST ALWAYS be a power of 2
double vReal[FFTsamples];
double vImag[FFTsamples];
const double samplingFrequency = 1000.0 / (double)SAMPLE_PERIOD; // 200Hz
arduinoFFT FFT = arduinoFFT(vReal, vImag, FFTsamples, samplingFrequency); // FFTγ‚ͺγƒ–γ‚Έγ‚§γ‚―γƒˆγ‚’δ½œγ‚‹
@litamin
litamin / ESP32-Cam Pixel Downsampling
Last active May 21, 2020 23:05
ESP32-Cam Pixel Downsampling - read out downsampled RGB pixels pretty pretty fast!
// Code based on BITLUNI's ESP32-cam work
// the size you want to downsample to
int newWidth = 40;
int newHeight = 30;
int DSF = 160 / newWidth; // Down Sampling Factor - ideally DSF should be 4, 8 or 16.. so that the bitshifting happening below is accurate
void downSample(unsigned char *frame)
{