Skip to content

Instantly share code, notes, and snippets.

View SimpleHologram.html
<!DOCTYPE html>
<html>
<style>
div {
display: block;
float: left;
}
</style>
<script>
var N = 12; // nº of divisions
View gist:b87ac23e255147696f8162cd09834b42
package org.testing;
import java.util.List;
import java.util.stream.IntStream;
import static java.util.stream.Collectors.counting;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;
public class Test {
View chino.html
<!DOCTYPE html><html><head><meta charset="utf-8">
<!-- obtener alguna fuente @font-face ... en este caso "Noto Sans SC" -->
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
/* donde sea usar esta fuente (puede añadirse a la lista de font-families del root) */
.chino {
font-family: "Noto Sans SC";
View descargar-borme
Info de descarga en:
https://www.boe.es/datosabiertos/
Para bajar todo desde enero de 2009 por ejemplo:
for y in `seq 2009 2020`
do
for m in 01 02 03 04 05 06 07 08 09 10 11 12
do
View clasificar.keras.py
# Si las relaciones son contínuas (ej. pueden ser expresadas por una función real),
# una ANN puede aproximarla de forma precisa:
#
# https://en.wikipedia.org/wiki/Universal_approximation_theorem
# Install
# $ python --version
# Python 3.8.5
# $ pip --version
# pip 20.1.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
View hide.user
// la consola javascript suele abrirse con F12, copiar, pegar, ENTER:
[].slice.call(document.querySelectorAll("li.comment"))
.filter(x => x.querySelector("b.fn").innerText == "David B")
.forEach(x => x.style.display = 'none')
// Antonio (AKA "Un físico")
[].slice.call(document.querySelectorAll("li.comment"))
.filter(x => x.querySelector("b.fn").innerText == 'Antonio (AKA "Un físico")')
.forEach(x => x.style.display = 'none')
View generic-fold.hs
class ToFrom f where
to :: List2 a -> f a
from :: f a -> List2 a
instance ToFrom Maybe where
to End = Nothing
to (Elem x _) = Just x
from Nothing = End
from (Just x) = Elem x End
View faldable-testing.hs
import Test.QuickCheck
import Algorithm.Search
...
-- conversion util
to :: List2 a -> [a]
to End = []
to (Elem x xs) = x: to xs
View either_observable_construction.java
package com.foo;
import com.htravel.fp.Either;
import io.reactivex.Observable;
import static com.htravel.fp.Either.left;
import static com.htravel.fp.Either.right;
public class Bar {
View gist:7b32918abb08ac0d51418c742a324950
private static NodeList<Statement> reduceDoExpression(final NodeList<Statement> xs) {
final NodeList<Statement> rs = new NodeList<>();
int i = 0;
while (i < xs.size()) {
final Statement s = xs.get(i);
if (s.isExpressionStmt()) {
final Expression e = s.asExpressionStmt().getExpression();
if (e.isVariableDeclarationExpr()) {
final VariableDeclarationExpr vde = e.asVariableDeclarationExpr();
if (vde.getVariables().size() == 1) {