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"); | |
const meta = std.meta; | |
const Example = struct { | |
foo: []const u8, | |
bar: i32, | |
const docs = std.EnumArray( | |
meta.FieldEnum(Example), | |
// 👇 type of value of metadata checked at comptime, can be any type declared |
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 main() !void { | |
var args = std.process.args(); | |
_ = args.next(); | |
const path = args.next() orelse { | |
bail("expected path argument. this is the path to the file we're appending metadata to"); | |
}; | |
const platform = args.next() orelse { | |
bail("expected duckdb platform argument. see https://duckdb.org/docs/extensions/working_with_extensions#platforms"); |
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
// remix of https://discordapp.com/channels/605571803288698900/1219282855679496243/1219706356718632981 | |
const std = @import("std"); | |
const Timestamp = struct { | |
seconds: i64, | |
pub fn format( | |
self: @This(), | |
comptime _: []const u8, | |
_: std.fmt.FormatOptions, |
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
// To execute Go code, please declare a func main() in a package "main" | |
package main | |
import ( | |
"log" | |
"reflect" | |
"time" | |
) |
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 java.io.*; | |
import java.util.*; | |
import static org.junit.Assert.*; | |
// fmt: shift + cmd + f | |
// imports : shift + cmd + o | |
class Solution { | |
// impl | |
// 👇 |
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
java.base@11.0.11 | |
exports java.io | |
exports java.lang | |
exports java.lang.annotation | |
exports java.lang.invoke | |
exports java.lang.module | |
exports java.lang.ref | |
exports java.lang.reflect | |
exports java.math | |
exports java.net |
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 java.util.stream.*; | |
import java.util.concurrent.*; | |
import java.util.*; | |
public <T> Stream<T> nonRepeatingStream(List<T> src) { | |
IntSupplier index = () -> ThreadLocalRandom.current().nextInt(0, src.size()); | |
return Stream.iterate( | |
index.getAsInt(), | |
(prev) -> { | |
int next = index.getAsInt(); |
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
use rand; // 0.8.3 | |
use rand::Rng; | |
use std::iter::successors; | |
fn non_repeating<T: std::cmp::PartialEq + Clone>(src: &[T]) -> impl Iterator<Item = &T> + '_ { | |
let mut rng = rand::thread_rng(); | |
successors(Some(&src[rng.gen_range(0..src.len())]), move |n| { | |
let mut next = &src[rng.gen_range(0..src.len())]; | |
while *next == **n { | |
next = &src[rng.gen_range(0..src.len())]; |
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
function getHumanReadable() { | |
echo $(echo $1 | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}') | |
} |
This file has been truncated, but you can view the full file.
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
docker diff 7a3036a55355 | |
C /root | |
A /root/.cargo | |
A /root/.cargo/bin | |
A /root/.cargo/bin/rustfmt | |
A /root/.cargo/bin/rustup | |
A /root/.cargo/bin/cargo-fmt | |
A /root/.cargo/bin/clippy-driver | |
A /root/.cargo/bin/rustc | |
A /root/.cargo/bin/rustdoc |
NewerOlder