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

推荐订阅源

WordPress大学
WordPress大学
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园_首页
D
Docker
S
Security @ Cisco Blogs
K
Kaspersky official blog
爱范儿
爱范儿
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Troy Hunt's Blog
Cloudbric
Cloudbric
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Hacker News
The Hacker News
美团技术团队
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Martin Fowler
Martin Fowler
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tor Project blog
Vercel News
Vercel News
The Cloudflare Blog
G
Google Developers Blog
T
Threat Research - Cisco Blogs
AI
AI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Scott Helme
Scott Helme
S
Schneier on Security
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
S
Securelist
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog

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: Linux Productivity Tools and Rust Ownership Concepts
2020-07-28 · via Stonecharioteer on Tech

Today I explored various Linux productivity tools and deepened my understanding of Rust’s ownership model, discovering how these technologies can enhance both system interaction and programming efficiency.

Linux Desktop Productivity

Volume Control in Xmonad

Adding a Volume Control to xmonad demonstrates how to integrate system volume controls into the xmonad tiling window manager:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
-- xmonad.hs configuration for volume control
import XMonad.Util.EZConfig
import XMonad.Actions.Volume

myKeys =
    [ ("M-<F1>", toggleMute >> return ())
    , ("M-<F2>", lowerVolume 4 >> return ())
    , ("M-<F3>", raiseVolume 4 >> return ())
    ]

main = xmonad $ defaultConfig
    `additionalKeysP` myKeys

-- Alternative using shell commands
volumeKeys =
    [ ("<XF86AudioMute>", spawn "amixer set Master toggle")
    , ("<XF86AudioLowerVolume>", spawn "amixer set Master 5%-")
    , ("<XF86AudioRaiseVolume>", spawn "amixer set Master 5%+")
    ]

Xmonad Volume Control Options

Implementation Approaches:

  • XMonad.Actions.Volume: Pure Haskell solution using ALSA
  • Shell commands: Call amixer or pactl directly
  • Media keys: Bind to standard XF86Audio* keys for laptop compatibility
  • Visual feedback: Integrate with notification systems like dunst

AMD Laptop Performance Tuning

Disabling Turbo Boost on AMD Laptops explains thermal management techniques:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Check current turbo boost status
cat /sys/devices/system/cpu/cpufreq/boost

# Disable turbo boost to reduce heat/improve battery
echo 0 | sudo tee /sys/devices/system/cpu/cpufreq/boost

# Re-enable turbo boost for performance
echo 1 | sudo tee /sys/devices/system/cpu/cpufreq/boost

# Check current CPU frequencies
cat /proc/cpuinfo | grep MHz

# Monitor CPU temperature
sensors

Mouse Gestures with Fusuma

Fusuma for Mouse Gestures in Linux and How to Use Fusuma provide touchpad gesture support:

 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
# ~/.config/fusuma/config.yml
swipe:
  3:
    left:
      command: "xdotool key alt+Right" # Browser forward
    right:
      command: "xdotool key alt+Left" # Browser back
    up:
      command: "xdotool key super" # Show activities
    down:
      command: "xdotool key ctrl+alt+d" # Show desktop
  4:
    left:
      command: "xdotool key ctrl+alt+Right" # Switch workspace
    right:
      command: "xdotool key ctrl+alt+Left" # Switch workspace
    up:
      command: "xdotool key ctrl+alt+Up" # Show all workspaces
    down:
      command: "xdotool key ctrl+alt+Down" # Show current workspace

pinch:
  in:
    command: "xdotool key ctrl+minus" # Zoom out
  out:
    command: "xdotool key ctrl+plus" # Zoom in
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Install fusuma
sudo gem install fusuma

# Add user to input group
sudo gpasswd -a $USER input

# Start fusuma
fusuma

# Run as daemon
fusuma -d

Fusuma Requirements

Fusuma requires:

  • Ruby and gems
  • User in input group
  • Touchpad with multitouch support
  • X11 (doesn’t work with Wayland out of the box)
  • xdotool for generating key events

Rust Ownership and Borrowing

Fundamental Ownership Concepts

Gary Explains: Rust: What is Ownership and Borrowing? breaks down Rust’s memory management system:

 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
// Ownership Rules:
// 1. Each value in Rust has a single owner
// 2. When the owner goes out of scope, the value is dropped
// 3. There can only be one owner at a time

fn ownership_examples() {
    // Basic ownership
    let s1 = String::from("hello");
    let s2 = s1; // s1 is moved to s2, s1 is no longer valid
    // println!("{}", s1); // This would compile error!
    println!("{}", s2); // This works

    // Function ownership
    let s = String::from("world");
    takes_ownership(s); // s is moved into function
    // println!("{}", s); // This would compile error!

    let x = 5;
    makes_copy(x); // x is copied (integers implement Copy trait)
    println!("{}", x); // This still works
}

fn takes_ownership(some_string: String) {
    println!("{}", some_string);
} // some_string goes out of scope and is dropped

fn makes_copy(some_integer: i32) {
    println!("{}", some_integer);
} // some_integer goes out of scope, but nothing special happens

Borrowing and References

 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
// Borrowing allows using values without taking ownership
fn borrowing_examples() {
    let s1 = String::from("hello");

    // Immutable borrow
    let len = calculate_length(&s1);
    println!("The length of '{}' is {}.", s1, len); // s1 still valid

    // Mutable borrow
    let mut s2 = String::from("hello");
    change(&mut s2);
    println!("{}", s2);

    // Borrowing rules demonstration
    let mut s = String::from("hello");

    // Multiple immutable borrows are fine
    let r1 = &s;
    let r2 = &s;
    println!("{} and {}", r1, r2);

    // But can't have mutable borrow while immutable borrows exist
    // let r3 = &mut s; // This would compile error!

    // After immutable borrows are done, mutable borrow is fine
    let r3 = &mut s;
    println!("{}", r3);
}

fn calculate_length(s: &String) -> usize { // s is a reference to a String
    s.len()
} // s goes out of scope, but because it doesn't have ownership, nothing is dropped

fn change(some_string: &mut String) {
    some_string.push_str(", world");
}

Practical Ownership Patterns

 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
50
51
52
53
54
55
56
// Common patterns for working with ownership

// 1. Returning ownership from functions
fn create_string() -> String {
    let s = String::from("hello");
    s // Return moves ownership to caller
}

// 2. Taking and returning ownership
fn process_string(s: String) -> String {
    // Process the string
    format!("{} processed", s)
}

// 3. Borrowing for read-only operations
fn read_string(s: &String) -> usize {
    s.len() // Just reading, no ownership needed
}

// 4. Mutable borrowing for modifications
fn modify_string(s: &mut String) {
    s.push_str(" modified");
}

// 5. Clone when you need independent copies
fn clone_example() {
    let s1 = String::from("hello");
    let s2 = s1.clone(); // Explicit clone

    println!("{} {}", s1, s2); // Both are valid
}

// 6. Using lifetimes with references
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
    if x.len() > y.len() {
        x
    } else {
        y
    }
}

// 7. Struct with borrowed data
struct ImportantExcerpt<'a> {
    part: &'a str,
}

impl<'a> ImportantExcerpt<'a> {
    fn level(&self) -> i32 {
        3
    }

    fn announce_and_return_part(&self, announcement: &str) -> &str {
        println!("Attention please: {}", announcement);
        self.part
    }
}

Memory Safety Benefits

Rust’s Ownership System Prevents:

  • Use after free: References can’t outlive their data
  • Double free: Each value has exactly one owner
  • Memory leaks: Values are automatically cleaned up
  • Data races: Mutable references are exclusive
  • Iterator invalidation: Borrowed data can’t be modified

Ghosd for Transparent Notifications

Ghosd - Transparent System Notifications provides lightweight OSD notifications:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Simple notification
echo "Volume: 50%" | ghosd

# With positioning
ghosd --position=top --timeout=2000 << EOF
System Update Available
Click to install
EOF

# Integration with volume control
amixer set Master 5%+ | grep -o '[0-9]*%' | ghosd --position=center

Personal Development Insights

The 4 Rules for Getting Better

4 Rules to Getting Better provides a framework for self-improvement:

Rules for Personal Growth

  1. No more zero days - Do something every day toward your goal, however small
  2. Be grateful to the 3 yous - Past you (for setting you up), present you (for doing the work), future you (for the results)
  3. Forgive yourself - Mistakes happen, learn and move forward
  4. Exercise and books - Physical and mental health are foundational
 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
50
51
52
53
# Implementation of "no zero days" tracking
from datetime import datetime, timedelta
import json

class ProgressTracker:
    def __init__(self, goal: str):
        self.goal = goal
        self.entries = []

    def log_progress(self, description: str, time_spent: int = 0):
        """Log daily progress, no matter how small"""
        entry = {
            'date': datetime.now().isoformat(),
            'description': description,
            'time_spent_minutes': time_spent
        }
        self.entries.append(entry)
        print(f"✓ Progress logged: {description}")

    def get_streak(self) -> int:
        """Calculate current streak of non-zero days"""
        if not self.entries:
            return 0

        today = datetime.now().date()
        streak = 0

        for i in range(len(self.entries) - 1, -1, -1):
            entry_date = datetime.fromisoformat(self.entries[i]['date']).date()
            expected_date = today - timedelta(days=streak)

            if entry_date == expected_date:
                streak += 1
            else:
                break

        return streak

    def summary(self):
        """Show progress summary"""
        total_time = sum(entry['time_spent_minutes'] for entry in self.entries)
        streak = self.get_streak()

        print(f"Goal: {self.goal}")
        print(f"Total entries: {len(self.entries)}")
        print(f"Total time: {total_time} minutes")
        print(f"Current streak: {streak} days")

# Usage example
tracker = ProgressTracker("Learn Rust")
tracker.log_progress("Read about ownership and borrowing", 30)
tracker.log_progress("Completed 3 exercises on ownership", 45)
tracker.summary()

Key Takeaways

Linux Productivity Integration

The tools explored today demonstrate how Linux environments can be customized for enhanced productivity:

  • Window Manager Integration: Custom key bindings for system controls
  • Hardware Optimization: CPU tuning for performance vs battery life balance
  • Input Enhancement: Gesture controls for natural interaction
  • Notification Systems: Lightweight feedback mechanisms

Rust’s Safety Through Constraints

Rust’s ownership system illustrates how programming language constraints can enhance safety:

Ownership Design Philosophy

Rust’s Approach:

  • Make memory safety issues compile-time errors rather than runtime bugs
  • Zero-cost abstractions - safety without performance penalty
  • Explicit control over memory layout and lifetime
  • Prevent entire classes of common programming errors

Personal Development Framework

The “4 Rules” approach provides a systematic method for consistent improvement:

  • Consistency over intensity - Small daily actions compound
  • Self-compassion - Guilt and shame are counterproductive
  • Holistic health - Physical and mental wellness support each other
  • Gratitude practice - Acknowledge progress and effort

This combination of system optimization, programming safety, and personal development reflects the interconnected nature of technical and personal growth in software development.


Today’s exploration reinforced that effective development environments, safe programming languages, and sustainable personal practices all share common principles: they provide structure that enables creativity while preventing common pitfalls.