Skip to content

Instantly share code, notes, and snippets.

View AIOSYM's full-sized avatar

David Pich AIOSYM

  • Loglass Inc.
  • Tokyo, Japan
View GitHub Profile
@AIOSYM
AIOSYM / webcam.py
Last active January 28, 2020 05:12
Capture and display frame with OpenCV
import sys
import cv2
import numpy as np
SKIP_FRAMES = 3
RESIZE_HEIGHT = 360
WIN_NAME = 'Webcam Display'
CAP = cv2.VideoCapture(0)
@AIOSYM
AIOSYM / write-mp4.py
Created January 22, 2020 05:06
Write video as MP4 format in OpenCV
cap = cv2.VideoCapture(0)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
out = cv2.VideoWriter('out.mp4', cv2.VideoWriter_fourcc(*'mp4v'), 24, (width, height))
...
out.write(frame)
@AIOSYM
AIOSYM / UIImage+Resize.swift
Created January 12, 2021 14:51 — forked from bgreenlee/UIImage+Resize.swift
Swift port of UIImage+Resize, UIImage+Alpha, and UIImage+RoundedCorner, from http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
//
// UIImage+Resize.swift
// Port of UIImage+Resize.m
// from http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
//
import Foundation
import UIKit
extension UIImage {
disabled_rules:
- trailing_whitespace
opt_in_rules:
- empty_count
- empty_string
excluded:
- Carthage
- Pods
{
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],
"rules": {
"react/prop-types": 0,
@AIOSYM
AIOSYM / option.html
Created January 29, 2023 13:50
Add option to select and localstorage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<select id="options-select"></select>
@AIOSYM
AIOSYM / copyJson.js
Created January 29, 2023 13:58
Copy object with exclude property
const originalObject = {
name: "John Doe",
age: 30,
location: "New York",
places: [
{ name: "A", imageURL: "https://example.com/image.jpg" },
{ name: "B", imageURL: "https://example.com/image2.jpg" }
]
};
@AIOSYM
AIOSYM / screenshot.html
Last active January 29, 2023 14:11
Generate img screenshot from video
<video id="video" src="example.mp4"></video>
<canvas id="canvas"></canvas>
<script>
const video = document.getElementById("video");
const canvas = document.getElementById("canvas");
const context = canvas.getContext("2d");
const timestamps = [2, 5, 8];
timestamps.forEach(timestamp => {
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Search and Replace in JSON</title>
</head>
<body>
<h1>Search and Replace in JSON</h1>
<p>
Enter the value of col1 to search: <input type="text" id="searchValue" />
//https://www.youtube.com/watch?v=UDBrC6pt854&t=324s
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JS Filter</title>
</head>
<style>