Skip to content

Instantly share code, notes, and snippets.

View simonholm's full-sized avatar
:octocat:

Simon Holm simonholm

:octocat:
View GitHub Profile
@simonholm
simonholm / md_the_escape_artist.md
Last active May 8, 2021 05:07
note to self, escape pound sign in markdown, and line brake, you supposed to use html brake instead of backslash
@simonholm
simonholm / test.md
Last active May 23, 2021 06:36
testing comments, fail

# solution fails
[//]: # (This syntax works like a comment, and won't appear in any output.)

@simonholm
simonholm / pretty_path_output.sh
Last active November 10, 2021 00:15
note to self, formatting $PATH output nicely by row
echo "${PATH//:/$'\n'}"
# HT 2 https://askubuntu.com/a/600028/610990
# other way to display PATH sed, tr etc https://askubuntu.com/a/600019/610990
@simonholm
simonholm / gpufetch.sh
Created April 14, 2021 05:47
note to self, gpufetch, ht itsfoss.com
git clone https://github.com/Dr-Noob/cpufetch
cd gpufetch
make
#HT https://itsfoss.com/cpufetch/
@simonholm
simonholm / path_manually.sh
Created April 11, 2021 06:03
note to self, rustlang, add rust path manually instead of restart terminal
# add rust path manually without restart terminal
source $HOME/.cargo/env
# alternatively adding following line to ~/.bash_profile
$ export PATH="$HOME/.cargo/bin:$PATH"
# HT https://www.tutorialspoint.com/rust/rust_environment_setup.htm
@simonholm
simonholm / foo.sh
Last active April 11, 2021 06:05
note to self, alias, start powershell in WSL shell, to reboot/stop Windows
alias reboot='powershell.exe -command reboot-computer'
# my own take change the alias reboot and add force
alias restart='powershell.exe -command restart-computer -f'
alias stop='powershell.exe -command stop-computer -f'
alias reboot='runas.exe /noprofile /user:Administrator "powershell.exe -command reboot-computer"'
# HT https://github.com/microsoft/WSL/issues/2533#issuecomment-392600654
@simonholm
simonholm / import_appx.ps1
Last active March 18, 2021 21:18
import appx in powershell 7
# make appx work in powershell 7
Import-Module -Name Appx -UseWIndowsPowershell
@simonholm
simonholm / enum3.rs
Created March 5, 2021 05:13
to pass, change in the unit test, according to the rust compiler
enum Message {
ChangeColor(u8, u8, u8),
Echo(String),
Move { x: u8, y: u8 },
Quit,
}
struct Point {
@simonholm
simonholm / enums3_compile_error.rs
Created March 1, 2021 21:57
rustlings compiler error enums3
! Compiling of exercises/enums/enums3.rs failed! Please try again. Here's the output:
error[E0423]: expected function, tuple struct or tuple variant, found struct variant `Message::Move`
--> exercises/enums/enums3.rs:67:23
|
9 | Move { x: u8, y: u8 },
| --------------------- `Message::Move` defined here
...
67 | state.process(Message::Move(Point{ x: 10, y: 15 }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Message::Move { x: val, y: val }`