This file contains hidden or 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
| #!/bin/bash | |
| # navigate to downloads run `sudo bash ~/path/to/updiscord.sh discord-0.0.xx.tar.gz | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: $0 <discord-file-path>" | |
| exit 1 | |
| fi | |
| discord_file_path=$1 | |
| install_path="/lib64/Discord" |
This file contains hidden or 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
| from time import sleep | |
| import requests | |
| url = "https://www.google.com/" | |
| timeout = 5 | |
| while True: | |
| try: | |
| request = requests.get(url, timeout=timeout) | |
| print("Connected to Internet!") |
This file contains hidden or 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
| git remote rm origin | |
| git remote add origin <INSERT URL/ DIRECTORY HERE> | |
| git config master.remote origin | |
| git config master.merge refs/heads/master | |
| git remote show origin |
This file contains hidden or 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
| // The following is useful when impl a trait on multiple types such as all the integer types etc. | |
| macro_rules! impl_multiple { | |
| // standard implementation with no internal code | |
| ($trait:ident for $($type:ty)*) => { | |
| $( | |
| impl $trait for $type {} | |
| )* | |
| }; |
This file contains hidden or 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
| struct Shoe { | |
| size: u32, | |
| style: String, | |
| } | |
| fn shoes_in_my_size(shoes: Vec<Shoe>, shoe_size:u32) -> Vec<Shoe> { | |
| shoes.into_iter().filter(|s| s.size == shoe_size).collect() | |
| // explanation: | |
| // shoes is a vector.. into_iter() yields an iterator depending on the context similar to .iter() |
This file contains hidden or 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 printv<T>(vector: &[T]) | |
| where T: std::fmt::Display | |
| { | |
| for i in vector.iter() { | |
| println!("{} ", i) | |
| } | |
| } | |
| fn printvi<T>(vector: &[T]) | |
| where T: std::fmt::Display |
This file contains hidden or 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
| import PySimpleGUI as sg | |
| sg.theme("DarkBlue") | |
| def deflection(l, e, i, w): | |
| d = 5 / 384 * w * l**4 / e / i | |
| return f'{d:0.3f}' | |
| def main(): |