Instantly share code, notes, and snippets.

View car_simulator_physics.txt
https://www.youtube.com/watch?v=I8GQCZgCNw8
https://www.gtplanet.net/dr-kazunori-yamauchi-gives-lecture-gran-turismos-driving-physics-production/
https://www.gtplanet.net/polyphony-digital-reveals-gt-sports-iris-ray-tracing-system-at-cedec-2018
https://www.youtube.com/watch?v=VxL9j-j7JaI
https://www.youtube.com/watch?v=FPX2qRQAnBo
https://www.youtube.com/watch?v=QESGXTFFZXM
https://www.youtube.com/watch?v=-FrybeCxDPU
https://www.youtube.com/watch?v=ygUqvfeAaa0
https://www.youtube.com/watch?v=jD2Zd-Pi4lQ
https://www.youtube.com/watch?v=bYp2vvUgEqE
View block_match.m
function [ref_ii, ref_jj, blk_residual] = block_match(blk, frame)
% frame and block dimensions
[H, W] = size(frame);
blk_size = size(blk, 1);
ref_ii = 1;
ref_jj = 1;
err = (255 ^ 2) * (blk_size ^ 2);
blk_residual = 255 * ones(blk_size, blk_size);
View entropy.m
Image = imread('Cameraman256.bmp');
Frequency = zeros(256);
Samples = 256 * 256;
for i = 1:256
for j = 1:256
% convert 0-255 to index-wise
IntensityIndex = Image(i,j) + 1;
Frequency(IntensityIndex) = Frequency(IntensityIndex) + 1;
end
View dft.m
% it creates a simple gray image (4x4)
I = [255, 255, 30, 100
255, 50, 90, 20
70, 70, 20, 10
100, 20, 10, 0];
% it converts it to grayscale
I = mat2gray(I);
% shows it
imshow(I);
View functor_monad_applicative_javascript.js
// This post will briefly explain (omiting, skipping some parts) in code what is
// Functor, Pointed Functor, Monad and Applicative Functor. Maybe by reading the
// code you will easily grasp these functional concepts.
// if you only want to run this code go to:
// https://jsfiddle.net/leandromoreira/buq5mnyk/
// or https://gist.github.com/leandromoreira/9504733c7f8c6361c46270ea953d8409
// This code requires you to have require.js loaded (or you can load ramda instead :P)
requirejs.config({
View konami.js
var a = []; document.onkeyup=function(e){a+=[(e||self.event).keyCode-37] ; if (/113302022928/.test(a)) { alert('Konami Code'); a = ""}}
View bob_ross.sh
# creating an amazon machine
docker-machine create --driver amazonec2 --amazonec2-access-key XXX --amazonec2-secret-key "xxxxx" --amazonec2-vpc-id vpc-xxx --amazonec2-zone Y amazon
# creating a digital ocean machine
docker-machine create --driver digitalocean --digitalocean-access-token=XXX do
# let's take note of our ip
docker-machine ip amazon
# let's deploy our application
docker-machine up
View kremlings_back.sh
# we'll create a "machine" called dev on virtualbox
docker-machine create --driver virtualbox dev
# let's use this machine
eval "$(docker-machine env dev)"
# let's take note of our docker-ip
docker-machine ip dev
# let's run this app
docker-compose up
# now go to your browser and type ip :) it should show something
View nginx.conf
# we'll use 2 processors/core
worker_processes 2;
# we set a new limit for open files for our workers
worker_rlimit_nofile 100000;
# we define how we're going to work
events {
# for each worker we'll handle 4000 requests (enquee them)
worker_connections 4000;
# we'll accept multiple
View Dockerfile
# we'll build our container from an existent image :)
FROM nginx
# for some reason we need to create this folder
RUN mkdir -p /var/lib/nginx/proxy
# copy our app config to nginx
COPY sites-enabled/myapp.conf /etc/nginx/nginx.conf