Skip to content

Instantly share code, notes, and snippets.

Avatar
😃
下一阶段的目标是做个 OCI 的 Rust 实现

Quanyi Ma genedna

😃
下一阶段的目标是做个 OCI 的 Rust 实现
View GitHub Profile
View jon-roam-daily-template.md
  • Weekly Agenda (created on a different day, and embedded with /Block Reference)
  • [[Morning Questions]] [[2/24 -- 3/1/2020]]
    • {{[[slider]]}} How many hours of sleep did I get?
    • [[What's one thing top of mind today?]]
    • [[What's the one thing I need to get done today to make progress?]]
  • Agenda
    • {{[[TODO]]}} 2 hours focused time
    • {{[[TODO]]}} Read 30 minutes #goal-learning #habit
  • Health & self-care
    • {{[[TODO]]}} 30 minutes outside #goal-health #habit
@genedna
genedna / playground.rs
Created Jan 2, 2020 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
use std::collections::HashMap;
use std::collections::HashSet;
use std::hash::Hash;
use std::fmt::Debug;
#[derive(Debug, Clone)]
struct EdgeIndex<Ix>(Ix);
#[derive(Debug, Clone)]
struct NodeIndex<Ix>(Ix);
View make.conf
# GCC
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
MAKEOPTS="-j5"
# USE
SUPPORT="pulseaudio btrfs mtp git udisks gvfs png jpg jpeg alsa client icu sudo python consolekit udev"
DESKTOP="X policykit fileroller cairo cups mount curl dbus vim infinality emoji cjk"
@genedna
genedna / indicatif-hyper.rs
Created Sep 18, 2019 — forked from clux/indicatif-hyper.rs
indicatif progress bars with hyper 0.10
View indicatif-hyper.rs
pub fn http_download_to_path(url: &str, save: &PathBuf) -> Result<()> {
let client = Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap()));
let mut res = client.get(url).send()?;
if res.status != hyper::Ok {
return Err(Error::SomeError)));
}
let use_progress = true;
if use_progress {
use indicatif::{ProgressBar, ProgressStyle};
View progress.rs
pub fn copy_with_progress<R: ?Sized, W: ?Sized>(progress: &ProgressBar,
reader: &mut R, writer: &mut W)
-> io::Result<u64>
where R: Read, W: Write
{
let mut buf = [0; 16384];
let mut written = 0;
loop {
let len = match reader.read(&mut buf) {
Ok(0) => return Ok(written),
@genedna
genedna / audit.rules
Created Jun 5, 2019 — forked from Neo23x0/audit.rules
Linux Auditd Best Practice Configuration
View audit.rules
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
@genedna
genedna / go-redis-pub-sub.go
Created Mar 8, 2019
go-redis pub sub example
View go-redis-pub-sub.go
package main
import (
"github.com/go-redis/redis"
)
var (
RedisClient *redis.Client
)
View datesort.go
package main
import (
"fmt"
"sort"
"time"
)
type Master []time.Time
View sample.yml
app:
image: bradrydzewski/go:1.2
git:
path: github.com/drone/drone
environment:
- GOROOT=/usr/local/go
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
services:
- redis
- mysql
@genedna
genedna / gist:99853b7aa85f70dab7b6
Last active Mar 21, 2019
Terminal Developing Environment Config
View gist:99853b7aa85f70dab7b6
git clone https://github.com/vim/vim.git
sudo yum install -y ruby ruby-devel lua lua-devel luajit luajit-devel ctags mercurial python python-devel python3 python3-devel tcl-devel perl perl-devel perl-ExtUtils-ParseXS perl-ExtUtils-XSpp perl-ExtUtils-CBuilder perl-ExtUtils-Embed ncurses-devel
./configure --with-features=huge --enable-multibyte --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-luainterp --enable-gui=gtk2 --enable-cscope --with-tlib=ncurses --prefix=/usr
make VIMRUNTIMEDIR=/usr/share/vim/vim80
sudo make install