Skip to content

Instantly share code, notes, and snippets.

@lukaseder
lukaseder / postgis-mandelbrot.sql
Created November 14, 2021 10:03
PostGIS Mandelbrot
with recursive
dims (r1, r2, i1, i2, s, it, p) as (values (-2::float, 1::float, -1.5::float, 1.5::float, 0.01::float, 100, 256.0::float)),
sprites (s) as (values (st_makepolygon(st_geomfromtext('linestring (0 0, 0 1, 1 1, 1 0, 0 0)')))),
n1 (r, i) as (select r, i from dims, generate_series((r1 / s)::int, (r2 / s)::int) r, generate_series((i1 / s)::int, (i2 / s)::int) i),
n2 (r, i) as (select r::float * s::float, i::float * s::float from dims, n1),
l (cr, ci, zr, zi, g, it, p) as (
select r, i, 0::float, 0::float, 0, it, p from n2, dims
union all
select cr, ci, zr*zr - zi*zi + cr, 2 * zr * zi + ci, g + 1, it, p from l where g < it and zr*zr + zi*zi < p
),
@majek
majek / compile-kernel.sh
Created February 1, 2021 15:36
repro for kvm gvisor
rm .config
make tinyconfig
make kvm_guest.config
make kvmconfig
./scripts/config \
-e EARLY_PRINTK \
-e 64BIT \
-e BPF -d EMBEDDED -d EXPERT \
-e INOTIFY_USER
@smira
smira / README.md
Last active November 13, 2024 10:27
Talos on Firecracker

Talos on Firecracker

  1. Build Firecracker from source (it's fast and easy, builds in docker): https://github.com/firecracker-microvm/firecracker/blob/master/docs/getting-started.md#building-from-source

  2. Adjust /dev/kvm permissions: https://github.com/firecracker-microvm/firecracker/blob/master/docs/getting-started.md#prerequisites

  3. Build Talos, you will need build/vmlinux & build/initramfs.xz.

  4. Prepare configs for Talos: osctl config generate fire https://172.16.0.2:6443. Make following changes to the config: add resolvers to the machine.network config: nameservers: ["8.8.8.8", "1.1.1.1"] (IP config will come from kernel args), update install location: install: disk: /dev/vda (default is sda).

@stephencookdev
stephencookdev / App.js
Created July 16, 2018 15:09
`SwitchWithSlide` example
import React from "react";
import { animateSwitch } from "./animateSwitch";
import { SlideOut } from "./SlideOut";
const SwitchWithSlide = animateSwitch(Switch, SlideOut);
export default () => (
<SwitchWithSlide>
<Route path="/a" component={PageA} />
<Route path="/b" component={PageB} />
@ubergesundheit
ubergesundheit / readme.md
Last active November 14, 2024 20:56
systemd traefik.service

systemd Service Unit for Traefik

Adapted from caddy systemd Service Unit

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.

Instructions

We will assume the following:

@jumpingfella
jumpingfella / RegressionRNN.java
Created May 25, 2018 14:17
1..100 deeplearning4j RNN example
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.layers.GravesLSTM;
import org.deeplearning4j.nn.conf.layers.RnnOutputLayer;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.deeplearning4j.nn.weights.WeightInit;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.api.ndarray.INDArray;
@avnerbarr
avnerbarr / murmur64.scala
Created January 23, 2018 08:10
64bit "murmur" hash in scala. The builtin murmur hash only outputs 32 bits so if hashing millions of items you will get quite a few conflicts. This method will allow hashing millions of items without any conflicts
// Simple function to generate 64 bit hashes using the builtin Murmur hash functionaliy which only outputs 32bits
// we had cases when hashing 15M+ items where we got around 0.08% conflicts
// using this method we were able to hash 15M items with 0 conflicts
object ExtendedMurmurHash {
val seed = 0xf7ca7fd2
def hash(u: String): Long = {
val a = scala.util.hashing.MurmurHash3.stringHash(u, seed)
val b = scala.util.hashing.MurmurHash3.stringHash(u.reverse.toString, seed)
// shift a 32 bits to the left, leaving 32 lower bits zeroed
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active November 18, 2024 14:30
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@patoorio
patoorio / .gitignore
Last active August 24, 2021 23:13 — forked from endolith/readme.md
Continuous wavelet analysis by Roger Fearick
*.pyc