Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
this is weird

Greg Kepler gregkepler

💭
this is weird
View GitHub Profile
@gregkepler
gregkepler / ffmpeg-background-color.bat
Created Mar 19, 2019
ffmpeg transparent png background color
View ffmpeg-background-color.bat
ffmpeg -f lavfi -i color=c=black:s=1280x720 -i "C:\path\to\image.png" -shortest -filter_complex "[0:v][1:v]overlay=shortest=1,format=yuv420p[out]" -map "[out]" "C:path\to\output\out.mp4"
@gregkepler
gregkepler / EXR2PNG.bat
Created Mar 2, 2019
ImageMagick convert folder EXRs to PNGs in linear colorspace
View EXR2PNG.bat
::Turn of displaying the code on the screen
@echo off
echo Converting...
for %%f in (%1/*.exr) do (
rem echo %%~nf
rem echo %%f
magick convert "%1/%%f" -verbose -format png -depth 16 -channel RGBA -type truecolormatte -colorspace RGB -define png:bit-depth=16 "%2/%%~nf.png"
)
View ffmpeg-trim.bat
// -ss: start time
// -t: duration
ffmpeg -i in.mp4 -ss 00:00:50 -t 00:00:20 -async 1 out.mp4
// cropping https://www.bogotobogo.com/FFMpeg/ffmpeg_cropdetect_ffplay.php
ffmpeg -i in.mp4 -vf crop=1920:800:0:140 -ss 00:00:50 -t 00:00:30 -async 1 -crf out.mp4
View meld difftool
[diff]
tool = meld
[difftool]
prompt = false
[difftool "meld"]
cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" "$LOCAL" "$REMOTE"
[merge]
tool = meld
[mergetool "meld"]
@gregkepler
gregkepler / SurfaceChannelRotate.cpp
Created Mar 12, 2018
Rotate Channels or Surfaces in Cinder
View SurfaceChannelRotate.cpp
void SurfaceChannelRotateApp::rotateChannel( const ci::Channel &channel, ci::Channel &destChannel )
{
const int32_t height = channel.getHeight();
const int32_t width = channel.getWidth();
// 90 deg
/*
for( int32_t y = 0; y < height; ++y ) {
auto ogPtr = channel.getData( ivec2( 0, y ) );
auto newPtr = destChannel.getData( ivec2( height - y - 1, 0 ) );
@gregkepler
gregkepler / .gitconfig
Created Nov 1, 2017
Meld diff and merge tool for git on Windows
View .gitconfig
# ------------------ M E R G E -------------------------
[merge]
tool = meld
[mergetool "meld"]
cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\"
trustExitCode = false
[mergetool]
# don't ask if we want to skip merge
@gregkepler
gregkepler / VectorIteration.cpp
Last active Dec 2, 2016
Iterate through C++ vector updating active objects and erasing ones marked for removal.
View VectorIteration.cpp
void update()
{
// iterate through all objects in the vector
for( auto iter = mObjectVector.begin() ; iter != mObjectVector.end(); /*DO NOT INCREMENT HERE*/ )
{
if( (*iter)->isMarkedForRemoval() ){
// Remove if obsolete and iter will be the following object in vector
iter = mObjectVector.erase( iter );
} else {
// Update if still active
@gregkepler
gregkepler / LuminanceMapping-frag.glsl
Created Jan 8, 2016
Map image luminance value between 2 colors
View LuminanceMapping-frag.glsl
// glsl fragment shader sample
// can be seen at https://www.shadertoy.com/view/MscGD2
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord.xy / iResolution.xy;
vec3 color1 = vec3(90.0/255.0, 170.0/255.0, 251.0/255.0); // light color blue
vec3 color2 = vec3(5.0/255.0, 57.0/255.0, 109.0/255.0); // dark color blue
//vec3 color1 = vec3(247.0/255.0, 238.0/255.0, 87.0/255.0); // light color yellow
@gregkepler
gregkepler / AnimatedGif.cpp
Last active Dec 7, 2015
Cinder Simple Animated Gif Player class
View AnimatedGif.cpp
#include "AnimatedGif.h"
using namespace ci;
using namespace ci::app;
using namespace std;
void AnimatedGif::init( ci::DataSourceRef filePath, int frameRate ){
if( filePath ){
load( filePath );
}
@gregkepler
gregkepler / offset
Created Oct 22, 2014
returns the bounds of a dom element wrapped in an angular element
View offset
// originall from from http://cvmlrobotics.blogspot.com/2013/03/angularjs-get-element-offset-position.html
function bounds( elm ) {
try {return elm.offset();} catch(e) {}
var rawDom = elm[0];
var _x = 0;
var _y = 0;
var body = document.documentElement || document.body;
var scrollX = window.pageXOffset || body.scrollLeft;
You can’t perform that action at this time.