Skip to content

Instantly share code, notes, and snippets.

@galek
galek / pbr.glsl
Created November 4, 2015 11:10
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@AndrewFromMelbourne
AndrewFromMelbourne / wifiscan.cxx
Last active December 20, 2022 02:41
wifi scanning code
// sudo apt-get install libiw-dev
//
// g++ -O3 -Wall wifiscan.cxx -o wifiscan -liw
#include <iwlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
@kylemcdonald
kylemcdonald / convert.py
Last active February 9, 2025 09:47
Scrape ShaderToy. Instead of running this, consider downloading the files from here: https://goo.gl/MWGvkL Or if you want to do more work with ShaderToy data, consider using their API https://www.shadertoy.com/api
# !/usr/bin/env python
import os, re, argparse, json
parser = argparse.ArgumentParser(
description='Extract code from ShaderToy json.')
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args()
#include <stdio.h>
#include <bcm_host.h>
#define SRC_WIDTH 640
#define SRC_HEIGHT 480
#define DST_WIDTH 1920
#define DST_HEIGHT 1080
int main()
{
bcm_host_init();
@floehopper
floehopper / install.md
Last active May 2, 2025 12:52
Install rtl-sdr on Raspian on Raspberry Pi
[email protected]:~$ sudo dd bs=1m if=/Users/jamesmead/Downloads/2015-02-16-raspbian-wheezy.img of=/dev/disk2
pi@raspberrypi ~ $ sudo raspi-config
# Choose option 1 to "Expand Filesystem" - Ensures that all of the SD card storage is available to the OS
# Choose Finish & reboot

pi@raspberrypi ~ $ sudo apt-get update
@dbeckham
dbeckham / .tmux.conf
Last active October 30, 2022 08:23
A simple tmux configuration file for remote servers.
#
# Custom tmux commands for remote servers
#
# Copy this to ~/.tmux.conf to enable
#
# Make splitting and resizing panes, and moving around emulate the vim
# directional keys
bind | split-window -h
bind _ split-window -v
@companje
companje / globe.cpp
Created September 24, 2014 13:31
getting Longitude/Latitude when clicking on a rotated sphere
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofImage earth;
ofQuaternion qTo;
float angle;
ofVec3f axis;
ofPoint green;
@larsberg
larsberg / Mesh2Points.h
Created August 4, 2014 20:49
evenly distributed random points on a mesh
//
// Mesh2Points.h
//
// Created by lars berg on 8/1/14.
//
#pragma once
#include "ofMain.h"
@larsberg
larsberg / Svg2Mesh
Created August 1, 2014 21:53
OF svg to ofMesh
static void addSvgToMesh(string dir, ofMesh& m)
{
ofxSVG svg;
svg.load(dir);
for ( auto i=0; i<svg.getNumPath(); i++ )
{
auto& path = svg.getPathAt(i);
path.simplify();
@larsberg
larsberg / ClosestPointOnLine for openframeworks
Last active May 19, 2021 00:28
closest point on line in OF.
//closest point on line
//http://paulbourke.net/geometry/pointlineplane/
ofVec3f closestPointOnLine(ofVec3f p, ofVec3f l0, ofVec3f l1 )
{
if(l0 == l1) return ofVec3f();
float u = (((p.x-l0.x) * (l1.x-l0.x)) + ((p.y-l0.y) * (l1.y-l0.y)) + ((p.z-l0.z) * (l1.z-l0.z))) / l1.distanceSquared( l0 );
if( u < 0.0f )
return l0;