From 907c3cad096e0d234a711375a41a27f1901bc06c Mon Sep 17 00:00:00 2001 From: terminalforlife Date: Thu, 15 Oct 2020 18:29:27 +0100 Subject: [PATCH] Clear ALL trailing whitespaces in sheets dir Recursively. --- sheets/_cpp/arrays | 4 ++-- sheets/_cpp/if | 22 +++++++++++----------- sheets/_cpp/loops | 18 +++++++++--------- sheets/_cpp/types | 26 +++++++++++++------------- sheets/_cpp/vector | 10 +++++----- sheets/_go/Operators | 6 +++--- sheets/_go/Structs | 6 +++--- sheets/_go/packages | 4 ++-- sheets/_js/weirdness | 4 ++-- sheets/_lua/hello | 6 +++--- sheets/_python/recursion | 24 ++++++++++++------------ sheets/_rust/async | 2 +- sheets/_rust/hello | 4 ++-- sheets/_scala/ControlStructures | 4 ++-- sheets/_scala/Functions | 8 ++++---- sheets/_theory/recursion | 10 +++++----- sheets/cpp | 6 +++--- sheets/dumpe2fs | 14 +++++++------- sheets/elm | 4 ++-- sheets/emacs | 12 ++++++------ sheets/ipython | 4 ++-- sheets/jq | 4 ++-- sheets/jshint | 4 ++-- sheets/lame | 10 +++++----- sheets/pg_top | 4 ++-- sheets/ranlib | 4 ++-- sheets/slsc | 10 +++++----- sheets/tmate | 4 ++-- sheets/tmux | 8 ++++---- 29 files changed, 123 insertions(+), 123 deletions(-) diff --git a/sheets/_cpp/arrays b/sheets/_cpp/arrays index 4fb7c95..e2a6a88 100644 --- a/sheets/_cpp/arrays +++ b/sheets/_cpp/arrays @@ -1,6 +1,6 @@ -// In C++11 you can do the following, but most people use vector instead of arrays +// In C++11 you can do the following, but most people use vector instead of arrays a.size(); // Returns the size of array a -int a[10]; // Declare an int array with length 10. +int a[10]; // Declare an int array with length 10. a[0] = 420; // Set the value 420 to index 0 of array a int b = a[0] // Set variable b to 420 by accessing index 0 of array a. diff --git a/sheets/_cpp/if b/sheets/_cpp/if index 433a4f0..ca3f99b 100644 --- a/sheets/_cpp/if +++ b/sheets/_cpp/if @@ -1,20 +1,20 @@ -int main() { - // Basic +int main() { + // Basic if(x > 0) { - return x; + return x; } - else { - return -x; + else { + return -x; } - // if else - if(x > 0) { - return x; + // if else + if(x > 0) { + return x; } - else if(x == 0) { - return 420; + else if(x == 0) { + return 420; } - else { + else { return -x; } } diff --git a/sheets/_cpp/loops b/sheets/_cpp/loops index ab7c809..1ac3316 100644 --- a/sheets/_cpp/loops +++ b/sheets/_cpp/loops @@ -1,19 +1,19 @@ // There are only 'for', 'while', and 'do while' -// For loop - Outputs "0 1 2 3 4 5 6 7 8 9" +// For loop - Outputs "0 1 2 3 4 5 6 7 8 9" for( int i=0; i<10; i++ ) { - std::cout << i << " "; + std::cout << i << " "; } -// While loop - Outputs "0 1 2 3 4 5 6 7 8 9" -int i = 0; -while( i < 10 ) { +// While loop - Outputs "0 1 2 3 4 5 6 7 8 9" +int i = 0; +while( i < 10 ) { std::cout << i << " "; i++; } -// While loop - Outputs "0 " -int i = 0; -do { - std::cout << i << " "; +// While loop - Outputs "0 " +int i = 0; +do { + std::cout << i << " "; }while( i<0 ); diff --git a/sheets/_cpp/types b/sheets/_cpp/types index 2e814b2..41fcfad 100644 --- a/sheets/_cpp/types +++ b/sheets/_cpp/types @@ -1,21 +1,21 @@ -// ## Built-in Types -bool +// ## Built-in Types +bool -char +char -string +string // Assume signed, prepend unsigned to make it unsigned -short +short -int +int -long +long -// C++ 11 -long long +// C++ 11 +long long -// Floating Points -float -double -long double +// Floating Points +float +double +long double diff --git a/sheets/_cpp/vector b/sheets/_cpp/vector index e80e7ee..e3ef1f6 100644 --- a/sheets/_cpp/vector +++ b/sheets/_cpp/vector @@ -1,10 +1,10 @@ // Vectors are sequence containers representing arrays that can change in size. -// Library to include -#include +// Library to include +#include vector a; // Declare an empty vector, a. -a.push_back(1); // Appends/Adds an element whose value is 1 to vector a. -std::cout << a.at(0) << std::endl; // Accessing index 0 of vector a. +a.push_back(1); // Appends/Adds an element whose value is 1 to vector a. +std::cout << a.at(0) << std::endl; // Accessing index 0 of vector a. a.size(); // Returns the size of the vector -a.at(0) = 420; // Changing the value at index 0 to 420. +a.at(0) = 420; // Changing the value at index 0 to 420. diff --git a/sheets/_go/Operators b/sheets/_go/Operators index 017b23d..2191fb7 100644 --- a/sheets/_go/Operators +++ b/sheets/_go/Operators @@ -12,7 +12,7 @@ // |`&^` |bit clear (and not)| // |`<<` |left shift | // |`>>` |right shift| -// +// // ### Comparison // |Operator|Description| // |--------|-----------| @@ -22,14 +22,14 @@ // |`<=` |less than or equal| // |`>` |greater than| // |`>=` |greater than or equal| -// +// // ### Logical // |Operator|Description| // |--------|-----------| // |`&&` |logical and| // |`||` |logical or | // |`!` |logical not| -// +// // ### Other // |Operator|Description| // |--------|-----------| diff --git a/sheets/_go/Structs b/sheets/_go/Structs index d26b6d0..78215c2 100644 --- a/sheets/_go/Structs +++ b/sheets/_go/Structs @@ -1,5 +1,5 @@ // There are no classes, only structs. Structs can have methods. -// A struct is a type. It's also a collection of fields +// A struct is a type. It's also a collection of fields // Declaration type Vertex struct { @@ -8,7 +8,7 @@ type Vertex struct { // Creating var v = Vertex{1, 2} -var v = Vertex{X: 1, Y: 2} // Creates a struct by defining values with keys +var v = Vertex{X: 1, Y: 2} // Creates a struct by defining values with keys var v = []Vertex{{1,2},{5,2},{5,5}} // Initialize a slice of structs // Accessing members @@ -31,7 +31,7 @@ func (v *Vertex) add(n float64) { v.Y += n } -// **Anonymous structs:** +// **Anonymous structs:** // Cheaper and safer than using `map[string]interface{}`. point := struct { X, Y int diff --git a/sheets/_go/packages b/sheets/_go/packages index b6747a8..679ceb7 100644 --- a/sheets/_go/packages +++ b/sheets/_go/packages @@ -1,8 +1,8 @@ -// ## Packages +// ## Packages // * Package declaration at top of every source file // * Executables are in package `main` // * Convention: package name == last name of import path (import path `math/rand` => package `rand`) // * Upper case identifier: exported (visible from other packages) -// * Lower case identifier: private (not visible from other packages) +// * Lower case identifier: private (not visible from other packages) diff --git a/sheets/_js/weirdness b/sheets/_js/weirdness index 45ebd9d..07b20bd 100644 --- a/sheets/_js/weirdness +++ b/sheets/_js/weirdness @@ -1,5 +1,5 @@ // Nothing is weird here, if you think a little bit more about it -// but it seems to be +// but it seems to be // Null is an Object typeof null // => 'object' @@ -22,7 +22,7 @@ new Array() == false // -> true // big integer numbers 9999999999999999 // -> 10000000000000000 -// +// []+[] // -> "" []+{} // -> "[object Object]" {}+[] // -> "{}+[]" diff --git a/sheets/_lua/hello b/sheets/_lua/hello index 6afb412..614763d 100644 --- a/sheets/_lua/hello +++ b/sheets/_lua/hello @@ -1,11 +1,11 @@ --- to install: +-- to install: -- (Debian/Ubuntu) apt-get install lua -- (Fedora/CentOS) yum install lua --- (source code) curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz | tar xz - +-- (source code) curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz | tar xz - -- cd lua-5.3.4 -- make linux -- --- to execute: +-- to execute: -- lua hello.lua io.write("Hello world, from ",_VERSION,"!\n") diff --git a/sheets/_python/recursion b/sheets/_python/recursion index 1f0f9a0..cdbc342 100644 --- a/sheets/_python/recursion +++ b/sheets/_python/recursion @@ -1,15 +1,15 @@ -# For what Recursion is, please check theory/recursion +# For what Recursion is, please check theory/recursion -# Simple Factorial Python Recursion -def factorial(n) : - if n == 0 : - return 1 - else : +# Simple Factorial Python Recursion +def factorial(n) : + if n == 0 : + return 1 + else : return n * factorial(n-1) -# Simple Greatest Common Divisor Recursion -def gcd(x, y) : - if y == 0 : - return x - else : - return gcd(y, x%y) +# Simple Greatest Common Divisor Recursion +def gcd(x, y) : + if y == 0 : + return x + else : + return gcd(y, x%y) diff --git a/sheets/_rust/async b/sheets/_rust/async index b4a88a0..38aec6a 100644 --- a/sheets/_rust/async +++ b/sheets/_rust/async @@ -8,7 +8,7 @@ async fn do_work() -> String { ... } fn do_work() -> impl Future { ... } -// To run a future, we can add a package that provides an async runtime, since Rust does +// To run a future, we can add a package that provides an async runtime, since Rust does // not come with one in the standard library. An asynchronous runtime schedules futures // and continuously polls them to completion. Here, we'll use tokio, a mature and // battle-tested library. diff --git a/sheets/_rust/hello b/sheets/_rust/hello index ff84259..8f1d46c 100644 --- a/sheets/_rust/hello +++ b/sheets/_rust/hello @@ -1,6 +1,6 @@ -// to install rust: +// to install rust: // curl https://sh.rustup.rs -sSf | sh -// to compile: +// to compile: // rustc main.rs fn main() { println!("Hello, world!"); diff --git a/sheets/_scala/ControlStructures b/sheets/_scala/ControlStructures index 6e7f43d..b5cbb35 100644 --- a/sheets/_scala/ControlStructures +++ b/sheets/_scala/ControlStructures @@ -3,7 +3,7 @@ if (check) happy else sad // conditional sugar if (check) happy // same as -if (check) happy else () +if (check) happy else () // multiple conditions if (check) happy else if(secondCheck) lessHappy else () @@ -57,7 +57,7 @@ for (i <- 1 until 5) { // recursion // can yield a "java.lang.StackOverflowError" with large lists // this is because each recursive call of the function is waiting for the evaluation of the next -def sum(ints: List[Int]): Int = ints match { +def sum(ints: List[Int]): Int = ints match { case Nil => 0 case x :: tail => x + sum(tail) } diff --git a/sheets/_scala/Functions b/sheets/_scala/Functions index a7d6020..6769872 100644 --- a/sheets/_scala/Functions +++ b/sheets/_scala/Functions @@ -1,7 +1,7 @@ // define function -// GOOD +// GOOD def f(x: Int) = { x*x } -// BAD +// BAD // hidden error: without = it’s a Unit-returning procedure; causes havoc def f(x: Int) { x*x } @@ -21,7 +21,7 @@ def f(x: R) def f(x: => R) // anonymous function -(x:R) => x*x +(x:R) => x*x // anonymous function: underscore is positionally matched arg. (1 to 5).map(_*2) // vs. @@ -31,7 +31,7 @@ def f(x: => R) (1 to 5).map( x => x*x ) // anonymous function: bound infix method. Use 2*_ for sanity’s sake instead. -// GOOD +// GOOD (1 to 5).map(2*) // BAD (1 to 5).map(*2) diff --git a/sheets/_theory/recursion b/sheets/_theory/recursion index 68fe022..62d05da 100644 --- a/sheets/_theory/recursion +++ b/sheets/_theory/recursion @@ -1,11 +1,11 @@ -# Recursion +# Recursion # Def: "...is a method where the solution to a problem depends on solutions to smaller instance of the same problem.." - wiki -# TL;DR: a function that calls itself inside its body. +# TL;DR: a function that calls itself inside its body. -# Recursive programs - Pseduocode -function factorial: +# Recursive programs - Pseduocode +function factorial: input: integer n such that n >= 0 output: n * (n-1) * (n-2) * ... * 1 = n! - 1. if n is 0, return 1 + 1. if n is 0, return 1 2. else, return ( n * factorial(n-1) ) diff --git a/sheets/cpp b/sheets/cpp index 07ea41d..ec9fb73 100644 --- a/sheets/cpp +++ b/sheets/cpp @@ -1,15 +1,15 @@ # C++ -# +# # C++ is an object-oriented programming language which provides facilities for low-level memory manipulation. # It is widely used by big tech companies, such as, Amazon, Facebook, Google, and SpaceX # # To Compile: g++ my_script.cpp # To Execute: ./a.out # -# See also +# See also # C++ language cheat sheet at /c++/ # list of pages: /c++/:list # learn C++: /c++/:learn # C++ one-liners: /c++/:1line -# C++ weirdness: /c++/weirdness +# C++ weirdness: /c++/weirdness # search in pages: /c++/~keyword diff --git a/sheets/dumpe2fs b/sheets/dumpe2fs index afc5497..8fae7ff 100644 --- a/sheets/dumpe2fs +++ b/sheets/dumpe2fs @@ -5,22 +5,22 @@ dumpe2fs /dev/sdb1 | less # Print the blocks which are reserved as bad in the filesystem -dumpe2fs -b /dev/sda2 +dumpe2fs -b /dev/sda2 # Use the block superblock when examining the filesystem -dumpe2fs -o superblock=superblock /dev/sda1 +dumpe2fs -o superblock=superblock /dev/sda1 # Use blocks of blocksize bytes when examining the filesystem. -dumpe2fs -o blocksize=blocksize /dev/sda1 +dumpe2fs -o blocksize=blocksize /dev/sda1 # Force dumpe2fs to display a filesystem -dumpe2fs -f /dev/sda1 +dumpe2fs -f /dev/sda1 # Only display the superblock information -dumpe2fs -h +dumpe2fs -h # Display the filesystem data from an image file created by e2image -dumpe2fs -i +dumpe2fs -i # Print the detailed group information block numbers in hexadecimal format -dumpe2fs -x +dumpe2fs -x diff --git a/sheets/elm b/sheets/elm index 5f8a4b5..282c57f 100644 --- a/sheets/elm +++ b/sheets/elm @@ -1,10 +1,10 @@ # Elm -# Domain-specific programming language for declaratively creating web browser-based graphical user interfaces. +# Domain-specific programming language for declaratively creating web browser-based graphical user interfaces. # Start Elm REPL elm repl -# Default compilation +# Default compilation elm make HelloWorld.elm -> index.html # Custom name diff --git a/sheets/emacs b/sheets/emacs index ddc1c3d..cf94aee 100644 --- a/sheets/emacs +++ b/sheets/emacs @@ -52,7 +52,7 @@ C-x u undo previous action M-x revert-buffer RETURN (insert like this) undo all changes since last save - M-x recover-file RETURN + M-x recover-file RETURN Recover text from an autosave-file M-x recover-session RETURN if you edited several files @@ -101,7 +101,7 @@ C-s repeat incremental search M C-r incremental search backwards C-r repeat backwards - M-x query-replace-regexp + M-x query-replace-regexp search and replace # Window-Commands @@ -110,7 +110,7 @@ C-x 0 delete window C-x 1 close all windows except the one the cursors in C-x ^ enlarge window - M-x shrink-window + M-x shrink-window command says it ;-) M C-v scroll other window C-x 4 f find file in other window @@ -176,14 +176,14 @@ C-c C-u go to beginning of this preprocessor statement C-c C-c comment out marked area # More general - M-x outline-minor-mode + M-x outline-minor-mode collapses function definitions in a file to a mere {...} - M-x show-subtree + M-x show-subtree If you are in one of the collapsed functions, this un-collapses it # In order to achieve some of the feats coming up now you have to run etags *.c *.h *.cpp # (or what ever ending you source files have) in the source directory M-. (Meta dot) If you are in a function call, this will take you to it\'s definition - M-x tags-search ENTER + M-x tags-search ENTER Searches through all you etaged M-, (Meta comma) jumps to the next occurence for tags-search M-x tags-query-replace yum. diff --git a/sheets/ipython b/sheets/ipython index a562e5b..888da22 100644 --- a/sheets/ipython +++ b/sheets/ipython @@ -36,7 +36,7 @@ ipython --profile=${profile_name} %logoff %logstate -# (to change directories, manipulate directory stacks, and create directory "bookmarks") +# (to change directories, manipulate directory stacks, and create directory "bookmarks") %cd %pushd %popd @@ -46,7 +46,7 @@ ipython --profile=${profile_name} %reset # Allows you to see any part of your input history -%hist +%hist # Search ("grep") through your history by typing %hist -g somestring diff --git a/sheets/jq b/sheets/jq index 905b4cf..8d657cf 100644 --- a/sheets/jq +++ b/sheets/jq @@ -112,7 +112,7 @@ jq 'unique_by(length)' # Reverse an array jq 'reverse' -# +# # ## jq in shell scripts ## # @@ -128,7 +128,7 @@ jq -n --arg foobaz "$FOOBAZ" '{"foobaz":$foobaz}' export $(jq -r '@sh "FOO=\(.foo) BAZ=\(.baz)"') -# +# # ## Input/output formats ## # diff --git a/sheets/jshint b/sheets/jshint index 785f3eb..25a9d79 100644 --- a/sheets/jshint +++ b/sheets/jshint @@ -1,6 +1,6 @@ # jshint -# -# JSHint is a fork of JSLint. The reasons for the fork is basically that +# +# JSHint is a fork of JSLint. The reasons for the fork is basically that # the author disagrees in some points with Douglas Crockford on JavaScript coding style. # # If you're looking for a very high standard for yourself or team, JSLint (by Doug Crockford) diff --git a/sheets/lame b/sheets/lame index 2db692b..d6d6eed 100644 --- a/sheets/lame +++ b/sheets/lame @@ -4,7 +4,7 @@ lame input.wav output.mp3 # Re-encode existing MP3 to 64 kbps MP3 lame -b 64 original.mp3 new.mp3 -# Encode with variable bitrate (quality=2) +# Encode with variable bitrate (quality=2) # 0 <= quality <= 9 (default = 4). 0 = highest quality lame -V2 original.wav compressed.mp3 @@ -13,11 +13,11 @@ lame -V2 original.wav compressed.mp3 # -m s: save as stereo # -m j: save as joint stereo (exploits inter-channel correlation # more than regular stereo) -# -q 2: quality tweaking: the lower the value, the better the +# -q 2: quality tweaking: the lower the value, the better the # quality, but the slower the algorithm. Default is 5. # -# By default, lame uses constant bit rate (CBR) encoding. -# You can also use average bit rate (ABR) encoding, +# By default, lame uses constant bit rate (CBR) encoding. +# You can also use average bit rate (ABR) encoding, # e.g. for an average bit rate of 123 kbps: lame --abr 123 input.wav output.mp3 @@ -25,4 +25,4 @@ lame --abr 123 input.wav output.mp3 lame -v -b 32 -B 192 input.wav output.mp3 # Recode all wav files in all subdirectories -find . -type d -exec sh -c '(cd {} && for i in *.wav; do lame -h -b 128 "$i" "`basename "$i" .wav`".mp3; done)' ';' +find . -type d -exec sh -c '(cd {} && for i in *.wav; do lame -h -b 128 "$i" "`basename "$i" .wav`".mp3; done)' ';' diff --git a/sheets/pg_top b/sheets/pg_top index b11ab41..0aec970 100644 --- a/sheets/pg_top +++ b/sheets/pg_top @@ -1,5 +1,5 @@ # pg_top -# Display and update information about the top cpu PostgreSQL processes +# Display and update information about the top cpu PostgreSQL processes # connect to port 5432 using user postgres, and database, ask for password pg_top -p 5432 -U postgres -d database -W @@ -15,4 +15,4 @@ pg_top -p 5432 -U postgres -d database -W # Q # Display the currently running query of a backend process # X -# Display user index statistics. +# Display user index statistics. diff --git a/sheets/ranlib b/sheets/ranlib index 8aa0c44..55d45a9 100644 --- a/sheets/ranlib +++ b/sheets/ranlib @@ -1,12 +1,12 @@ # ranlib # # generates an index to the contents of an archive and stores it in the archive. -# The index lists each symbol defined by a member of an archive that is a relocatable object file. +# The index lists each symbol defined by a member of an archive that is a relocatable object file. # This creates an index of the contents of fruits.a and stores the index in fruits.a # This is useful for linking and in case the objects call each other. ranlib fruits.a -# after +# after # ar r fruits.a apple.o orange.o pineapple.o # is called diff --git a/sheets/slsc b/sheets/slsc index 65bb5b2..9c25d80 100644 --- a/sheets/slsc +++ b/sheets/slsc @@ -10,20 +10,20 @@ cd slsc*/ make # Inside slsc: -# +# # / Menu cursor to move, return to select # OR select by first letter # ? Help (for further help see section help below) # First letters of a topic+Enter are enough # Enter to go back -# +# # CTRL+G mark region ends with CTRL+G -# +# # Start a text/Enter in a field: -# +# # < or > to align a text field to left or right # = to enter a number or a formula # TAB to edit the text of a cell # Backspace (<-) do delete the cell content -# +# # The config file is ~/.slscrc diff --git a/sheets/tmate b/sheets/tmate index 117d31f..4c9f317 100644 --- a/sheets/tmate +++ b/sheets/tmate @@ -1,4 +1,4 @@ -# tmate - Instant terminal sharing +# tmate - Instant terminal sharing # tmux fork for screen sharing - https://tmate.io/ tmate @@ -6,7 +6,7 @@ tmate tmate show-messages # Launch tmate in a detached state -tmate -S /tmp/tmate.sock new-session -d +tmate -S /tmp/tmate.sock new-session -d # Blocks until the SSH connection is established tmate -S /tmp/tmate.sock wait tmate-ready diff --git a/sheets/tmux b/sheets/tmux index 8babeae..8aa367b 100644 --- a/sheets/tmux +++ b/sheets/tmux @@ -3,7 +3,7 @@ # https://github.com/tmux/tmux # # toc: -# ~window +# ~window # ~pane # ~misc # ~copymode @@ -25,7 +25,7 @@ tmux attach-session tmux attach-session -t name # windows (tabs) -# --- +# --- # c create window # w list windows # n next window @@ -38,7 +38,7 @@ tmux attach-session -t name # --- # % vertical split # " horizontal split -# +# # → go to the left (right, top, bottom) panel # C-→ resize panel to the left (right, top, bottom) panel # o swap panes @@ -60,7 +60,7 @@ tmux attach-session -t name # copy mode (copymode) # --- -# [ go into copy mode +# [ go into copy mode # ] paste into the current window # # setw -g mode-keys vi # to switch into vi mode