2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
Commit Graph

472 Commits

Author SHA1 Message Date
terminalforlife
187916318f Tweaked comments and added alternative 2019-11-28 17:07:09 +00:00
Igor Chubin
7c88ba98f0 moved _scala/:main to _scala/_info.yaml (fixes #84) 2019-11-28 07:53:32 +00:00
Igor Chubin
ad216096cd
Merge pull request #83 from terminalforlife/master
More of the Same
2019-11-28 08:46:33 +01:00
terminalforlife
0b61d3884e Fetch unique list of uppercase-only variables
Just wrote this because I'm wanting to convert numerous uppercase
variables in lots of shell programs to lowercase, except the initial
letter of a word. Manually, doing this would take forever.

First, however, I need to compile a list of variable names so I know
for what I want to search and replace, then omit certain ones typically
named in all uppercase, like `UID`, `USER`, `HOSTNAME`, etc, which I
will probably do by parsing `env` and various other special parameters
used by Bash.

Fun times.
2019-11-27 16:44:28 +00:00
terminalforlife
0ab091a8cd Add alternative approach to parsing xev 2019-11-27 00:06:45 +00:00
terminalforlife
81711828bc Add more examples using associate array variables 2019-11-26 23:49:20 +00:00
terminalforlife
6e507588ec Prefer grep -[EF] over deprecated [ef]grep 2019-11-26 23:34:52 +00:00
terminalforlife
cd41a3e2ca Add line to list out available sections 2019-11-22 02:05:02 +00:00
terminalforlife
9c6e04b5c0 Add line to list unique DEB sections, using awk 2019-11-22 02:03:22 +00:00
Igor Chubin
d8290aac76
Merge pull request #82 from terminalforlife/master
More Goodies
2019-11-15 10:54:46 +01:00
terminalforlife
c08786cb0e Added alternative syntax for easier reading 2019-11-13 16:29:40 +00:00
terminalforlife
25f4ef1390 Add examples for dpkg-deb 2019-11-13 16:26:10 +00:00
terminalforlife
2c2a1f4fb6 Add file 'dpkg-deb' 2019-11-13 16:20:34 +00:00
terminalforlife
e699f7c298 Add two examples for apt-cache 2019-11-13 16:19:42 +00:00
terminalforlife
a388ee6534 Add file 'apt-cache' 2019-11-13 16:11:17 +00:00
terminalforlife
6955dd2709 Add extra information on source 2019-11-13 16:10:28 +00:00
terminalforlife
b83d187fee Add file 'source', and briefly show its usage 2019-11-13 16:08:03 +00:00
terminalforlife
2e4f7be1b8 Add examples and detailed explanation of umask 2019-11-13 16:04:30 +00:00
terminalforlife
be76804476 Add file 'umask' 2019-11-13 15:46:30 +00:00
terminalforlife
9feb9d7ddf Add a multitude of examples for apt-get 2019-11-13 15:44:46 +00:00
terminalforlife
4a67b1d9ad Add file 'apt-get' 2019-11-13 15:14:04 +00:00
terminalforlife
27c86e12f5 Add a number of examples for udisksctl 2019-11-13 15:11:49 +00:00
terminalforlife
f5ec296286 Add 'udisksctl' file 2019-11-13 14:55:27 +00:00
Igor Chubin
134e596b71
Merge pull request #81 from terminalforlife/master
Additional New Entries, Counters, and Files
2019-11-06 20:42:58 +01:00
terminalforlife
cddd2c0e11 List executable files found in PATH
Many uses for this!

Say you install a large set of updates, so want to cross-check the old
list to the new one, in order to find out which new executables were
installed.

Or, perhaps less obscure, you might this list, without the `-printf`
part, to check their permission and ownership settings.
2019-11-06 17:36:10 +00:00
terminalforlife
a7e9bd13e1 Add 'nl' file and show basic example
Interestingly -- to me, at least, `nl` by default will only number
non-empty lines (coreutils v8.25), whereas `cat` will show all.
2019-11-06 16:34:45 +00:00
terminalforlife
f04907ea0d Add examples and clean up existing ones
The examples given using xargs are so far mostly never or rarely ever
best used or even well used with xargs, such as with find, which is
popular, unfortunately.

My reason for adding counters to some of these examples, is that, as an
educational resource, I believe it's important users understand what is
and is _not_ good practice; this is, at least, how I taught myself.
2019-11-06 16:20:51 +00:00
terminalforlife
76109ca8cd Add 'sed' and give example of in-place changes
The `-i` flag with `sed` means "in-place", if you're curious; the use
thereof allows for making actual changes to the file, not just
superfluously, such as for additional parsing.

The `s///` is a simple substitution, wherein the `s` marks that it's a
substitution, the `/` marks the boundaries*, and the final boundary can
be suffixed with various flags, such as `g`, for global operations, -
and `i`, for case-insensitive operations.

* required, but the slash can switched for something else, if needed, -
such as `|`, which is commonly used for paths. For example:

  `s|/path/to/file|/path/file|`
2019-11-06 15:22:56 +00:00
terminalforlife
8af39f5168 Merge with upstream master 2019-11-06 14:50:38 +00:00
terminalforlife
69bbce3d28 Add vignette and grayscale example
I mostly use this sort of thing to create backgrounds which seem to go
nicely with my terminal theme and layout. Works well on nature images.
2019-11-06 14:47:22 +00:00
terminalforlife
0f22053f54 Fix and clean code and comments
The for loop was problematic for numerous reasons my headache won't
allow me to list. I've optimized it, while hoping to maintain the point
for which it was submitted.

A couple of typos were fixed; nothing major.
2019-11-06 14:23:50 +00:00
Igor Chubin
2a42d6b73d
Merge pull request #79 from terminalforlife/master
A Few Additional Code Lines (Likely More to Come)
2019-11-06 08:45:36 +01:00
Igor Chubin
21739f72f3
Merge pull request #80 from tuffacton/master
sheet for /proc pseudo-directory
2019-11-06 08:43:43 +01:00
Igor Chubin
3bb0fbb1c8
Added missing / 2019-11-06 08:43:26 +01:00
Nic Acton
6530225403
sheet for /proc pseudo-directory
Feel like there's good use. There's a `man proc` so this can do that as well.
2019-11-05 20:46:45 -05:00
terminalforlife
86007dd5db Delete extension-specific files using logic
This was taken from my own notes amassed over several years. Commands
like these are a real time-saver.

A lot of people, I imagine, will probably use `-exec rm {} \+` which is
fine and all, but it's another process you'd have to launch, which
isn't necessary at all, unless you need certain `rm` functionality.
2019-11-06 00:50:46 +00:00
terminalforlife
8e5e9dd0a4 Minor comment cleanup, to keep it consistent 2019-11-06 00:45:05 +00:00
terminalforlife
d69a3c8e3a Very useful when you need to test for certain permissions. I imagine
this would be most useful when dealing with more advanced permission
schemes.
2019-11-06 00:36:07 +00:00
terminalforlife
c12d8e2df2 Show counting lines awk reads from STDIN
This is useful, but not if this is _all_ you're after; in those
cases, you're better off just using `free | wc -l` or similar.

However, there may be times you need to count the number of lines in
order to achieve _other_ things programmed in awk, which would then be
crucial!

For example, you may wish to output text informing the user of how many
log entries were discovered in one or more files given to awk.
2019-11-06 00:28:10 +00:00
terminalforlife
ff4af91485 Access environment variables from within awk.
ENVIRON is a special associative array variable, and LS_COLORS is an
index therein. If you want to see the available variables you could
use, you could execute the trusty `env` command.
2019-11-06 00:18:59 +00:00
terminalforlife
fec416c763 Show using awk without data via STDIN
This is useful for those times you want to just do something in awk, -
on-the-fly, without having to rely on its standard input (STDIN).

It's especially handy when you want to perform floating-point
arithmetic, if you're not a shell like ZSH which does support it.
2019-11-06 00:11:43 +00:00
Igor Chubin
8566d86739
Merge pull request #73 from Nondv/patch-4
add note on ruby -l switch
2019-10-15 16:07:36 +02:00
Igor Chubin
f7f987fd68
Merge pull request #74 from Nondv/patch-5
[ruby][case] Add a note about ===
2019-10-15 16:07:21 +02:00
Igor Chubin
453904eb92
Merge pull request #76 from Nondv/divide-emacs
[emacs] move some info to separate files
2019-10-15 16:06:15 +02:00
Igor Chubin
32e18c603a
Merge pull request #77 from Nondv/patch-1
[ruby] merge if/else with if/elsif/else
2019-10-15 16:06:05 +02:00
Igor Chubin
e5fae9de86
Merge pull request #78 from Nondv/remove-recursion-from-root
delete recursion from root
2019-10-15 16:05:57 +02:00
Dmitry Non
d68cc4281a delete recursion from root
there's theory/recursion for that
2019-10-15 10:51:24 +01:00
Dmitriy Non
32ab01e12a
remove extra empty line 2019-10-15 10:39:34 +01:00
Dmitriy Non
4cabda0a56
[ruby] merge if/else with if/elsif/else
No need to add extra lines to the output. Shorter is better :)
2019-10-15 10:38:24 +01:00
Dmitry Non
0dd42bed00 [emacs] move macros info to new file 2019-10-15 10:21:12 +01:00