Skip to content

Instantly share code, notes, and snippets.

View KeenS's full-sized avatar

κeen KeenS

View GitHub Profile
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gio
from gi.repository import GLib
conn = Gio.DBusProxy.new_for_bus_sync(
Gio.BusType.SESSION,
Gio.DBusProxyFlags.NONE,
# info
None,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
module Either = struct
type ('a, 'b) t = Left of 'a | Right of 'b
let left v = Left v
let right v = Right v
let fold ~left ~right = function
| Left v -> left v
| Right v -> right v
end
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Document</title>
</head>
<body>
<div class="controls">
<div class="left">
<div id="playButton" class="button">
fn extract_sqrt(mut n: u64) -> (u64, u64) {
let mut blocks = [0u8; 32];
let mut i = 0;
let mut ret = 0u64;
while n != 0 {
blocks[i] = (n & 0b11) as u8;
n >>= 2;
i += 1;
}
let mut q = 0;
//! rust port of this
//! https://twitter.com/gakuzzzz/status/1314499876969881602
//! requires nightly
// just for ease
#![feature(bool_to_option)]
// mandatory
#![feature(type_alias_impl_trait)]
// code
@KeenS
KeenS / COPYING
Last active April 2, 2020 12:12
codes used to generate https://github.com/KeenS/whitelie
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
[package]
name = "so-actix-web-reqwest"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "2.0"
reqwest = "0.10"
@KeenS
KeenS / qsort.smi
Last active January 3, 2020 16:35
An example of SML#'s MassiveThreads support
_require "basis.smi"
_require "thread.smi"
@KeenS
KeenS / memo.txt
Last active December 21, 2019 12:10
Rustの並列コンパイラを試してみた See also https://qiita.com/qnighy/items/b0aa66749ad7a31ecbf9
手元のコード(4万行くらい)をThreadripper 1950x(16コア32スレッド)でビルドしてみた
# 並列化してないやつ
cargo +nightly-2019-12-17 build 882.25s user 49.92s system 468% cpu 3:19.16 total
cargo +nightly-2019-12-17 build --release 2988.11s user 52.70s system 1149% cpu 4:24.54 total
cargo +nightly-2019-12-17 check 199.58s user 14.22s system 413% cpu 51.731 total
# 並列化したやつ
cargo +nightly-2019-12-18 build 1061.89s user 75.08s system 618% cpu 3:03.70 total
cargo +nightly-2019-12-18 build --release 3135.03s user 74.32s system 1247% cpu 4:17.21 total