Skip to content

Instantly share code, notes, and snippets.

@sonygod
sonygod / arrayFunction.cpp
Created November 22, 2022 08:21 — forked from jonathanlurie/arrayFunction.cpp
Emscripten and float arrays v2
#include <math.h>
// otherwise C++ function names are mangled
extern "C" {
void float_multiply_array(float *data, int w, int h, int ncpp) {
int length = w*h;
int currentPixelIndex = 0;
@sonygod
sonygod / blscript_save_viewport_buffer_as_image.py
Created December 3, 2021 01:30 — forked from a-nakanosora/blscript_save_viewport_buffer_as_image.py
Blender Script - Save viewport buffer as an image
''' blscript_save_viewport_buffer_as_image.py
'''
import bpy
import bgl
def main():
def get_region_view3d():
'''
context = bpy.context
@sonygod
sonygod / CMakeLists.txt
Created October 17, 2021 05:02 — forked from UnaNancyOwen/CMakeLists.txt
CMakeLists for OpenCV that installed using Vcpkg
cmake_minimum_required( VERSION 3.0 )
set( CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake" )
# Create Project
project( solution )
add_executable( project main.cpp )
# Set OpenCVConfig.cmake Search Directory
set( OpenCV_DIR )
if( NOT CMAKE_CL_64 )
@sonygod
sonygod / cid.d.ts
Created August 17, 2021 09:15 — forked from joeltg/cid.d.ts
TypeScript definition files for miscellaneous Protocol Labs projects
export as namespace CID
export = CID
type Buffer = any
interface SerializedCID {
codec: string
version: number
multihash: Buffer
}
@sonygod
sonygod / docker-compose-backup.sh
Created June 20, 2021 14:43 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Video Element</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="main.css"/>
<style>
.control{
font-size: 1.5rem;
@sonygod
sonygod / SchemaTypeBuilder.hx
Created October 31, 2020 03:34 — forked from nadako/SchemaTypeBuilder.hx
JSON-schema type builder prototype.
#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
class SchemaTypeBuilder
{
public static function build(ref:String):haxe.macro.Type
{
var schema = haxe.Json.parse(sys.io.File.getContent(ref));
var type:ComplexType = parseType(schema);
@sonygod
sonygod / background.js
Created September 29, 2020 03:21 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
var VSHADER_SOURCE =
"attribute vec4 a_position; \n" +
"attribute vec2 a_texCoord; \n" +
"varying mediump vec2 v_texCoord; \n" +
"uniform mat4 u_ModelMatrix; \n" + // 变换矩阵
"uniform float u_Radius; \n" + // 半径
"uniform float u_ArcLength; \n" + // 弯曲弧长
"uniform int u_Direction; \n" + // 卷曲方向
@sonygod
sonygod / ffmpeg-watermark.md
Created June 26, 2019 11:59 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.