When a key combination is displayed, the modifiers are written in the order presented here. For example, Control + Option + Shift + Command + Q would be written as ⌃⌥⇧⌘Q.
| Sym | Key | Alt |
|---|---|---|
| ⌃ | Control | |
| ⌥ | Option |
Yes, I know—yet another attempt at bringing a ternary-like experience to Go. But hey, Go doesn’t have one, and I wasn’t around when the last million were written.
Because Go doesn't have a ternary operator, and according to the official FAQ, it likely never will. The reasoning? To prevent developers from writing "impenetrably complex expressions." But let's be real—poor coding practices exist in all forms. Instead of outright banning a useful construct, wouldn’t compiler warnings for overly complicated ternary expressions have been a more reasonable approach?
Since that's not happening, here’s go-ternary—because sometimes, a one-liner is just nicer than an if-else.
| package main | |
| import ( | |
| "exec" | |
| "log" | |
| "os" | |
| ) | |
| func main() { | |
| file, err := os.Open("/dev/tun0", os.O_RDWR, 0) |
| package main | |
| import ( | |
| "log" | |
| "os" | |
| "os/exec" | |
| "syscall" | |
| "unsafe" | |
| ) |
On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that gives developers lossless compression. This package is commonly used for compressing release tarballs, software packages, kernel images, and initramfs images. It is very widely distributed, statistically your average Linux or macOS system will have it installed for
| # When i was faced with this warning in lvm when i run lvm command it works but it took | |
| # WARNING: Device /dev/dm-20 not initialized in udev database even after waiting 10000000 microseconds. | |
| # It look my problem is solved by reloading udev rules without reboot with this command: | |
| udevadm control --reload-rules && udevadm trigger |
| use std::str; | |
| fn main() { | |
| // -- FROM: vec of chars -- | |
| let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; | |
| // to String | |
| let string1: String = src1.iter().collect::<String>(); | |
| // to str | |
| let str1: &str = &src1.iter().collect::<String>(); | |
| // to vec of byte |
| // ConsoleHandler formats slog.Logger output in console format, a bit similar with Uber's zap ConsoleEncoder | |
| // The log format is designed to be human-readable. | |
| // | |
| // Performance can definitely be improved, however it's not in my priority as | |
| // this should only be used in development environment. | |
| // | |
| // e.g. log output: | |
| // 2022-11-24T11:40:20+08:00 DEBUG ./main.go:162 Debug message {"hello":"world","!BADKEY":"bad kv"} | |
| // 2022-11-24T11:40:20+08:00 INFO ./main.go:167 Info message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}} | |
| // 2022-11-24T11:40:20+08:00 WARN ./main.go:168 Warn message {"with_key_1":"with_value_1","group_1":{"with_key_2":"with_value_2","hello":"world"}} |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "log" | |
| "net/http" | |
| "os" | |
| ) |