Skip to content

Instantly share code, notes, and snippets.

View aucker's full-sized avatar
🎯
Focusing

Aucker aucker

🎯
Focusing
View GitHub Profile
@aucker
aucker / install-alacritty-ubuntu.sh
Created July 18, 2022 06:45 — forked from Aaronmacaron/install-alacritty-ubuntu.sh
Install Alacritty on Ubuntu
#!/bin/bash
# This installs alacritty terminal on ubuntu (https://github.com/jwilm/alacritty)
# You have to have rust/cargo installed for this to work
# Install required tools
sudo apt-get install -y cmake libfreetype6-dev libfontconfig1-dev xclip
# Download, compile and install Alacritty
git clone https://github.com/jwilm/alacritty
@aucker
aucker / gist:457a9f1ab622f677b31765254c725bf0
Created June 1, 2022 12:22 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@aucker
aucker / WSL.md
Last active July 17, 2022 13:13
Configure WSL(ubuntu20.04)

Use Ubuntu WSL instead of XFCE Manjaro:baby:

I have some labs to do so I need a Linux enviroment. However, the XFCE Manjaro has some bugs:

  • The bustub make file can not run on manjaro/arch linux
  • The XFCE crashes sometimes
  • The window manager is so poor

So I choose the Ubuntu 20.04 WSL on Windows10.

Without expectation, there are some things I need to configure.

add a user[optional]

@aucker
aucker / proxy.md
Last active March 27, 2023 06:46

Use proxy in WSL2:rocket:

TL;DR

Every time windows reboots, the IPv4 address will change, FXXK!!!:sweat_smile:

In .zshrc or .bashrc file, write the following commands:

export HTTP_PROXY=http://xxx.xxx.xxx.xxx:port

I found a better way:

@aucker
aucker / latency.markdown
Created May 30, 2022 01:04 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@aucker
aucker / manjaro.md
Last active June 2, 2022 12:45
things to do after install manjaro

Manjaro(XFCE) Installation:rocket:

Get the ISO files

From Manjaro website, choose one desktop environment as you like (don't recommand gnome cause I can't configure it well:smiling_face_with_tear:), you can even use i3!

Flash the Image into USB device

On Windows, just download the Rufus and flash. On macOS, use this commands: (Attention before copy: replace the /dev/disk* with you USB partition on the macOS)

diskutil list

Is Rust OOP? If not, what is it oriented to?

The answer is yes, Rust is OOP. However, Rust is not completely OOP. Rust has three features:

  • OOP
  • Functional
  • Trait oriented

And Rust is mostly Trait oriented.

@aucker
aucker / Rust type.md
Created April 22, 2022 14:56
some type convert

Converting a &str to a String

There are several ways to convert.

  • to_string()
fn main() {
    let new_string = "hello".to_string();
}

to_string() turns a &str to String.

  • to_owned()

The Rust macro learning: A Methodical Introduction

There are four types of macros in rust.

macro_rules!

As noted previously, macro_rules! is itself a syntax extension, meaning it is technically not part of the Rust Syntax. It uses the following forms:

Macro_rules! $name {
    $rule0 ;
    $rule1 ;
 // ...
fn main() {
    for arg in std::env::args().skip(1) {
        respond(arg);
    }
}

fn respond(arg: &str) {
    match arg {
        "hi" => println!("Hello there!"),