Skip to content

Instantly share code, notes, and snippets.

View tgfrerer's full-sized avatar

Tim Gfrerer tgfrerer

View GitHub Profile
@mikoim
mikoim / README.md
Last active April 27, 2024 00:22
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@tgfrerer
tgfrerer / utils.glsl
Last active August 29, 2015 14:24
utility methods for GLSL
// ------------------------------------------------------------
// Math
// ------------------------------------------------------------
float map(in float val_, in float range_min_, in float range_max_, in float min_, in float max_){
return ( min_ + ((max_ - min_)/(range_max_ - range_min_)) * clamp(val_, range_min_, range_max_));
}
vec2 map(in vec2 val_, in vec2 range_min_, in vec2 range_max_, in vec2 min_, in vec2 max_){
return ( min_ + ((max_ - min_)/(range_max_ - range_min_)) * clamp(val_, range_min_, range_max_));
//http://gamedev.stackexchange.com/questions/59797/glsl-shader-change-hue-saturation-brightness
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
@tgfrerer
tgfrerer / gradient.glsl
Last active December 12, 2021 14:24
glsl gradient mapping - achieves similar looks as photoshop's (or other graphics editors') gradients with colour stops.
// _____ ___
// / / / / gradient.glsl
// / __/ * / /__ (c) ponies & light, 2014. All rights reserved.
// /__/ /_____/ poniesandlight.co.uk
//
// Created by tgfrerer on 18/03/2014.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@MartinBspheroid
MartinBspheroid / gist:8902181
Last active November 16, 2022 05:39
openFrameworks hacks (win64)
// TESTED ON nightly-build ver 0.8 (of_v20130813) in Visual Studio 2012 - Win64
// MAKE APP ALWAYS ON TOP
HWND AppWindow = GetActiveWindow();
SetWindowPos(AppWindow, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);
// DISABLE FUNCTION DESCRIBED ABOVE
HWND AppWindow = GetActiveWindow();
@eieio
eieio / hsv2rgb.glsl
Created November 19, 2012 09:22
GLSL HSV to RGB+A
/*
* GLSL HSV to RGB+A conversion. Useful for many effects and shader debugging.
*
* Copyright (c) 2012 Corey Tabaka
*
* Hue is in the range [0.0, 1.0] instead of degrees or radians.
* Alpha is simply passed through for convenience.
*/
vec4 hsv_to_rgb(float h, float s, float v, float a)
@roxlu
roxlu / SSLBuffer.cpp
Created November 2, 2012 11:38
libuv + openssl + SSLBuffer
#include "SSLBuffer.h"
SSLBuffer::SSLBuffer()
:ssl(NULL)
,read_bio(NULL)
,write_bio(NULL)
,write_to_socket_callback(NULL)
,write_to_socket_callback_data(NULL)
,read_decrypted_callback(NULL)
,read_decrypted_callback_data(NULL)