Skip to content

Instantly share code, notes, and snippets.

View rinx's full-sized avatar
🍵
sencha

Rintaro Okamura rinx

🍵
sencha
View GitHub Profile
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: vald-ing
spec:
routes:
- kind: Rule
match: Host(`localhost`) && Headers(`Content-Type`, `application/grpc`)
priority: 10
services:
;; https://github.com/vdaas/vald-client-python
(import grpc)
(import [vald.v1.vald [insert_pb2_grpc
search_pb2_grpc
update_pb2_grpc
remove_pb2_grpc]])
(import [vald.v1.payload [payload_pb2]])
(setv channel (grpc.insecure-channel "localhost:8080"))
@rinx
rinx / helmify-kustomize
Created June 3, 2020 02:45 — forked from mumoshu/helmify-kustomize
Run `helmify-kustomize build $chart $env` in order to generate a local helm chart at `$chart/`, from kustomize overlay at `${chart}-kustomize/overlays/$env`
#!/usr/bin/env bash
cmd=$1
chart=$2
env=$3
dir=${chart}-kustomize
chart=${chart/.\//}
build() {
@rinx
rinx / compress_tar_gzip.go
Created May 27, 2020 06:52 — forked from mimoo/compress_tar_gzip.go
How to compress a folder in Golang using tar and gzip (works with nested folders)
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
@rinx
rinx / core.clj
Created October 27, 2019 08:59 — forked from taylorwood/core.clj
GraalVM polyglot interop between Clojure and JavaScript https://blog.taylorwood.io/2018/11/26/graal-polyglot.html
(ns polydact.core
(:import (clojure.lang IFn)
(org.graalvm.polyglot Context Value)
(org.graalvm.polyglot.proxy ProxyArray ProxyExecutable ProxyObject)))
(set! *warn-on-reflection* true)
(comment
(do
(def context
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.15686275064945221</real>
@rinx
rinx / mc1drad.rs
Created August 27, 2017 06:23
a simple monte carlo 1d radiative transfer code in Rust
extern crate rand;
use std::f64;
use rand::Rng;
struct MCInput {
np: u64,
tau: f64,
sal: f64,
omg: f64,
import Data.Vector.Unboxed as VU
-- linear algebra
-- add
(<+>) :: Vector Double -> Vector Double -> Vector Double
(<+>) x y = VU.zipWith (+) x y
-- sub
(<->) :: Vector Double -> Vector Double -> Vector Double
(<->) x y = VU.zipWith (-) x y
@rinx
rinx / mc1drad_mersenne_parallel.hs
Last active June 25, 2017 13:45
monte carlo 1d radiative transfer code written in haskell using random-mersenne package and parallel computation technique
import System.Random.Mersenne
import Control.Parallel.Strategies hiding (parMap)
nt = 4 -- number of thread
np = 1000000 -- number of photon
tau = 1.0 -- cloud optical thickness
sal = 0.5 -- surface albedo
omg = 1.0 -- single scattering albedo
@rinx
rinx / mc1drad_mersenne_list.hs
Created June 25, 2017 08:29
monte carlo 1d radiative transfer code written in haskell using random-mersenne package and infinite list of random numbers.
import System.Random.Mersenne
np = 1000000
tau = 1.0 -- cloud optical thickness
sal = 0.5 -- surface albedo
omg = 1.0 -- single scattering albedo
zu = tau -- atmosphere upper boundary
zb = 0.0 -- atmosphere lower boundary