Skip to content

Instantly share code, notes, and snippets.

@sonygod
sonygod / example-bake.py
Last active April 19, 2018 08:55 — forked from AndrewRayCode/example-bake.py
Blender Python script to bake in an ambient occlusion map offline
import bpy
ops = bpy.ops
scene = bpy.context.scene
mesh = bpy.ops.mesh
# Delete default scene objects
ops.object.select_all()
ops.object.select_all()
ops.object.delete()
# convert_materials_to_cycles.py
#
# Copyright (C) 5-mar-2012, Silvio Falcinelli. Fixes by others.
#
# special thanks to user blenderartists.org cmomoney
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@sonygod
sonygod / install-haxe.sh
Created June 4, 2018 08:53 — forked from IBwWG/install-haxe.sh
Haxe Linux install script
#!/bin/sh
HAXE_VERSION=3.4.2
NEKO_VERSION=2.1.0
if [ `uname -m` = "armv7l" ]; then
HAXE_VERSION=3.1.3
@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.

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 / 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) {
@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);
<!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 / 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
@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
}