Skip to content

Instantly share code, notes, and snippets.

View celaus's full-sized avatar
🎯
Focusing

Claus Matzinger celaus

🎯
Focusing
View GitHub Profile
@celaus
celaus / pmx.js
Created August 25, 2018 21:19
PMX - Partially Mapped Crossover
function x(s, t) {
let _map1 = {};
let _map2 = {};
const x1 = Math.floor(Math.random() * (s.length - 1));
const x2 = x1 + Math.floor(Math.random() * (s.length - x1));
let offspring = [Array.from(s), Array.from(t)];
@celaus
celaus / eden build
Created March 26, 2017 13:57
How to build eden for ARM
docker run -i --rm \
-v $(pwd):/source \
-v /tmp/cargo/git:/root/.cargo/git \
-v /tmp/cargo/registry:/root/.cargo/registry \
-e CXX=arm-linux-gnueabihf-gcc-with-link-search \
dlecan/rust-crosscompiler-arm
version: '3'
services:
cratedb:
image: "crate/crate:testing" # :1.0.5
environment:
- CRATE_HEAP_SIZE=3g
command: ["crate", "-Cgateway.expected_nodes=3", "-Cgateway.recover_after_nodes=2", "-Cdiscovery.zen.minimum_master_nodes=2", "-Cdiscovery.zen.ping.multicast.enabled=false", "-Cdiscovery.zen.ping.unicast.hosts=cratedb", "-Cnetwork.bind=_eth0_", "-Ccluster.name=NYC"]
networks:
- cratedb_network
- client_network
version: '2'
services:
crate:
image: crate/crate:testing
cpu_shares: 100
mem_limit: 512000000
command: "/docker-entrypoint.sh crate -Des.gateway.expected_nodes=3 -Des.discovery.zen.minimum_master_nodes=2 -Des.gateway.recover_after_nodes=2"
ports:
- "4200:4200"
- "4300:4300"
select avg(tip_amount) from "nyc-yellowcab" where tip_amount > 0;
select count(*), vendorid from "nyc-yellowcab" group by vendorid;
select avg(tip_amount), vendorid from "nyc-yellowcab" where tip_amount > 0 group by 2;
select avg(cast(passenger_count as integer)) from "nyc-yellowcab";
select passenger_count, avg(tip_amount) from "nyc-yellowcab" where tip_amount > 0 group by passenger_count order by 1;
select passenger_count, count(*) from "nyc-yellowcab" group by passenger_count order by 1;
apiVersion: v1
kind: Service
metadata:
name: crate-discovery
labels:
app: crate
spec:
ports:
- port: 4200
name: crate-web
apiVersion: v1
kind: Service
metadata:
name: crate-discovery
labels:
app: crate
spec:
ports:
- port: 4200
name: crate-web

Keybase proof

I hereby claim:

  • I am celaus on github.
  • I am clausm (https://keybase.io/clausm) on keybase.
  • I have a public key whose fingerprint is 6E06 8FDF 51A5 84F0 9A6B D81B 5C31 1306 7BDF CE4E

To claim this, I am signing this object:

@celaus
celaus / mopidy-musicbox.conf
Created February 27, 2016 20:07
nginx config for Mopidy's musicbox web client.
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
package xyz.x5ff.bklg.data.dao
trait BaseDAO[DomainType] {
def save(obj: DomainType): DomainType
def del(obj: DomainType): DomainType
def createTable(): Any
def dropTable(): Any
}