Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
#
# Recreate Lightroom catalog by replacing corrupt files with recovered copies
#
# Keeps the directory structure and creates the new catalog in a new path,
# which means you'll need at least 3x the size of your photos of free space.
#
# Dependencies:
# - ruby
# - exiftool
@johans2
johans2 / SSS.hlsl
Created August 17, 2018 11:42
Subsurface scattering shader
Shader "Custom/SSS" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_NormalMap ("MormalMap", 2D) = "white" {}
_Thickness ("Thickness", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Distortion("Distortion", Range(0,1)) = 0.0
_Power("Power", Range(0,10)) = 0.0
@keijiro
keijiro / AngleAxis3x3.hlsl
Last active March 16, 2024 04:16
3x3 Rotation matrix with an angle and an arbitrary vector
// Rotation with angle (in radians) and axis
float3x3 AngleAxis3x3(float angle, float3 axis)
{
float c, s;
sincos(angle, s, c);
float t = 1 - c;
float x = axis.x;
float y = axis.y;
float z = axis.z;
@omarojo
omarojo / gist:934863e6f4ddf4bb3f0de7445da573cd
Last active January 19, 2017 20:58
GPUImage newFrameAvailable
self.rawG8OutputTarget = [[GPUImageRawDataOutput alloc] initWithImageSize: aspectSize resultsInBGRAFormat:YES];
[filterChain.output addTarget:self.rawG8OutputTarget];
__weak GPUImageRawDataOutput *weakRawOutput = self.rawG8OutputTarget;
[self.rawG8OutputTarget setNewFrameAvailableBlock:^{
GLubyte *outputBytes = [weakRawOutput rawBytesForImage];
NSInteger bytesPerRow = [weakRawOutput bytesPerRowInOutput];
//I use this variables to create the image to be streamed.
}];
@xoppa
xoppa / outline.fragment.glsl
Created October 12, 2015 20:42
very basic outline shader
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
const float offset = 1.0 / 128.0;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
@johnpaulmanoza
johnpaulmanoza / GPUImageFourInputFilter.h
Created April 13, 2015 06:06
GPUImage Add Four Input Filter
#import <GPUImageThreeInputFilter.h>
extern NSString *const kGPUImageFourInputTextureVertexShaderString;
@interface GPUImageFourInputFilter : GPUImageThreeInputFilter
{
GPUImageFramebuffer *fourthInputFramebuffer;
GLint filterFourthTextureCoordinateAttribute;
GLint filterInputTextureUniform4;
@bitchwhocodes
bitchwhocodes / gist:1b3297bd3dbf7be93f72
Created December 22, 2014 02:31
Arduino NeoPixels Animation without using Delay
#include <Adafruit_NeoPixel.h>
#define NUM_PIXELS 60
unsigned long interval=50; // the time we need to wait
unsigned long previousMillis=0;
uint32_t currentColor;// current Color in case we need it
uint16_t currentPixel = 0;// what pixel are we operating on
@prophetgoddess
prophetgoddess / pixelsort.py
Last active June 13, 2024 01:40
Python pixel sorting.
# The MIT License (MIT)
# Copyright (c) 2014 Lycaon (lycaon.me)
# 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
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@JesseScott
JesseScott / Leo !!!
Last active December 3, 2019 19:39
LEO !!!!
Leó Stefánsson
@ctokheim
ctokheim / cython_tricks.md
Last active March 4, 2024 23:27
cython tricks

Cython

Cython has two major benefits:

  1. Making python code faster, particularly things that can't be done in scipy/numpy
  2. Wrapping/interfacing with C/C++ code

Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.