Skip to content

Instantly share code, notes, and snippets.

View fdb's full-sized avatar

Frederik De Bleser fdb

View GitHub Profile
const int STEPS = 512;
const float EPSILON = 0.001;
const float MAX_DIST = 20.;
vec3 palette( in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d )
{
return a + b*cos( 6.28318*(c*t+d) );
}
float sdOctahedron( vec3 p, float s)
// Simple shader that I created for a shader workshop by Char Stiles
// https://codame.com/events/workshop-shaders
// Copy-paste this code in The Force:
// https://shawnlawson.github.io/The_Force/
// It needs music to shine! Works well with Azuki:
// https://soundcloud.com/azuki/sets/inverness
// (In The Force, click the microphone icon at the bottom, choose SoundCloud, paste the URL and press load.)
float circ(vec2 position){
@fdb
fdb / setup_nvidia_docker.sh
Last active December 3, 2019 22:34
Setup Tensorflow GPU using Docker on Ubuntu 18.04
#!/bin/bash
# This script is used to setup a working Tensorflow GPU installation using Docker.
# It's only tested on Ubuntu 18.04.
# When all is done, run the following command to get a Bash shell with Tensorflow:
# docker run --gpus all -u $(id -u):$(id -g) -v $PWD:/root -it --rm tensorflow/tensorflow:latest-gpu-py3 bash
# Setup Docker
# Instructions from https://docs.docker.com/install/linux/docker-ce/ubuntu/
@fdb
fdb / pushing.js
Created October 11, 2018 21:01
Keep Pushing — Paper.js Sketch
// Use in http://sketch.paperjs.org/
function rand(min, max) {
return min + Math.random() * (max - min);
}
var RADIUS = 400;
var circ = new Path.Circle({
position: view.center,
@fdb
fdb / count_words.py
Created March 7, 2018 20:07
Counting Words with Python 3
import csv
import string
translator = str.maketrans('', '', string.punctuation)
word_count = {}
text = open('declaration.txt').read()
words = text.split()
for word in words:
@fdb
fdb / Cargo.toml
Last active December 5, 2017 19:52
Dynamically loading Windows function with GetProcAddress
[package]
name = "procaddress"
version = "0.1.0"
authors = []
[dependencies]
libc = "0.2.33"
@fdb
fdb / Cargo.toml
Last active March 29, 2018 21:51
[package]
name = "procaddress"
version = "0.1.0"
authors = []
[dependencies]
libc = "0.2.33"
@fdb
fdb / Cargo.toml
Last active May 30, 2021 13:27
Calling Rust from C++
[package]
name = "vec"
version = "0.1.0"
authors = ["Frederik De Bleser <frederik@debleser.be>"]
[lib]
name = "vec"
crate-type = ["dylib"]
[dependencies]
@fdb
fdb / index.html
Last active January 30, 2017 20:26
Uploading to S3 from the browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdn.rawgit.com/Caligatio/jsSHA/v2.2.0/src/sha256.js"></script>
<title>S3 Post Upload Example</title>
<style>
body { font: 14px arial; padding: 20px; margin: 80px auto; width: 40rem; }
input { display: block; font: 16px arial; padding: 5px; margin: 5px; width: 40rem;}
</style>
@fdb
fdb / random-letter.py
Created April 14, 2016 11:55
NodeBox 1 random letter script
# NodeBox 1 script that generates a composition of random letters.
# Download NodeBox 1 at https://www.nodebox.net/download/
size(800, 400)
from random import choice, uniform, seed
seed(52)
colors = [[0, 0, 0], [1, 0, 0], [1, 1, 1]]
def comp(x, y, w, h):
push()