2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-17 09:25:32 +00:00
Commit Graph

499 Commits

Author SHA1 Message Date
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
Dmitry Non
246adf89fc [emacs] move dired to new file 2019-10-15 10:19:32 +01:00
Dmitry Non
6ae4d1ad45 [emacs] move telnet to new file 2019-10-15 10:17:30 +01:00
Dmitriy Non
6083bca0a8
[ruby][case] Add a note about ===
A bit advanced but required knowledge about the magic in `case`
2019-10-15 10:03:35 +01:00
Dmitriy Non
10313bda28
add note on ruby -l switch
Quite a useful switch for one-liners
2019-10-15 09:55:32 +01:00
Igor Chubin
ed061663ba
Merge pull request #71 from lucis-fluxum/python3-args-kwargs
*args, **kwargs for python
2019-10-04 16:30:31 +02:00
Igor Chubin
fec7314c85
Merge pull request #72 from lucis-fluxum/python3-super
Superclass __init__ and parameters in python
2019-10-04 16:30:16 +02:00
Igor Chubin
4752f11b4c
Merge pull request #70 from lucis-fluxum/python3-threads
Basic multithreading for python
2019-10-04 16:29:57 +02:00
Igor Chubin
8e793c7755
Merge pull request #69 from lucis-fluxum/python3-classes
Basic python classes and methods
2019-10-04 16:29:09 +02:00
Igor Chubin
3f52721f6b
Merge pull request #68 from lucis-fluxum/python-list-comprehension
Add python list comprehension sheet
2019-10-04 16:28:56 +02:00
Luc Street
83e59ad722 Mention use of splat operator to unpack arguments 2019-10-02 15:58:12 -07:00
Luc Street
d03c115396 Basic multithreading for python 2019-10-02 15:50:54 -07:00
Luc Street
d1e103ad15 Superclass __init__ and parameters in python 2019-10-02 15:34:49 -07:00
Luc Street
e25ea979f5 *args, **kwargs for python 2019-10-02 15:24:05 -07:00
Luc Street
5a81bc7c1d Basic python classes and methods 2019-10-02 15:17:02 -07:00
Luc Street
8b04830b56 Add python list comprehension sheet 2019-10-02 14:55:26 -07:00
Igor Chubin
9c2ace4582
Merge pull request #67 from dayne/patch-2
Create dcfldd
2019-09-26 10:26:23 +02:00
Dayne Broderson
7f9c0b04dc
Create dcfldd 2019-09-25 10:36:52 -08:00
Igor Chubin
e7b4520639
Merge pull request #66 from abitrolly/patch-1
Cheat sheet for PostgreSQL
2019-09-15 20:23:55 +02:00
Anatoli Babenia
57156de1a3
Cheat sheet for PostgreSQL 2019-09-11 13:45:58 +03:00
Igor Chubin
a0b2c9e20c
Merge pull request #65 from sullivant/master
synced cargo and _rust/Cargo
2019-08-19 08:16:15 +03:00
Thomas Sullivan
a0a7ced9b4 synced cargo and _rust/Cargo 2019-08-06 08:28:53 -05:00
Igor Chubin
a21c2c2fdf
Merge pull request #61 from mwl/patch-1
Wildcards (`*`) should always be in single quotes
2019-08-06 13:58:36 +02:00
Igor Chubin
9be9095dea
Merge pull request #63 from sullivant/rust
Added page for Cargo package manager.
2019-08-06 13:57:21 +02:00