This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* signed int addition overflow test | |
* exit(EXIT_FAILURE) if result overflows | |
* print the correct value if everything is good. | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int add(int x, int y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::{Read, stdin}; | |
/* | |
return: Some(char) on success, None on EOF or error. | |
*/ | |
fn read_char() -> Option<char> { | |
stdin().bytes().next().and_then(|res| res.ok()).map(|c| { | |
char::from(c) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Put it in the file '$home /. Cargo / config' | |
[source.crates-io] | |
registry = "https://github.com/rust-lang/crates.io-index" | |
#Replace it with your preferred mirror source | |
replace-with = 'sjtu' | |
#replace-with = 'ustc' | |
#Tsinghua University | |
[source.tuna] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# execute the following script in your terminal | |
echo "set -sg escape-time 0" >> ~/.tmux.conf | |
tmux source-file ~/.tmux.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REGEDIT4 | |
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink] | |
"Arial"="wqy-microhei.ttc" | |
"Arial Black"="wqy-microhei.ttc" | |
"Arial CE,238"="wqy-microhei.ttc" | |
"Arial CYR,204"="wqy-microhei.ttc" | |
"Arial Greek,161"="wqy-microhei.ttc" | |
"Arial TUR,162"="wqy-microhei.ttc" | |
"Courier New"="wqy-microhei.ttc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn map_using_if<T, U, F>(s: Option<T>, f: F) -> Option<U> | |
where | |
F: FnOnce(T) -> U, | |
{ | |
if let Some(item) = s { | |
Some(f(item)) | |
} else { | |
None | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello World!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ neofetch | |
_,met$$$$$gg. steve@debian | |
,g$$$$$$$$$$$$$$$P. ------------ | |
,g$$P" """Y$$.". OS: Debian GNU/Linux 12 (bookworm) x86_64 | |
,$$P' `$$$. Kernel: 6.1.0-15-amd64 | |
',$$P ,ggs. `$$b: Uptime: 1 day, 5 hours, 34 mins | |
`d$$' ,$P"' . $$$ Packages: 1807 (dpkg), 22 (flatpak) | |
$$P d$' , $$P Shell: zsh 5.9 | |
$$: $$. - ,d$$' Resolution: 3440x1440 | |
$$; Y$b._ _,d$P' DE: GNOME 43.9 |