Skip to content

Instantly share code, notes, and snippets.

View zahlenteufel's full-sized avatar

Gastón Bengolea Monzón zahlenteufel

View GitHub Profile
@zahlenteufel
zahlenteufel / input.scss
Created June 17, 2022 16:00
Generated by SassMeister.com.
@mixin use-mobile-bottom-bar($value) {
.bottom-navigation-buttons-container {
display: if($value, block, none);
}
.navigation-buttons-container {
display: if($value, none, block);
}
}
@zahlenteufel
zahlenteufel / Lupa.m
Last active December 14, 2019 10:13
Magnifier Glass effect in MATLAB
original_image = imread('butterfly.jpg');
[n m c] = size(original_image);
assert(c == 3);
angles = linspace(0, 20 * pi, 1000);
for i=1:length(angles)
radius = 200;
c = 0.5 + sin(angles(i)) / 2;
[x y] = meshgrid(1:m, 1:n);
@zahlenteufel
zahlenteufel / safeHtmlCollector.java
Created April 24, 2018 21:31
Java SafeHtml collector
class xxx {
Collector<SafeHtml, SafeHtmlBuilder, SafeHtml> safeHtmlCollector =
Collector.of(
SafeHtmlBuilder::new,
(BiConsumer<SafeHtmlBuilder, SafeHtml>) SafeHtmlBuilder::append,
(builder1, builder2) -> builder1.append(builder2.toSafeHtml()),
SafeHtmlBuilder::toSafeHtml);
}
@zahlenteufel
zahlenteufel / minRectangle.html
Last active July 29, 2016 23:47
Minimum Enclosing Rectangle
<canvas id="myCanvas" width="500" height="500"></canvas>
@zahlenteufel
zahlenteufel / Apollonius.java
Last active October 7, 2015 06:08
Cono de Apolonio
SpecialPlane horPlane = new SpecialPlane(0,0.2, new PVector(253, 184, 19));
SpecialPlane parPlane = new SpecialPlane(1, 0.5, new PVector(246, 139, 31));
SpecialPlane obPlane = new SpecialPlane(0.5, 0.3, new PVector(241, 112, 34));
VPlane vertPlane = new VPlane(-0.4, new PVector(238, 246, 108));
boolean[] visible = {true, true, true, true, true}; // which parts of the cone are visible
float rotY = 0, rotX = 0;
PVector[][] ps = generatePoints(100);
void setup() {
@zahlenteufel
zahlenteufel / binary_tree_iterators.cpp
Created July 8, 2015 16:20
Binary Tree Iterators
#include <iostream>
#include <cassert>
using namespace std;
struct node {
int value;
node* left;
node* right;
node *parent;
@zahlenteufel
zahlenteufel / iterative_inorder_traversal.cpp
Created July 8, 2015 12:50
Iterative inorder traversal of a Binary Tree in C++11
#include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
struct node {
int value;
node* left;
node* right;
@zahlenteufel
zahlenteufel / LinCod.py
Created June 4, 2015 02:53
Implementation of Fraenkel's "Error-Correcting-Code using Combinatorial Games"
# 1) for m in 0..n compute g_s(z_m) = mex{g(Z_i_1) xor ... xor g(z_i_j) : 0 <= i_1 < .. < i_j < m, j <=s}
import itertools
import operator
n = 8
s = 3 # s = d - 2
def pack(idxs, n):
return [int(i in idxs) for i in xrange(n)]
@zahlenteufel
zahlenteufel / kwaymerge.cpp
Created June 10, 2014 23:14
K-Way Merge using C++11
template <typename T>
using minheap = priority_queue<T, vector<T>, greater>;
vector<int> kwaymerge(vector<vector<int>>& vs) {
int k = vs.size();
vector<int> readcount(k, 0);
vector<int> res;
vector<pair<int, int>> vec;
for (int i = 0; i < k; i++) {
if (vs[i].size() > 0){
@zahlenteufel
zahlenteufel / parzenWindow.m
Last active August 29, 2015 14:00
Experimenting with Parzen Window in MATLAB for Density Estimation
% Generate the points
clf
subplot(2,1,1);
axis equal
mu1 = [5 4]';
sigma1 = [2 -0.8; -0.8 1];
mu2 = [0 1]';
sigma2 = [1 -0.06;-0.06 0.5];
chol(sigma1);
chol(sigma2); % verifica definida positiva