Skip to content

Instantly share code, notes, and snippets.

FROM debian:stable-slim AS builder
RUN APT_FRONTEND=non-interactive apt-get update && apt-get install -y curl \
&& curl -sSL -o /tmp/go.tar.gz https://go.dev/dl/go1.20.4.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf /tmp/go.tar.gz
ENV PATH $PATH:/usr/local/go/bin:/root/go/bin
ENV CGO_ENABLED 1
RUN APT_FRONTEND=non-interactive apt-get install -y build-essential pkg-config clang \
liblz4-dev zlib1g-dev libzstd-dev libdeflate-dev libpng-dev libgif-dev libbz2-dev \
@zokier
zokier / bitmatch.rs
Created August 11, 2014 18:37
Rust bitlevel pattern matching
#![feature(plugin_registrar)]
extern crate syntax;
extern crate rustc;
use syntax::ast;
use syntax::codemap::Span;
use syntax::ext::base;
use syntax::ext::base::{ExtCtxt, MacExpr};
use syntax::ext::build::AstBuilder;
use syntax::parse::token;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zokier
zokier / kb_layout_stats.py
Created September 9, 2011 08:08
Stats about kb layouts
# this script calculates the use of modifier keys in different kb layouts
# kotoistus is Finnish keyboard layout (and for this purpose equivalent of Swedish layout)
# fi-intl is my custom layout, essentially US layout mixed with ö and ä letters
# us is basic US layout.
symbol_counts = {
#'a': 443776445,
#' ': 74199965, # ignore spaces for now
'_': 22890057,
',': 10895692,
@zokier
zokier / gist:1951412
Created March 1, 2012 17:00
Suomalaiset nimipäivät
{
"2013-01-01": [
],
"2013-01-02": [
"Aapeli"
],
"2013-01-03": [
"Elmeri",
"Elmo",
"Elmer"

Keybase proof

I hereby claim:

  • I am zokier on github.
  • I am zokier (https://keybase.io/zokier) on keybase.
  • I have a public key ASBYCiXERvk4W2FAGPyfSSbGjWftTEoV8a7F101zJw_StQo

To claim this, I am signing this object:

https://github.com/lord/slate
https://apiblueprint.org/
http://swagger.io/
http://raml.org/
fn is_printable_ascii(c: u8) -> bool {
c >= 0x20u8 && c < 0x7fu8
}
fn main() {
// why temporary variable needed?
// error: borrowed value does not live long enough
let test_data: ~[u8] = std::io::File::open(&Path::new("test_data")).read_to_end();
let _test_data_filtered: ~[u8] = test_data.iter()
// why double deref?
@zokier
zokier / b64_test.rs
Created January 4, 2014 12:11
extra::base64 decode failure
extern mod extra;
use extra::base64::FromBase64;
#[test]
fn test_b64_1() {
let test_data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n";
match test_data.from_base64() {
Ok(s) => s,
Err(msg) => fail!(format!("Failed to read b64: {:s}", msg.escape_default()))
};
@zokier
zokier / enum_fmt.rs
Last active December 28, 2015 12:09
#[feature(macro_rules)];
macro_rules! enum_fmt(
($name:ident { $($member:ident),+ }) => (
enum $name {
$(
$member,
)+
}
impl std::fmt::Default for $name {