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 tokio::io::{AsyncReadExt, AsyncWriteExt}; | |
#[tokio::main] | |
async fn main() { | |
let mut child = tokio::process::Command::new("cat") | |
.stdin(std::process::Stdio::piped()) | |
.stdout(std::process::Stdio::piped()) | |
.spawn() | |
.expect("Failed to spawn cat process"); |
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 object_store::local::LocalFileSystem; | |
use object_store::aws::{DynamoCommit, S3ConditionalPut}; | |
use object_store::{path::Path, ObjectStore}; | |
use rand::{Rng, RngCore}; | |
use slatedb::config::ReadLevel::Uncommitted; | |
use slatedb::config::{DbOptions, ObjectStoreCacheOptions, ReadOptions, WriteOptions}; | |
use slatedb::db::Db; | |
use slatedb::inmemory_cache::InMemoryCacheOptions; | |
use std::path::PathBuf; | |
use std::sync::Arc; |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKalPVMjfwc6xyDXM9Pp5eync+Jv4VcQ/mSN/RLOPfl+wArIPJjhdJU7GecA6pv/09jt2bqTccgeFLm8ASibmIf5ZWoGMfUXquGuf5nUpadOyeIthfiuiFrWv7PY/MYT13Hh24nWrrvnJ7bDd+Jc7HQ5Y5oiV9fMZKBYLg6rwbLnBpHGGkIIRMhZfvD21/av+IZLnAzE3y0/ZTaY5zY9oQNODkWXEhso1+Jv9GEUj0JpUx4ocjhNTwtOydvFB6SamDE9MQ6l5ICXzlVzRxwT1nfXY3R0kkKGw/qSauzAMuBzB98s/zHXLrs1BEV+MNeGi9mE5MI7FBldjN5+sdbCWNJXc+Mjwl6cLZKMXNg1I8mwk2/2fC75GYDkVYse+zcrsfVc4xRTelAZ9rH6HIWy54SNgnY8BynfRKfF/3yn0oBvUcynov68mT2GRimnlXvhpXb12KM4/eDOPcyz/AZiZ2U4sOi+q/dFU4UjcjwbKWnUZvM6jNyP4RTlDUMIQRU1M= yazhou@yazhous-MBP |
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
text = """ | |
0.01908ms | |
0.02825ms | |
0.01729ms | |
0.03700ms | |
0.02542ms | |
0.02700ms | |
0.04529ms | |
0.00400ms | |
0.02742ms |
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 subprocess | |
import time | |
from statistics import mean | |
# Function to measure the execution time of a command | |
def measure_time(command): | |
start_time = time.time() | |
subprocess.run(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | |
end_time = time.time() | |
return end_time - start_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
When performing matrix-vector multiplication on the GPU, you can optimize the operation using parallel reduction to efficiently sum up the elements. In a Vulkan compute shader, this could be done using shared memory (local memory in GLSL) to perform a partial sum for each workgroup before completing the sum for the entire vector. | |
Here's a GLSL compute shader example that demonstrates a reduction pattern for summing elements. The shader assumes that the size of the matrix row (which is the size of the vector) is a power of two for simplicity. This may not be the case in a real-world scenario, so you would need to modify the shader to handle arbitrary sizes. | |
```glsl | |
#version 450 | |
// Define the size of the workgroup | |
layout(local_size_x = 128) in; |
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
goroutine profile: total 60502 | |
30061 @ 0x438cc0 0x448c43 0x835698 0x6c4c74 0x6c6ab5 0x6c8003 0x6c3a7c 0x4688d1 | |
# 0x835697 main.sse+0x787 /data/tmp/portage/net-misc/gossipd-9999/work/src/github.intra.douban.com/push/gossipd/apps/ssed/sse.go:132 | |
# 0x6c4c73 net/http.HandlerFunc.ServeHTTP+0x43 /usr/lib/go/src/net/http/server.go:2012 | |
# 0x6c6ab4 net/http.(*ServeMux).ServeHTTP+0x1a4 /usr/lib/go/src/net/http/server.go:2387 | |
# 0x6c8002 net/http.serverHandler.ServeHTTP+0xa2 /usr/lib/go/src/net/http/server.go:2807 | |
# 0x6c3a7b net/http.(*conn).serve+0x86b /usr/lib/go/src/net/http/server.go:1895 | |
30060 @ 0x438cc0 0x431b9a 0x431105 0x4d41d5 0x4d506b 0x4d504d 0x59c50f 0x5af0ae 0x608950 0x48a7b1 0x608b9c 0x607155 0x60b27b 0x60b286 0x833443 0x4688d1 | |
# 0x431104 internal/poll.runtime_pollWait+0x54 /usr/lib/go/src/runtime/netpoll.go:203 |
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
#!/usr/bin/env python | |
from __future__ import absolute_import, print_function | |
import os | |
import sys | |
import subprocess | |
import tempfile | |
import platform | |
import functools | |
import codecs |
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
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev | |
wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz | |
tar -xzf Python-2.7.9.tgz | |
cd Python-2.7.9 | |
./configure --prefix=/usr --enable-shared | |
make | |
sudo make install | |
cd .. |
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
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var reactify = require('reactify'); | |
var del = require('del'); | |
var source = require('vinyl-source-stream'); | |
var sass = require('gulp-sass'); | |
var sourcemaps = require('gulp-sourcemaps') | |
var paths = { | |
SCSS: ['app/css/**/*.scss'], |
NewerOlder