This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
pub fn build(b: *std.build.Builder) void { | |
const exe = exe: { | |
const target = b.standardTargetOptions(.{}); | |
const mode = b.standardReleaseOptions(); | |
const e = b.addExecutable("foo", "src/main.zig"); | |
e.setTarget(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Count unique values for each tag in a bucket | |
import "influxdata/influxdb/schema" | |
cardinalityByTag = (bucket) => | |
schema.tagKeys(bucket: bucket) | |
|> map(fn: (r) => ({ | |
tag: r._value, | |
_value: | |
if contains(set: ["_stop","_start"], value:r._value) then 0 | |
else (schema.tagValues(bucket: bucket, tag: r._value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Random | |
function generate_pairs(names) | |
while true | |
candidates = zip(names, Random.shuffle(names)) |> collect | |
# Only take those permutations without fixed point, i.e. | |
# noone has to buy a present for herself/himself | |
if findfirst(p -> p[1] == p[2], candidates) === nothing | |
return candidates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR: LoadError: Call to XGBoost C function XGBoosterPredict failed: [21:13:09] /workspace/srcdir/xgboost/src/c_api/c_api.cc:498: DMatrix/Booster has not been intialized or has already been disposed. | |
Stack trace: | |
[bt] (0) /home/XXX/.julia/artifacts/51760a35c00d03a1b2ee373a49af64d08700a64a/lib/libxgboost.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x61) [0x7f7b0fddb2d1] | |
[bt] (1) /home/XXX/.julia/artifacts/51760a35c00d03a1b2ee373a49af64d08700a64a/lib/libxgboost.so(XGBoosterPredict+0x183) [0x7f7b0fdd4303] | |
[bt] (2) [0x7f7b1040bfd9] | |
[bt] (3) [0x7f7b1040c679] | |
[bt] (4) [0x7f7b1040c79e] | |
[bt] (5) /opt/julia/julia-1.5.2/bin/../lib/libjulia.so.1(jl_apply_generic+0x6f3) [0x7f7b45a1c163] | |
[bt] (6) [0x7f7b1040bee1] | |
[bt] (7) [0x7f7b1040bf5d] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### A Pluto.jl notebook ### | |
# v0.11.8 | |
using Markdown | |
using InteractiveUtils | |
# ╔═╡ 0b752c76-e6fa-11ea-3929-835e1cde79d8 | |
begin | |
import Pkg; Pkg.activate(".") | |
using DataFrames |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FileIO | |
using Images | |
import Cairo | |
function with_background(f, filename::String) | |
ctx = nothing | |
surf = nothing | |
try | |
img_raw = load(filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as npr | |
import pandas as pd | |
from functools import reduce | |
def get_dfs(): | |
for i in range(10): | |
yield pd.DataFrame(index=npr.permutation(10), data={f'c_{i}': npr.rand(10)}) | |
def reducer(acc, x): | |
merged = acc.merge(x, left_index=True, right_index=True, indicator=True, how='outer') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cargo +nightly build --features "clippy" | |
Compiling clippy_lints v0.0.195 | |
error[E0432]: unresolved import `syntax::abi` | |
--> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.195/src/functions.rs:8:13 | |
| | |
8 | use syntax::abi::Abi; | |
| ^^^ Could not find `abi` in `syntax` | |
error[E0432]: unresolved import `syntax::abi` | |
--> /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.195/src/needless_pass_by_value.rs:9:13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/xenial64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "8192" | |
vb.cpus = 4 | |
end | |
# These env vars are not important for my example, contained here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concatLeft :: Char -> C.ByteString -> C.ByteString | |
concatLeft delim a = go $ C.uncons a | |
where bsa = C.singleton delim | |
go Nothing = bsa | |
go (Just (delim, r)) = concatLeft delim r | |
go (Just (x, r)) = C.concat [bsa, r] | |
-- Warning: | |
-- Pattern match(es) are overlapped | |
-- In an equation for ‘go’: go (Just (x, r)) = ... |
NewerOlder