惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
L
LangChain Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Y
Y Combinator Blog
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 司徒正美
博客园 - 叶小钗
NISL@THU
NISL@THU
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
IT之家
IT之家
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
Spread Privacy
Spread Privacy
V
Vulnerabilities – Threatpost
T
Troy Hunt's Blog
Hugging Face - Blog
Hugging Face - Blog
S
Security @ Cisco Blogs
月光博客
月光博客
Latest news
Latest news
D
Docker
大猫的无限游戏
大猫的无限游戏
The Last Watchdog
The Last Watchdog
Know Your Adversary
Know Your Adversary
B
Blog
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
GbyAI
GbyAI
W
WeLiveSecurity
H
Heimdal Security Blog
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
Jina AI
Jina AI
Hacker News: Ask HN
Hacker News: Ask HN
Apple Machine Learning Research
Apple Machine Learning Research
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed

Stonecharioteer on Tech

I Traced My Traffic Through a Home Tailscale Exit Node What Was I Reading Last? In Three Not-So-Easy Pieces Dogfooding Is Hard Code blocks in your books, finally GoForGo v0.9.0 Merrilin - We built an app to read books I use a Macbook now Data Structures & Algorithms - Preparing for Interviews Using a local DNS namespace for local service discovery Direction KOllector - Publishing KOReader Highlights gbt: branches touched in the last 24 hours A Soiree into Symbols in Ruby Some Smalltalk about Ruby Loops Ruby Blocks Returning from Ruby Blocks, Procs and Lambdas My Linux Laptop Finally Works: How Claude Helped Me Fix Years of Annoyances TIL: Watchexec - Modern File Watching for Development Workflows A Less Busy Mind GoForGo - Learn Go through live examples Migrating My Old Blog to Hugo with Claude The Qtile Window Manager: A Python-Powered Tiling Experience Read the RFCs that Built the Internet Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers Python Reverse a List New Beginnings Leaving ChainSafe Systems Screen Lock for Cinnamon Desktop using Zenity and Terminal Commands Crews Not Teams A System for Getting Better at LeetCode So Far So Rust Retrying HTTP Requests with Rust A Primer on Control Charts Learning Rust Explicit is Better than Implicit: Rust for Pythonistas Using Custom Delimiters in Jinja Templates TIL: Creating Fixed Length Iterables in Python Documentation Without Assumption Vagrant Python - A Reflection in 2022 Learning Golang No, A Virtual Machine Is Not Enough: Why Developers Need Native Linux Empathy in Tech For Those Who Came in Late A Weekend With PostgreSQL TIL: Gooey and Python Fire for Quick GUIs and CLIs TIL: 2ality - Dr. Axel Rauschmayer's JavaScript Blog TIL: MassDNS - High-Performance Bulk DNS Lookups TIL: Matomo Analytics, Google Tech Writing, Memory Programming, and NES TV Signals TIL: MontyDB - MongoDB Implemented in Python Returning to the Craft of Programming TIL: CPUFetch, OneFetch, and Learn CSS TIL: DNS Performance Testing and Pi-hole with Unbound TIL: Eli Bendersky's Blog, Awesome By Example, NoCoDB, and Martin Kleppmann TIL: CRDTs, Extreme HTTP Performance, and BYTEPATH Game TIL: AutoInvent, ASGI, Python Packaging, RAPIDS GPU Computing, and FlaskCon TIL: MangaDesk - Terminal Client for MangaDex TIL: McFly - Smart Shell History Search TIL: Siege Load Testing and Awesome FastAPI Resources TIL: Ventoy Bootable USB and Justniffer Network Analysis TIL: CLI Code Review, Git Split Diffs, and Internal Combustion Engine TIL: Benford's Law, Web Security Headers, Event Sourcing, and Mozilla Security Guidelines How to Write Documentation - The README.md File The Importance of Documentation TIL: NNgroup UX Research, SponsorBlock, and Labella Python Library TIL: The Little Book of Rust Macros and Rust Performance Book TIL: Git-Bug Distributed Issue Tracker and Omni Kubernetes Monitoring TIL: Zellij - Modern Terminal Multiplexer TIL: How Discord Handles 2.5 Million Concurrent Voice Users TIL: Volumio - The Audiophile Music Player TIL: Areopagitica - Milton's Defense of Free Speech TIL: Fast Node Manager, Zoxide Smart CD, Technical Writing, PyO3, and Qubes OS TIL: Slurm Workload Manager for HPC Clusters TIL: Data Visualization Guide and Oso Authorization Academy TIL: CORS Deep Dive, Piku Tiny PaaS, Rust Strings, and Deno Standard Library TIL: Raspberry Pi OS Development, Vim Beginner Guide, Password Management, and QueryBook TIL: uBlock Origin Performance Optimization on Firefox TIL: Breaking PostgreSQL at Scale and LeetCode Problem Patterns TIL: Awesome Tmux Resources for Terminal Multiplexing TIL: Grit - A Multitree-Based Personal Task Manager TIL: Lens 4.2 Kubernetes IDE, Shell Scripting Guide, and Dark HTTP Server Do The Job You Hate So You Won't Hate The Job You Love TIL: Innernet VPN Solution and NoteCalc Calculator App TIL: Argo CD for GitOps and Lens Kubernetes IDE TIL: Modern Rust CLI Tools - System Monitoring, HTTP Requests, and DNS TIL: tz - A Time Zone Helper Tool TIL: Distributed Systems Education, Fallacies, and Self-Hosted Internet Archiving TIL: Real-Time Voice Cloning Technology TIL: ChartMuseum for Helm, AMD's Corporate Journey, and Kubernetes Pod Scaling TIL: Docker and Kubernetes Tools - Whaler, Descheduler, and Dive TIL: Post-Mortem Collection, Terminal Plotting, and Technical Twitter TIL: Dark Mode Toggle Web Component by Google Chrome Labs TIL: Python eval(), exec(), and compile() Functions TIL: Camelot PDF Tables, PostgreSQL Row Level Security, Zerodha Varsity, and Write Yourself a Git TIL: fuser Command for Process and File Investigation TIL: i Hate Regex - The Ultimate Regex Cheat Sheet TIL: Dolt - Git for Data and Database Version Control TIL: x86 Assembly Programming and SafeEyes Break Reminder TIL: Comprehensive Distributed Systems Reading List TIL: Cosmopolitan C Library, Distributed Systems Book, High Performance Browser Networking, and Rust Roguelike Tutorial
TIL: Rust Terminal Libraries, Text Editor Development, Tau vs Pi, and TypeLit Typing Practice
2020-10-09 · via Stonecharioteer on Tech

Today’s discoveries spanned from practical Rust development to mathematical philosophy and skill improvement techniques.

Rust Terminal Application Libraries

Several powerful Rust crates enable sophisticated terminal user interfaces:

Core Terminal Libraries:

Crossterm - Cross-Platform Terminal Manipulation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Cargo.toml
[dependencies]
crossterm = "0.27"

// Basic usage
use crossterm::{
    cursor, execute, style,
    terminal::{self, ClearType},
    Result
};
use std::io::stdout;

fn main() -> Result<()> {
    // Enter raw mode for character-by-character input
    terminal::enable_raw_mode()?;

    // Clear screen and move cursor
    execute!(
        stdout(),
        terminal::Clear(ClearType::All),
        cursor::MoveTo(0, 0),
        style::Print("Hello, Terminal!")
    )?;

    // Restore terminal
    terminal::disable_raw_mode()?;
    Ok(())
}

TUI-rs - Rich Terminal User Interfaces:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Cargo.toml
[dependencies]
tui = "0.19"
crossterm = "0.27"

use tui::{
    backend::CrosstermBackend,
    layout::{Constraint, Direction, Layout},
    style::{Color, Modifier, Style},
    text::{Span, Spans},
    widgets::{Block, Borders, List, ListItem, Paragraph},
    Terminal,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize terminal
    let stdout = std::io::stdout();
    let backend = CrosstermBackend::new(stdout);
    let mut terminal = Terminal::new(backend)?;

    terminal.draw(|f| {
        let chunks = Layout::default()
            .direction(Direction::Vertical)
            .margin(1)
            .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
            .split(f.size());

        let paragraph = Paragraph::new("Hello, TUI!")
            .block(Block::default().title("Greeting").borders(Borders::ALL));
        f.render_widget(paragraph, chunks[0]);

        let items: Vec<ListItem> = vec![
            ListItem::new("Item 1"),
            ListItem::new("Item 2"),
            ListItem::new("Item 3"),
        ];
        let list = List::new(items)
            .block(Block::default().title("List").borders(Borders::ALL))
            .style(Style::default().fg(Color::White))
            .highlight_style(Style::default().add_modifier(Modifier::ITALIC))
            .highlight_symbol(">>");
        f.render_widget(list, chunks[1]);
    })?;

    Ok(())
}

Termium - Lower-Level Terminal Control:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// Cargo.toml
[dependencies]
termion = "1.5"

use termion::raw::IntoRawMode;
use termion::{clear, cursor, style};
use std::io::{stdout, Write};

fn main() {
    let _stdout = stdout().into_raw_mode().unwrap();

    print!("{}{}{}Bold and Red Text{}{}",
           clear::All,
           cursor::Goto(1, 1),
           style::Bold,
           style::Reset,
           cursor::Goto(1, 3));

    stdout().flush().unwrap();
}

Text Editor Development Tutorials

Hecto - Modern Text Editor in Rust:

Hecto Tutorial demonstrates building a complete text editor from scratch:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Core editor structure
pub struct Editor {
    should_quit: bool,
    terminal: Terminal,
    cursor_position: Position,
    offset: Position,
    document: Document,
    status_message: StatusMessage,
}

impl Editor {
    pub fn run(&mut self) {
        loop {
            if let Err(error) = self.refresh_screen() {
                die(&error);
            }
            if self.should_quit {
                break;
            }
            if let Err(error) = self.process_keypress() {
                die(&error);
            }
        }
    }

    fn process_keypress(&mut self) -> Result<(), std::io::Error> {
        let pressed_key = Terminal::read_key()?;
        match pressed_key {
            Key::Ctrl('q') => self.should_quit = true,
            Key::Up | Key::Down | Key::Left | Key::Right
            | Key::PageUp | Key::PageDown | Key::End | Key::Home => {
                self.move_cursor(pressed_key);
            }
            Key::Char(c) => {
                self.document.insert(&self.cursor_position, c);
                self.move_cursor(Key::Right);
            }
            Key::Delete => self.document.delete(&self.cursor_position),
            Key::Backspace => {
                if self.cursor_position.x > 0 || self.cursor_position.y > 0 {
                    self.move_cursor(Key::Left);
                    self.document.delete(&self.cursor_position);
                }
            }
            _ => (),
        }
        Ok(())
    }
}

Kilo-inspired C Tutorial:

antirez/Kilo provides step-by-step text editor construction:

Core Features Implementation:

  • Raw mode terminal control
  • Keyboard input handling
  • Screen drawing and cursor movement
  • File I/O operations
  • Search functionality
  • Status bar and message display

Wilo - Minimalist Rust Editor:

Wilo demonstrates a simple but functional text editor architecture:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Simplified editor loop
struct Editor {
    buffer: Vec<String>,
    cursor_x: usize,
    cursor_y: usize,
    screen_width: usize,
    screen_height: usize,
}

impl Editor {
    fn draw_screen(&self) {
        print!("{}{}", clear::All, cursor::Goto(1, 1));

        for (i, line) in self.buffer.iter().enumerate() {
            if i >= self.screen_height - 1 { break; }
            println!("{}\r", line);
        }

        print!("{}", cursor::Goto(
            (self.cursor_x + 1) as u16,
            (self.cursor_y + 1) as u16
        ));
    }
}

The Tau Manifesto - Mathematical Philosophy

The Tau Manifesto argues for using τ (tau) = 2π instead of π as the fundamental circle constant:

Core Arguments for Tau:

Geometric Intuition:

  • Full circle: τ radians = 1 full rotation (360°)
  • Half circle: τ/2 radians = half rotation (180°)
  • Quarter circle: τ/4 radians = quarter rotation (90°)
  • Eighth circle: τ/8 radians = eighth rotation (45°)

Mathematical Simplification:

Traditional with π:
- Circle area: A = πr²
- Circle circumference: C = 2πr
- Radians in full circle: 2π

With τ = 2π:
- Circle area: A = (τ/2)r²
- Circle circumference: C = τr
- Radians in full circle: τ

Educational Benefits:

  • Students naturally think in terms of full rotations
  • Trigonometric identities become more intuitive
  • Unit circle relationships are clearer

Examples of Tau Clarity:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import math

# Traditional approach
angle_degrees = 90
angle_radians = angle_degrees * math.pi / 180
# Result: π/2

# With tau
TAU = 2 * math.pi
angle_radians = angle_degrees * TAU / 360
# Result: τ/4 (more intuitive)

# Frequency to angular frequency
frequency = 60  # Hz
omega_traditional = 2 * math.pi * frequency
omega_tau = TAU * frequency  # Cleaner

Practical Implications:

  • Programming languages could adopt tau constants
  • Engineering calculations become more intuitive
  • Educational materials could be simplified
  • Scientific notation could be cleaner

TypeLit - Typing Practice with Literature

TypeLit.io provides typing practice using passages from classic literature:

Features:

  • Classic texts: Practice with works from Dickens, Austen, Shakespeare
  • Proper punctuation: Learn to type complex sentences with correct punctuation
  • Progress tracking: Monitor words per minute and accuracy
  • Literature exposure: Encounter great writing while improving typing skills

Benefits for Programmers:

  • Symbol familiarity: Practice with punctuation used in code
  • Accuracy improvement: Develop muscle memory for precise character entry
  • Speed development: Increase coding velocity through better typing
  • Cultural literacy: Exposure to classical literature

Implementation Concept:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Simplified typing practice implementation
class TypingPractice {
  constructor(text) {
    this.text = text;
    this.position = 0;
    this.errors = 0;
    this.startTime = null;
  }

  handleKeypress(key) {
    if (!this.startTime) this.startTime = Date.now();

    if (key === this.text[this.position]) {
      this.position++;
      return { correct: true, progress: this.position / this.text.length };
    } else {
      this.errors++;
      return { correct: false, expected: this.text[this.position] };
    }
  }

  getStats() {
    const timeMinutes = (Date.now() - this.startTime) / 60000;
    const wordsTyped = this.position / 5; // Standard: 5 characters = 1 word
    const wpm = wordsTyped / timeMinutes;
    const accuracy = ((this.position - this.errors) / this.position) * 100;

    return { wpm, accuracy, errors: this.errors };
  }
}

These discoveries highlight the intersection of practical programming skills, mathematical thinking, and continuous learning - all essential elements for effective software development.