Compare commits

...

346 Commits

Author SHA1 Message Date
d19f0e1c5d chore: deprecates bin/deps.sh
- Deprecates `bin/deps.sh`. It was rendered obsolete with 217566, and
  the introduction of a `go.mod` file.
- Fixes two minor typos in the buld scripts.
- Bumps the version to `3.0.1`.
2019-10-27 10:26:24 -04:00
0f9861f825 Merge branch 'gomod' of github.com:dawidd6/cheat into dawidd6-gomod 2019-10-27 09:35:13 -04:00
36960fc164 chore: adds license and contributing file 2019-10-26 16:13:46 -04:00
217566efc5 Use Go modules 2019-10-21 12:51:56 +02:00
e5114a3e76 Re-wrote from scratch in Golang
- Re-implemented the project in Golang, and deprecated Python entirely
- Implemented several new, long-requested features
- Refactored cheatsheets into a separate repository
2019-10-20 10:02:28 -04:00
307c4e6ad6 Merge pull request #472 from asamarin/master
Add: sqlite3 - describe table schema
2019-10-16 06:13:40 -04:00
1333703a49 Merge pull request #471 from thezeroalpha/master
ssh-keygen: add commands to print the fingerprint
2019-10-16 06:09:44 -04:00
184c200936 Merge pull request #473 from extend1994/Fix-netstat
Add missing spaces for netstat command comment
2019-10-16 06:06:13 -04:00
Ann
f1837b4c59 Add missing spaces for netstat command comment 2019-10-15 13:58:57 +08:00
77d0f6d9a0 Add: sqlite3 - describe table schema 2019-10-14 09:54:38 +01:00
5b2518b3fe ssh-keygen: add commands to print the fingerprint 2019-09-08 23:32:13 -04:00
60bf61c82f Merge branch 'TomasKorbar-installation-issues' 2019-09-03 12:48:51 -04:00
b1dabec129 Merge pull request #468 from FlorianKempenich/master
Add cheatsheet for `z`
2019-08-28 08:39:47 -04:00
d10290541d Add cheatsheet for z 2019-08-03 13:29:18 +01:00
12e8059025 Edit appdirs site_config_dir function
This change causes site_config_dir function to return
/etc/cheat on linux systems. This is right because most
linux distributions follow FHS where /etc is a directory
which contains system-wide configuration files.
2019-07-24 14:23:46 +02:00
ea07b6ad0e Merge pull request #455 from rengoo/patch-1
Update zip
2019-07-01 18:54:53 -04:00
c50b236b80 Merge pull request #366 from Asta1986/master
improved command to export query result to csv file
2019-07-01 18:53:44 -04:00
42a39449b3 Merge pull request #459 from rafaelbernard/vim-multiple-windows
Add: vim - multiple windows
2019-07-01 18:51:56 -04:00
087a076f74 Merge pull request #462 from santosomar/patch-1
Addition additional nmap options
2019-07-01 18:50:31 -04:00
a15ea7fc3e Merge pull request #433 from shanahanjrs/issue-334-emacs-fix
Emacs sheet now uses the proper prefix
2019-07-01 18:47:24 -04:00
f33e6cd602 Merge pull request #444 from dogsleg/patch-1
Fix typo, action (-I -> -l)
2019-07-01 18:38:57 -04:00
95f648cc2d Merge pull request #456 from jellymann/patch-1
fix: typo in vagrant sheet
2019-07-01 18:33:16 -04:00
0db660347b Merge pull request #463 from sullivant/patch-1
Updated tmux cheat to include swapping windows
2019-07-01 18:32:47 -04:00
432461a075 Updated tmux cheat to include swapping windows
Because I always forget.
2019-06-13 07:36:11 -05:00
93df3b3f20 Update nmap
Added Nmap Scripting Engine Categories
2019-06-02 18:56:31 -04:00
c548ded02d Addition additional nmap options
Added "Port Status Information" and Additional Scan Types
2019-06-02 18:53:03 -04:00
4c12d66546 Add: vim - multiple windows 2019-05-04 20:43:26 -03:00
6ce53370e7 fix: typo in vagrant sheet 2019-04-16 13:50:58 +02:00
bde74c701f Update zip
added command for creating a zip archive from a folder/directory
2019-04-13 20:59:08 +02:00
fdc414ede3 Fix import of appdirs in Configuration class
Import of appdirs without reference to cheat module caused
ModuleNotFoundError
2019-03-21 16:47:51 +01:00
5c23f374e4 Fix action (-I -> -l)
dpkg -I (capital i) is for showing information about a package.
dpkg -l (lowercase l) is for listing packages matching given pattern.

So, here is a fix for the typo.
2019-03-09 10:17:46 +05:00
c1fceb5f0d Merge branch 'installation-issues' of github.com:cheat/cheat into installation-issues 2019-02-13 12:55:30 -05:00
d0faf1a3e3 Included appdirs in project
The prior attempt to resolve #420 and #431 relied on `appdirs` to
determine the appropriate directories into which to install files.
Previously, `setup.py` dynamically attempted to install `appdirs` via
`pip` during installation if necessary.

This attempt to failed on multiple platforms, however, due to
backwards-incompatible `pip` interfaces.

As a workaround, I have now directly included `appdirs` (a small module)
within `cheat` itself. This approach is explicitly supported per the
`appdirs` documentation:

https://pypi.org/project/appdirs/
2019-02-13 12:53:19 -05:00
fdddedb8bd Installation issues
Resolves the following:

- #351 (use of `sudo` when installing)
- #420 (failure to install on Windows)
- #431 (failure to install on MacOS)

Application now relies on `appdirs` module to identify the appropriate
locations for storing configuration and data, both during installation
and runtime.
2019-02-13 12:51:18 -05:00
5487314676 Version bump: 2.5.1 2019-02-13 12:42:58 -05:00
ec360ccddd Merge pull request #435 from roachsinai/master
Expand ~ for 'CHEAT_USER_DIR', 'CHEAT_DEFAULT_DIR' and 'DEFAULT_CHEAT…
2019-02-13 12:40:25 -05:00
bb7dfd1028 Merge pull request #436 from avsej/patch-1
Fix typo in gcc sheet
2019-02-13 12:31:31 -05:00
b348724082 Update gcc 2019-02-13 13:52:33 +00:00
5053f07fd8 Expand ~ for 'CHEAT_USER_DIR', 'CHEAT_DEFAULT_DIR' and 'DEFAULT_CHEAT_DIR'. 2019-02-12 15:16:59 +08:00
f692c8e1d8 Addressing cross-platform installation issues
Attempted to address various cross-platform installation issues:

- Removed all hard-coded references to file-paths, and replaced them
  with paths provided by `appdirs`.

- Removed (erroneously inserted) default file paths which would never be
  checked due to application logic.

- Modified `setup.py` to no longer install a configuration file. The
  mechanics are still in place to **read** a configuration file, but
  after examination, I've concluded that the installation of that file
  is best left to package maintainers rather than `cheat` itself.
2019-02-09 13:27:58 -05:00
89bb9aaf13 Included appdirs in project
The prior attempt to resolve #420 and #431 relied on `appdirs` to
determine the appropriate directories into which to install files.
Previously, `setup.py` dynamically attempted to install `appdirs` via
`pip` during installation if necessary.

This attempt to failed on multiple platforms, however, due to
backwards-incompatible `pip` interfaces.

As a workaround, I have now directly included `appdirs` (a small module)
within `cheat` itself. This approach is explicitly supported per the
`appdirs` documentation:

https://pypi.org/project/appdirs/
2019-02-08 11:21:09 -05:00
574deeabc0 Emacs sheet now uses the proper prefix 2019-02-07 14:16:08 -05:00
482161f8e9 Installation issues
Resolves the following:

- #351 (use of `sudo` when installing)
- #420 (failure to install on Windows)
- #431 (failure to install on MacOS)

Application now relies on `appdirs` module to identify the appropriate
locations for storing configuration and data, both during installation
and runtime.
2019-02-07 13:34:20 -05:00
4dd55105d2 Merge pull request #361 from aroonav/master
Enable starting the cheat python script on windows.
2019-02-06 10:25:29 -05:00
6148d64599 Merge pull request #430 from movd/rename
Update rename
2019-02-05 08:59:06 -05:00
cde8bcaa1d Update rename
Add cheat for mass rename with search and replace
2019-02-05 10:57:43 +01:00
fcb82778e4 * Corrected the logic to execute the cheat script.
* Check VISUAL, CHEAT_EDITOR, EDITOR environment variables before falling
back to wordpad as the default editor.
2019-02-05 12:18:26 +05:30
da92421948 Merge remote-tracking branch 'upstream/master' 2019-02-05 10:14:39 +05:30
d6c7863573 Merge pull request #428 from dufferzafar/patch-2
ssh: Improve SOCKS command
2019-02-04 14:54:52 -05:00
5812bca6b7 ssh: Improve SOCKS command
This doesn't give an SSH shell, but just forwards the ports - which is what one usually requires when setting up a SOCKS proxy.

The -q is to suppress messages etc.
2019-02-04 23:45:16 +05:30
074dba6e99 v2.5.0
`minor` version bump to `2.5.0`.
2019-02-04 12:04:52 -05:00
9d1dd15387 Merge pull request #427 from cheat/issue-349
Issue #349
2019-02-04 11:57:35 -05:00
caf355f142 Issue #349
Implements support for terminals with light backgrounds via a new
`CHEAT_COLORSCHEME` envvar.
2019-02-04 11:56:00 -05:00
2728ce4757 Merge pull request #426 from cheat/vagrant
Updated Vagrantfile
2019-02-04 11:54:06 -05:00
6ae76799f7 Updated Vagrantfile
Modified `Vagrantfile` to build an Ubuntu environment rather than
Alpine, after the latter exhibited weird behavior.
2019-02-04 11:50:25 -05:00
0b523a769f Merge pull request #425 from cheat/vagrant
Added Vagrantfile
2019-02-04 10:41:26 -05:00
f29cf03b68 Added Vagrantfile
Added a `Vagrantfile` which builds an alpine-based environment that can
be used for development and testing.
2019-02-04 10:40:10 -05:00
4347114e19 Merge pull request #424 from JensKorte/patch-1
link changed, added details
2019-02-04 10:05:36 -05:00
edc67e7819 Updated links to README
Re-pathed links from `chrisallenlane/cheat` to `cheat/cheat` as
appropriate, following the move.
2019-02-04 10:03:19 -05:00
aa33a36491 Merge pull request #422 from cheat/refactor
Refactor
2019-02-04 09:58:24 -05:00
8aac10dd8b link changed, added details
The table isn't available any more in the recent wiki page. The new link uses the old version of wikipedia. In my browser I have to "unhide" the box.
2019-02-03 20:56:57 +01:00
9931b78c5f Lint
- Added instruction to lint `setup.py` to `ci/lint.sh`
- Updated `setup.py` per linter suggestions
2019-02-01 15:24:04 -05:00
a37577ee85 Trivial: docstrings
Updated some docstring comments.
2019-02-01 15:18:23 -05:00
3ad923eff0 Refactored (11)
Renamed `CHEAT_DEFAULT_DIR` to `CHEAT_USER_DIR` because the latter more
accurately describes the purpose of the variable.
2019-02-01 15:10:03 -05:00
ba47dc2cbc Refactored (10)
- Added `ci/lint.sh`, which uses `flake8` to lint the relevant files
- Made changes to appease the linter.
- Bugfix in `cheat/configuration` (missing dependency)
2019-02-01 14:44:48 -05:00
df21731c02 Trivial Python style corrections 2019-02-01 11:43:38 -05:00
a657699a24 Refactored (9)
Moved some functionality into the `Util` class.
2019-02-01 11:43:11 -05:00
5793c1845a Refactored (8)
Refactored `Sheet` class:

- Removed unnecessary indirection and extraneous methods
- Renamed some methods to conform to Pythonic conventions
- Renamed the `create_or_edit` method to `edit` to be consistent with
  subcommand name (`--edit`)
2019-02-01 11:23:38 -05:00
e2b5728283 Refactored (7)
Refactored for general code-clarity, with particular focus on removing
needless abstraction within `Sheet` and `Sheets` classes.
2019-01-31 20:03:56 -05:00
d61e4e7c34 Refactored (6)
Standardized (mostly) how the various classes are initialized.
2019-01-31 18:08:19 -05:00
145a81dcd6 Var renames
Replaced more references to deprecated envvar names to their newer
counterparts.
2019-01-31 17:55:26 -05:00
7c4fc54681 Refactored (5)
- Extracted `Colorize` class out of `Util` class. (The latter now only
  contains static methods.)
- Renamed methods in `Colorize` class for improved clarity.
- Refactored as necessary to accommodate the changes above.
2019-01-31 17:43:21 -05:00
878d7e7e1b Refactored (4)
Improved handling of edge-cases in `configuration.py`.
2019-01-31 17:40:53 -05:00
928637c9db Refactored (3)
Removed unnecessary `import` calls.
2019-01-31 17:14:21 -05:00
ab87bb11c4 Refactored (2)
Created an `Editor` class out methods in the `Util` class to enhance
code clarity.
2019-01-31 17:03:21 -05:00
8f757d7735 Refactored (1)
Performed a general refactoring, focusing on the following:

- Removing layers of abstraction in config handling
- Stubbing out proper config validator
- Updating envvar names located throughout the project
2019-01-31 16:45:28 -05:00
c922ef4c8d Version bump: 2.4.2
Contains `termcolor` dependency fix.
2019-01-29 11:45:43 -05:00
574a7ec3c9 Merge pull request #421 from chrisallenlane/termcolor
Added termcolor dependency to setup.py
2019-01-29 11:44:22 -05:00
5ae49228b7 Added termcolor dependency to setup.py
Added a missing `termcolor` dependency to `install_requires` in
`setup.py`. `termcolors` was introduced as an optional dependency when
the `CHEAT_HIGHLIGHT` envvar was implemented.
2019-01-29 11:42:14 -05:00
09acdf1a69 README edits
Updated the names of the (preferred) cheat-related environment
variables, which have been changed in recent versions.
2019-01-29 11:31:03 -05:00
9ea60d12ff Version-bump to 2.4.1
- Includes various bugfixes regarding UTF-8 encoding
- Adds new cheatsheets
2019-01-29 10:58:57 -05:00
f7d747e101 Merge pull request #417 from butzel-net/master
suggestion for socat
2019-01-29 10:22:44 -05:00
3b207b4d51 Merge branch 'dev' 2019-01-29 10:19:48 -05:00
5e1d3abce8 Merge pull request #416 from chrisallenlane/issue-414-build-opts
Issue #414 - snap package compatibility
2019-01-29 10:18:55 -05:00
ad25e16dc6 Merge pull request #415 from chrisallenlane/issue-372
Addressing issue #372
2019-01-29 10:15:55 -05:00
92c07c0137 Merge pull request #419 from chrisallenlane/issue-414-build-opts
Issue #414 - snap package compatibility
2019-01-27 14:50:37 -05:00
7e35263e90 Merge pull request #418 from chrisallenlane/issue-372
Addressing issue #372
2019-01-27 14:45:41 -05:00
1b6b5b79b7 Version bump: 2.4.0
Preparing a new `minor` release.
2019-01-27 14:36:57 -05:00
b377984b59 suggestion for socat
butzel's suggestions for a socat cheatsheet
2019-01-25 12:46:01 +01:00
e319332138 Issue #414 - snap package compatibility
PR #391 changed the locaton into which system-wide cheatsheets are
installed to `/usr/share/cheat`, in order to comply with FHS. However,
this is causing conflicts with the `snap` packaging process.

This commit removes hard-coded references to `/usr/share/cheat` (outside
of `config/cheat`), and instead reads the cheat path via the
`CHEAT_PATH` config value (which may be set either in `cheat/config`, or
exported as an environment variable).

Lastly, this commit makes `setup.py` "aware of" the `CHEAT_PATH` env
var, allowing us to specify to where sytem-wide cheatsheets should be
installed during the `snap` build.
2019-01-21 12:58:03 -05:00
13c0ea7525 Addressing issue #372
Previous pull-requests #406 and #413 attempted to resolve #372. They
were, however, never merged in.

Given that #391 was just merged (which rewrites a significant amount of
prior code), I here took what we learned from #406 and #413 and
re-implemented it. This approach will be less error-prone than
attempting to rebase either of the former on the changes introduced in
 #391.
2019-01-18 14:50:00 -05:00
87448c49fa Merge branch 'TomasKorbar-changes' 2019-01-18 14:28:06 -05:00
80b8cfc06b Add new env variables but hold compatibility with old ones
Legacy environmental variables like CHEATCOLORS are now higher in
configuration hiearchy than new environmental variables in
configuration files
2019-01-18 18:03:15 +01:00
8a8f30679d Fix problems with CHEATCOLORS behaviour 2019-01-17 17:10:01 +01:00
4d19505b79 Conform code to pep8 2019-01-15 19:38:24 +01:00
a2e028fd19 Move validation of CHEAT_HIGHLIGHT value to Configuration class
Method _check_configuration should be used for validating all bad
values from now on
2019-01-15 19:21:33 +01:00
5eec6bf040 Improve handling of settings
Constructors of classes which need direct access to configuration
now take Config class instance as parameter which will give them
better maintainability in the future

CHEAT_HIGHLIGHT has been added to Configuration class
2019-01-15 19:13:30 +01:00
3a4c2a887d Add ConfigurationTestCase
- tests prove descending hiearchy of config system
- env vars, local config file, global config file
2019-01-15 17:09:39 +01:00
879a58b721 Read env vars for global and local config path
- allows to change these paths for testing purposes and also
gives user option to change his config paths
2019-01-15 17:09:39 +01:00
7814de96d2 Add classes for better readability 2019-01-15 17:09:39 +01:00
a651426075 Add reading settings from configuration file 2019-01-15 17:09:35 +01:00
c4c935a6a5 Change default location of cheatsheets 2019-01-15 16:48:07 +01:00
df86142b8e Merge pull request #411 from chrisallenlane/snap-cheatsheet
Created a `snap` cheatsheet
2019-01-11 17:19:08 -05:00
60b05c8781 Created a snap cheatsheet 2019-01-11 17:18:02 -05:00
22b64d2d08 Merge branch 'master' of https://github.com/liuyang1/cheat into liuyang1-master
Resolving merge-conflicts.
2019-01-11 17:00:39 -05:00
1224908445 README edits
Updated the README to mention the new `CHEAT_HIGHLIGHT` environment
variable.
2019-01-11 16:36:17 -05:00
28a2902e20 Implemented validation on CHEAT_HIGHLIGHT
Implemnted an assertion that `CHEAT_HIGHLIGHT` (if set) contains a value
that is acceptible to `termcolors`. This happens only once, upon the
invokation of `__main__`. If the assertion fails, `cheat` terminates
with an exit code of `1`.
2019-01-11 16:26:57 -05:00
730c488854 Introduced CHEAT_HIGHLIGHT
Introduced CHEAT_HIGHLIGHT environment variable to de-couple search-term
highlighting from syntax highlighting.
2019-01-11 16:13:38 -05:00
ba9051e3cd highlight bug-fix
Fixed a bug in `cheat/utils.py` that would cause `highlight` to return
the wrong value when `CHEATCOLORS` was not set.
2019-01-11 15:58:21 -05:00
7c7278ac8b Util logic simplification
- Simplified the logic regarding checking the state of `CHEATCOLORS` in
  `cheat/utils.py`

- Improved the commenting within the same
2019-01-11 15:54:20 -05:00
e1fdca231e Merged #353 with changes
PR #353 implemented highlighting on search terms within search results.
This PR:

- Merges the above
- Makes a few modifications upon the implementation

Specifically, the new implementation no longer relies on hard-coded
escape-sequences. Instead, a new `highlight` function has been created,
which in turn attempts to defer to the `termcolors` library to colorize
the necessary text.
2019-01-11 15:46:54 -05:00
6b796adaf7 README edit
Edited the addition regarding Pygments.
2019-01-11 15:13:41 -05:00
95843e4674 Updating dependencies to highlighting 2019-01-11 15:10:39 -05:00
2b58300d84 Merge pull request #404 from gorshkov/master
Fix url in curl cheatsheet
2019-01-11 14:20:18 -05:00
bf1be86fb9 Merge pull request #402 from FlorianKempenich/master
Add cheatsheet for `scd`
2019-01-11 14:19:22 -05:00
35c4a8d639 Merge pull request #403 from sundar-raman/master
Disable colorized output when CHEATCOLORS is not "true", or not set
2019-01-11 14:13:21 -05:00
6910adae90 Merge branch 'master' of github.com:chrisallenlane/cheat 2019-01-11 14:05:55 -05:00
b47b4bc1d1 Modified .gitignore
Added `.env` to the list of ignored files.
2019-01-11 14:05:38 -05:00
ea7e71b002 Merge pull request #407 from idarlund/patch-2
Update ssh
2019-01-11 14:04:11 -05:00
d576eef13b Merge pull request #408 from idarlund/patch-3
Update scp
2019-01-11 14:03:31 -05:00
bec516b30a Merge pull request #409 from hutchison/master
Fixed a typo.
2019-01-11 14:02:39 -05:00
f0b3f8037b Fixed a typo. 2019-01-09 15:47:49 +01:00
3938032595 Update scp
scp over socks
2019-01-08 08:24:16 +01:00
f35cfa084e Update ssh
added ssh over socks tunnel
2019-01-08 08:19:09 +01:00
cdb22f310d Fix url in curl cheatsheet 2018-12-19 21:11:54 +07:00
6d1eff16a1 Disable colorized output when CHEATCOLORS is not "true", or not set 2018-11-11 13:04:51 +08:00
9241de04d6 Update formatting to adhere to the guideline. 2018-10-25 11:37:39 +01:00
8ac1851a69 Add cheatsheet for scd
`scd` is a fantastic `oh-my-zsh` plugin to quickly jump between directories.
See here: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/scd
2018-10-25 11:34:25 +01:00
cccf37c284 Bumped the patch version number 2018-10-16 10:45:09 -04:00
15f70c2cc3 Merge pull request #401 from tculp/case-insensitive-search
Added a .lower() call to line when searching
2018-10-16 10:43:30 -04:00
cebe3de389 Update sheets.py
Added a missing .lower() to the line
2018-10-15 12:21:52 -04:00
8ec51d3194 v2.3.0
Version-bump to `v2.3.0`.
2018-10-15 10:51:11 -04:00
500dbbbd4a Merge pull request #399 from tculp/case-insensitive-search
Changed search behavior to lower the search term and the lines being …
2018-10-15 10:44:57 -04:00
66ebae4ed5 Merge pull request #398 from ticky/patch-1
Add `tee /dev/tty` mid-pipeline example to tee
2018-10-09 11:22:43 -04:00
5a83a22888 Merge pull request #400 from dufferzafar/patch-1
Update pacman: command to view top recently installed packages
2018-10-09 11:19:47 -04:00
62a2bf3c2d Update pacman 2018-10-01 12:34:46 +05:30
4b6dc22c0a Changed search behavior to lower the search term and the lines being searched, thus providing case-insensitive search 2018-09-20 13:53:22 -04:00
cd46559250 Add tee /dev/tty mid-pipeline example to tee 2018-09-19 17:53:19 -07:00
03fb44159a Merge pull request #394 from davidrea/patch-1
Add strikethrough to formatting
2018-09-17 09:33:35 -04:00
f0bd3ba4e6 Merge pull request #393 from mirekfranc/for-loop-extended
for: add few more for examples, the last two are probably bash specific
2018-09-17 09:32:48 -04:00
72f8c88394 Merge pull request #395 from eterps/patch-1
Added insert/add line examples
2018-09-17 09:31:43 -04:00
2fcc808e63 Added insert/add line examples
Added insert/add line examples.
2018-09-11 09:22:21 +02:00
4aef22f457 Add strikethrough to formatting
(this is the one I always forget!)
2018-09-04 10:13:55 -04:00
146b671412 add few more for examples, the last two are probably bash specific 2018-09-03 15:54:56 +02:00
feab7a9706 Merge pull request #387 from idarlund/patch-1
Update rsync
2018-08-20 12:40:36 -04:00
a5b0132b08 Merge pull request #385 from dsalaj/master
Add cheatsheet slurm
2018-08-20 12:21:10 -04:00
ce1f4a099c Merge pull request #386 from navarroaxel/lsblk
Add cheatsheet for lsblk
2018-08-20 12:16:34 -04:00
0e84cae79e Merge pull request #374 from bu6hunt3r/devel
Added sheet for r2 disassembler/debugger/hex editor
2018-08-20 12:14:16 -04:00
93180c3852 Merge pull request #375 from shigemk2/zip
Added one more zip cheat
2018-08-20 11:50:27 -04:00
795bcaffcb Merge branch 'master' of https://github.com/gigovich/cheat into gigovich-master 2018-08-20 11:40:34 -04:00
d6f12c4397 Merge pull request #373 from kevinawoo/patch-1
new cheat for mv: moving many files into a dir
2018-08-20 11:37:14 -04:00
8ccc8bd546 Merge pull request #388 from pondrejk/patch-1
minor typo in nmcli command name
2018-08-20 10:48:43 -04:00
c29a3dfdc1 Merge pull request #368 from cedric-dufour/master
New Sheet Added: ZFS (on Linux)
2018-08-20 10:45:46 -04:00
7e94f1e0ba Changed mutt cheatsheet 2018-08-16 09:50:47 +02:00
ff1227bca8 minor typo in command name 2018-07-24 10:05:25 +02:00
b0aa272b49 Add cheatsheet for lsblk 2018-07-12 07:03:34 -03:00
130cf1d830 Update rsync
added rsync over ssh cheat
2018-07-11 14:56:55 +02:00
f93ca8f7ce Add cheatsheet slurm 2018-07-04 23:04:18 +02:00
c0fe871b33 fix except case
- when redirect stdout to pipe but not tty, it throw exception.
- when have no content, it throw exception.
- remove reductant newline at end of file
2018-06-13 18:58:37 +08:00
b210fbca5f Changed r2 cheatsheet 2018-06-05 16:25:39 +02:00
45c0dad364 Changed r2 cheatsheet 2018-05-22 09:37:17 +02:00
544d11aebc Add nmcli import example. Fix typos in nmcli add command. 2018-03-12 13:17:22 +03:00
51f7a42ece Started mutt mail client ch-sh 2018-03-09 18:26:10 +01:00
cd6826d5d4 Added one more zip cheat 2018-03-08 20:39:41 +09:00
c09f0b0c6c Added sheet for r2 disassembler/debugger/hex editor 2018-03-04 20:30:27 +01:00
3fe72a03cc new cheat for mv: moving many files into a dir 2018-02-04 18:57:25 -08:00
0c0d924df6 New Sheet Added: ZFS (on Linux) 2017-12-24 16:33:37 +01:00
aa1e12625e Version bump to 2.2.3. 2017-12-19 12:42:07 -05:00
d09353bfca Merge pull request #363 from shigemk2/shigemk2-patch-1
Add cheatsheet perl
2017-12-19 12:38:25 -05:00
81e80c87a1 Merge pull request #358 from byxor/emacs
Add cheat for running emacs in terminal
2017-12-19 12:37:04 -05:00
3d498d5ce7 Merge pull request #354 from rognan/add-cheat-for-youtube-dl-extract-audio
Add cheat for downloading audio with youtube-dl
2017-12-19 12:35:11 -05:00
d90d509702 Merge pull request #365 from shigemk2/check_function_mysql
Add cheatsheet for mysql
2017-12-19 12:34:05 -05:00
b46f5b2c34 Merge pull request #359 from Dgc2002/master
Adds cheatsheet for rcs
2017-12-19 12:33:01 -05:00
e2d63e7603 Minor edits to #357 2017-12-19 12:29:52 -05:00
67f52f8317 Merge branch 'patch-1' of https://github.com/zrongh90/cheat into zrongh90-patch-1 2017-12-19 12:29:26 -05:00
67134b9240 Merge pull request #360 from nitsnatsnok/patch-1
sizes and typo corrected
2017-12-19 12:27:29 -05:00
c67adb1422 Minor edits to #367. 2017-12-19 12:25:40 -05:00
c2aa5e0148 Merge branch 'master' of https://github.com/Sim4n6/cheat into Sim4n6-master 2017-12-19 12:24:19 -05:00
332f0bd4ee Merge pull request #364 from navjotjsingh/master
Cheatsheet for cd
2017-12-19 12:21:37 -05:00
b303bc0028 added support for Got-Your-Back for backup from Gmail 2017-12-14 15:38:08 +00:00
02f79ddd13 Merge pull request #1 from chrisallenlane/master
learning amigo
2017-12-14 16:09:24 +01:00
9c53e2ba10 improved command to export query result to csv file 2017-12-05 15:44:49 -03:00
71680c6586 Add cheatsheet for mysql
check stored procedure or stored function in mysql
2017-11-28 22:12:20 +09:00
a240413eb9 Merge pull request #1 from navjotjsingh/navjotjsingh-patch-cd
Cheatsheet for cd
2017-11-27 11:53:39 +05:30
cde64e3ea4 Cheatsheet for cd 2017-11-27 11:52:05 +05:30
0b0bc441c6 Add cheatsheet perl 2017-11-20 21:20:22 +09:00
2aa37432cb Merge pull request #356 from shigemk2/xargs-no-run-if-empty
Add cheatsheet for xargs --no-run-if-empty
2017-11-19 08:13:07 -05:00
89de3705b0 Merge pull request #355 from shigemk2/curl-only-status-code
Add cheatsheet for cp backup file with date
2017-11-19 08:11:35 -05:00
d12718b8c4 cp edit
Appended missing newline to end of `cp` cheatsheet.
2017-11-19 08:09:37 -05:00
900e083b99 Merge branch 'cp-backup' of git://github.com/shigemk2/cheat into shigemk2-cp-backup 2017-11-19 08:07:10 -05:00
d048ea5a10 Enable starting the cheat python script on windows.
For this add a small batch script in the same directory as the
cheat script.
2017-11-12 18:48:04 +05:30
837e0b5b71 sizes and typo corrected
`-size +20000k` actually matches files bigger than 20,000*1,024=20,480,000 Bytes, not 20,000,000 Bytes as in “2 Megabytes”.
2017-11-12 00:50:30 +01:00
30d2a77a6c Adds cheatsheet for rcs 2017-11-02 11:53:08 -05:00
1a8cdf84f4 Add instructions for running emacs in terminal 2017-11-01 16:16:49 +00:00
181403e7ac create iconv
add new iconv for code convert
2017-10-31 16:00:16 +08:00
2c10955690 Add cheatsheet for xargs --no-run-if-empty 2017-10-27 00:12:36 +09:00
4319b8e699 Add curl cheatsheet: Get only the HTTP status code
curl -o /dev/null -w '%{http_code}\n' -s -I URL
2017-10-24 22:23:36 +09:00
57dff86a44 Add cheat for downloading audio with youtube-dl 2017-10-13 14:37:07 +02:00
761bf2eb2f hightlight the search keywords 2017-10-12 09:25:20 +08:00
aa4f6daf77 Add cheatsheet for cp backup file with date 2017-10-04 23:47:33 +09:00
d7272c50c4 v2.2.2
Added new cheatsheets.
2017-09-16 23:15:15 -04:00
cdf573a725 Merge pull request #318 from shanahanjrs/new-misc-cheatsheets
Created cheatsheets for alias, cat, cp, export, kill, mv, pwd, and wc
2017-09-16 23:01:08 -04:00
eb6dfaad39 Merge pull request #350 from iamatacos/patch-1
Update dd
2017-09-16 22:58:17 -04:00
f8d2ce516e Update dd
There is a small error in this sample :

**bs=BYTES** --> read and write up to BYTES bytes at a time

**count=N** --> copy only N input blocks

just inverse please
2017-09-16 22:04:10 +01:00
e5bf9146fe Fixed cheat sheets to conform to the standard style more closely 2017-09-12 23:11:38 -04:00
d6dc39c687 v2.2.1
Version bump to 2.2.1. (Release contains new default cheatsheets.)
2017-09-05 14:23:10 -04:00
fb5ec798fa CONTRIBUTING.md
Made minor additions to the `CONTRIBUTING.md` file.
2017-09-05 13:48:06 -04:00
866eb68d64 emacs cheatsheet
Minor whitespace edits on the emacs cheatsheet.
2017-09-05 13:26:23 -04:00
e17f60e4d5 Deleted accidental file
Deleted a file that seems to have been created accidentally. (It
contained nothing useful.)
2017-09-05 13:20:36 -04:00
ed2ef113f0 Merge branch 'emacs' of git://github.com/ndebuhr/cheat into ndebuhr-emacs 2017-09-05 13:19:19 -04:00
432379d1e6 Merge pull request #336 from yafp/master
Adding a first version of a pkill cheatsheet
2017-09-04 20:06:23 -04:00
7089bef7cc Merge pull request #337 from VHarisop/pip_latest
Updated pip sheet with upgrade for newer versions
2017-09-04 20:04:25 -04:00
aa57371819 Trivial whitespace changes to pgrep cheatsheet. 2017-09-04 20:01:25 -04:00
921db35400 Merge branch 'pgrep' of git://github.com/shigemk2/cheat into shigemk2-pgrep 2017-09-04 20:00:38 -04:00
852db958a4 Merge branch 'develop' 2017-09-04 19:57:28 -04:00
d58bbba1f8 Merge pull request #333 from npit/master
Update emacs cheatsheet
2017-09-04 19:55:33 -04:00
e5ffcf65e4 Merge pull request #328 from fpob/master
Add zsh cheatsheet
2017-09-04 19:54:49 -04:00
d59ac66f1c Merge pull request #340 from Asta1986/postgres
added psql commands
2017-09-04 19:52:54 -04:00
f4f8592933 Merge pull request #344 from Daoctor/master
fix crontab command
2017-09-04 19:50:45 -04:00
c540a600b2 Merge pull request #343 from Mic92/patch-13
openssl: add fingerprint method
2017-09-04 19:47:49 -04:00
9224216581 Merge pull request #330 from shigemk2/curl-ip
Get your global IP with curl
2017-09-04 19:45:15 -04:00
2da5c2b710 Merge pull request #327 from Mic92/patch-12
add cryptsetup cheatsheat
2017-09-04 19:41:03 -04:00
e468f8d0a0 Merge pull request #323 from henrikq/patch-1
Add install to Cheatsheet/deb
2017-09-04 19:39:58 -04:00
cdee0e44cd Merge pull request #324 from dypublic/tar-add-destination-1
Update tar
2017-09-04 19:38:41 -04:00
efcd687070 fix crontab command 2017-08-30 00:15:53 +08:00
ae309c7dc4 openssl: add fingerprint method 2017-07-30 09:26:56 +01:00
86ba22e7b8 +html output 2017-06-30 21:34:32 -03:00
2a6ec9cef5 added psql commands 2017-06-29 20:23:47 -03:00
2d59026b0d Add f option 2017-06-10 01:43:11 +09:00
bcb0d71dd3 Updated pip sheet with an upgrade option for newer versions 2017-06-02 13:09:48 +03:00
d1526ede16 Adding a first version of a pkill cheatsheet 2017-06-01 21:31:27 +02:00
374d381c00 Update emacs 2017-05-28 23:46:22 +03:00
1f3f9828c3 Add pgrep cheatsheat 2017-05-15 23:14:30 +09:00
5d3f89924c Get your global IP with curl 2017-05-15 23:08:21 +09:00
74808845a5 Add zsh cheatsheet 2017-04-07 14:41:10 +02:00
517bf9599b add cryptsetup cheatsheat 2017-04-04 09:05:49 +02:00
7716827dfc Minor fixes and additions to emacs 2017-03-12 10:19:47 -04:00
c65fde1b3a Update tar
Add extract a .tar in specified Directory
2017-03-09 18:50:36 +08:00
bb3c4105cb Add install to Cheatsheet/deb 2017-03-07 09:50:37 +01:00
edd7b5e806 Minor revisions on #244
- When using GFM code fences, strip the last line in addition to the
  first
- Updated `README.md` to mention the new feature
- `minor` version-bump to `2.2.0`.
2017-02-28 18:59:27 -05:00
7abb663bf4 Merge branch 'more_lexers' of git://github.com/cnicolov/cheat into cnicolov-more_lexers 2017-02-28 18:22:58 -05:00
f6f1233b12 Deleted CHANGELOG
Deleted `CHANGELOG`. It was never used.
2017-02-28 17:46:23 -05:00
b9241efab1 CONTRIBUTING.md
Put some useful information in `CONTRIBUTING.md`.
2017-02-28 17:45:53 -05:00
8019325f1e README edit
The sheilds.io badge displaying downloads per month has been broken for
some time now (seemingly across all python projects), so I removed it.
2017-02-28 09:32:00 -05:00
7209f2c929 docopt
Made revisions to the content of the docopt template.
2017-02-27 23:09:51 -05:00
068d117bef patch version bump. 2017-02-27 23:02:23 -05:00
9ead66461d Resolving merge conflict. 2017-02-27 23:01:30 -05:00
d00bd87dd1 Merge pull request #312 from shanahanjrs/feature-cheat-cheat
Added a cheatsheet for cheat itself
2017-02-27 19:36:45 -05:00
dd8b20a17a Merge pull request #317 from shanahanjrs/fix-7z-typo
Fixed typo in 7z cheatsheet
2017-02-27 19:29:58 -05:00
84e42e7f2f Merge pull request #314 from shanahanjrs/pushd-popd
Added cheatsheets for pushd and popd commands
2017-02-27 19:29:12 -05:00
a59e91ead7 Merge pull request #320 from tupaschoal/master
Add cheatsheet for hg, shutdown, su
2017-02-27 19:26:58 -05:00
f495a4dfd9 Add cheatsheet for su
Useful for running commands as another user.
2017-02-16 01:25:24 -02:00
10dd0e9a8b Add cheatsheet for shutdown
Adding help for shutdown, useful for rebooting the system,
2017-02-16 01:22:45 -02:00
d06e5bab6f Add cheatsheet for hg
Mercurial is extensively used as a version control system, as an option to Git, so I'm adding its cheatsheet.
2017-02-16 00:04:18 -02:00
aa9403d432 Created cheatsheets for alias, cat, cp, export, kill, mv, pwd, and wc 2017-02-12 22:11:45 -05:00
75b2555710 Fixed typo in 7z cheatsheet 2017-01-25 18:52:25 -05:00
632da2024a Added cheatsheets for pushd and popd commands 2017-01-08 17:11:51 -05:00
1baa6d39c0 Added a cheatsheet for cheat itself 2017-01-01 22:44:48 -05:00
8cad76943a v2.1.27
`patch` version bump.
2016-11-27 11:10:05 -05:00
a6ec02c296 Support multi-word EDITOR values
When the value of EDITOR was more than one words (e.g. emacsclient -c),
it wasn't properly split in an array for subprocess.call and cheat would
fail to launch it.
This commit fixes that.

Closes #301
2016-11-27 10:53:10 -05:00
7392787e31 Merge branch 'patch-1' of https://github.com/brutus/cheat into brutus-patch-1 2016-11-27 10:42:46 -05:00
208dd24a0c Minor cheatsheet edits. 2016-11-27 10:31:49 -05:00
df34774a7a Merge branch 'master' of https://github.com/notklaatu/cheat into notklaatu-master 2016-11-27 08:57:54 -05:00
8d65424ffb README edit
Modified the README with regards to the environment variable changes
made in #294.
2016-11-27 08:54:33 -05:00
597acec6ac cheat now honors CHEAT_EDITOR and VISUAL environment variables in
addition to `EDITOR`.
2016-11-27 08:54:33 -05:00
7d4150b937 Merge pull request #291 from proinsias/patch-1
Create MANIFEST.in
2016-11-27 08:53:45 -05:00
5df5b1ab49 Merge pull request #299 from jonlabelle/patch-1
Fix uninstall typo.
2016-11-27 08:46:55 -05:00
f1c8017342 Merge pull request #304 from dufferzafar/sheets
Add aria2c sheet
2016-11-27 08:45:50 -05:00
8f2912e5da Fix grammar of lsof 2016-11-27 08:43:37 -05:00
3139796524 Update lsof sheet 2016-11-27 08:43:37 -05:00
bcd4563bf3 Add npm cheatsheet 2016-11-27 08:43:37 -05:00
5cd5387a47 Add cheery-pick to git cheat 2016-11-27 08:43:37 -05:00
c8f0e6295b Add revert in git cheat 2016-11-27 08:43:37 -05:00
31e442d7f9 Add git stash cheat 2016-11-27 08:43:37 -05:00
05400a92ed Added support for ~ and environment variables in DEFAULT_CHEAT_DIR
If the `DEFAULT_CHEAT_DIR` environment variable contains the `~` — as shortcut for the users home directory — or environment variables like `$HOME`, the program bails. This change allows the usage of both.
2016-11-24 16:14:37 +01:00
034c1a2415 Add aria2c sheet 2016-10-15 00:02:45 +05:30
dab8645394 Fix uninstall type. 2016-10-02 16:23:42 -05:00
352a760561 README edit
Modified the README with regards to the environment variable changes
made in #294.
2016-10-01 14:08:58 -04:00
6be87e2d42 cheat now honors CHEAT_EDITOR and VISUAL environment variables in
addition to `EDITOR`.
2016-10-01 13:55:50 -04:00
403d715127 Merge pull request #292 from rahulkavale/master
Add stash, cherry-pick, revert in git cheat
2016-09-30 20:40:20 -04:00
0edd1450dc Merge pull request #293 from nagromc/npm-cheat
Add npm cheatsheet
2016-09-30 20:38:15 -04:00
d87a26ce4f Merge pull request #297 from dufferzafar/sheets
Update lsof sheet
2016-09-30 20:37:20 -04:00
cdf240b70e Fix grammar of lsof 2016-09-27 22:43:54 +05:30
809c6d77bc Update lsof sheet 2016-09-27 21:23:39 +05:30
be543450c7 Merge branch 'master' of github.com:notklaatu/cheat 2016-09-21 22:25:27 +12:00
9889d77adb xmlto cheatsheet 2016-09-21 22:24:47 +12:00
354376340f Missing man page #272 2016-09-10 14:17:01 +12:00
d82eee726c Add npm cheatsheet 2016-09-09 10:05:22 +02:00
9a23458a2d ffmpeg combine, add sqlite3 2016-09-09 12:05:08 +12:00
32802c2907 patch cheat 2016-09-04 09:48:01 +12:00
2a6d34de35 diff addition 2016-09-02 09:44:19 +12:00
f1253031f2 bzip2 2016-09-01 22:28:28 +12:00
76fa9cfc23 urpm* mageia open mandriva 2016-09-01 22:01:01 +12:00
0a54b2a2ff updated emacs, ffmpeg. branched org-mode. added slack. 2016-09-01 12:10:21 +12:00
6a1742984c Add cheery-pick to git cheat 2016-08-28 08:26:55 +05:30
80d2a09456 Add revert in git cheat 2016-08-28 08:19:20 +05:30
5121fece91 Add git stash cheat 2016-08-28 08:13:08 +05:30
e8d32102cb Create MANIFEST.in
I'm working on submitting this package to conda-forge. As part of this, I would like to include the license files in the MANIFEST.in for this project.
2016-08-25 20:31:13 -04:00
eff042d50b patch version bump 2016-08-05 15:18:52 -04:00
f000756f2c Resolved merge-conflict. 2016-08-05 15:15:22 -04:00
ef1dfb2168 Merge pull request #286 from poohzrn/master
Fix #281: Consistent description styles
2016-08-05 15:03:49 -04:00
3c1b5c5860 Merge pull request #274 from ImmortalPC/master
[CHANGE] Add cheats for DD and SSH
2016-08-05 15:01:14 -04:00
3494827403 Merge pull request #288 from rski/remove_prompt_function
Remove prompt_yes_or_no
2016-08-05 14:58:27 -04:00
f0879831c5 Merge pull request #284 from dufferzafar/ansi
Add ANSI Color Chart
2016-08-05 14:57:18 -04:00
8c056d09e9 Merge pull request #285 from dufferzafar/less
Update less cheatsheet
2016-08-05 14:56:14 -04:00
dd8d0ae58b Merge pull request #282 from dufferzafar/master
Update git cheatsheet
2016-08-05 14:54:24 -04:00
6cc99a2b6a Merge pull request #283 from dufferzafar/cpdf
Add cpdf cheatsheet
2016-08-05 14:52:47 -04:00
70ad22c12e git: Undo parts of last commit
Added from: http://stackoverflow.com/a/4248269/2043048
2016-07-20 14:34:29 +05:30
b28e6a84ac Remove prompt_yes_or_no
This function is not used anywhere in the code.
2016-07-19 15:16:12 +03:00
bf4f1c80ca Style fixes
Don't use * imports, fix indentations, other small fixes
2016-07-19 14:50:51 +03:00
9cf1a5761d Fix #281: Consistent description styles 2016-07-18 17:25:06 +02:00
13fdcec332 Add cheat on how to dump content of less to file 2016-07-16 18:47:19 +05:30
b2feeab4e8 Add ANSI Color Chart 2016-07-16 18:41:17 +05:30
c4b7fd507f Add cpdf cheatsheet
cpdf is a tool to slice and dice PDFs

I created this sheet on a boring day by copying text from
[here](http://www.coherentpdf.com/usage-examples.html) and then
cleaning things up a bit.
2016-07-16 18:37:12 +05:30
b77aa0974b Update git cheatsheet 2016-07-16 18:21:07 +05:30
3be95142ed v2.1.25 2016-05-29 21:47:22 -04:00
bb324e94a4 Issue #278
Fixed a technical innacuracy in the `crontab` cheatsheet.
2016-05-29 21:03:58 -04:00
7084ce2f45 Merge pull request #277 from caorong/master
origin Convert Unix timestamp to Date only works on Linux, add cheat which works on Mac
2016-05-29 21:00:57 -04:00
905006f09c Merge pull request #280 from ybudimirov/ncdu
Ncdu cheatsheet
2016-05-29 20:59:16 -04:00
06a368fb1f Merge pull request #276 from oliworx/patch-1
add cheatsheet for subversion (svn)
2016-05-29 20:58:16 -04:00
6a9422502a Ncdu cheatsheet 2016-05-26 13:21:20 +03:00
41332f1d8a update timestamp convert cheat 2016-04-27 10:57:44 +08:00
b6d54b135c [CHANGE & ADD] Removing typo from SSH. Adding tip for emacs and ssh. Adding cheat for xxd 2016-04-19 13:45:47 +02:00
a3c682729e add cheatsheet for subversion (svn) 2016-04-13 17:27:37 +02:00
f38da23741 [CHANGE] Add cheats for DD and SSH 2016-04-05 17:09:49 +02:00
20d985d993 Working around failed upload
pypi responded with an HTTP 500 when uploading the last version of
`cheat`, and this seems to have caused some problems. No changes were
made in this commit other than incrementing the version number in an
attempt to resolve this.
2016-03-24 12:41:40 -04:00
09f821835c v2.1.23 2016-03-24 12:39:20 -04:00
7e5e4315e5 Merge pull request #268 from pierrepo/master
Add options for pip and a new cheatsheet for virtualenv
2016-03-24 12:37:17 -04:00
869e7095f3 Merge pull request #269 from VirenMohindra/update-readme
trivial readme.md correction
2016-03-24 12:34:51 -04:00
6dd8faf26a trivial readme.md correction
availble -> available
2016-03-18 03:23:30 -05:00
c0585ee55c Append virtualenvwrapper commands 2016-03-15 17:34:28 +01:00
c0d755e102 Add virtualenv 2016-03-15 17:28:07 +01:00
49e1fc46f4 Add --user and --upgrade options 2016-03-15 17:15:06 +01:00
3d90b26b04 Merge pull request #266 from MinimaxHeadroom/add-tree-mod-dd-vim-find
Add cheatsheet for command `tree`. Edits or command additions to existing cheatsheets `dd`, `find`, `vim`.
2016-03-14 14:21:55 -04:00
3b73b9b06b Merge pull request #264 from JindrichPilar/master
Added xrandr cheat
2016-03-14 14:17:14 -04:00
74d1bc1ec7 Merge pull request #263 from omsobliga/master
Add examples for tmux
2016-03-14 14:14:55 -04:00
78c76dc75a Merge pull request #267 from VHarisop/nmcli
Added nmcli cheatsheet
2016-03-14 14:14:21 -04:00
f204ed66e1 Added WiFi-specific commands 2016-03-11 03:41:26 +02:00
29c53b754d Added nmcli cheatsheet 2016-03-08 04:06:44 +02:00
5a7fdfcca7 Add tree cheatsheet. Small edits to improve clarity of, plus addition of some new commands to, dd, find, vim. 2016-03-04 04:35:41 -05:00
c3f082eccf Added xrandr cheat 2016-02-22 20:59:05 +01:00
lih
808a2585ef Add example for tmux 2016-02-20 11:09:02 +08:00
c0aad062ec Trivial README edit. 2016-02-18 15:40:18 -05:00
8ffeaa4211 README edits
- Replaced the broken PyPi badges with new ones
- Moved some content out of the README and into new wiki pages
- Applied syntax highlighting to shell examples
- Trivial content edits
2016-02-18 15:35:17 -05:00
c1d4c768de CONTRIBUTING.md
- Added a paragraph on licensing
- Trivial edits
2016-02-17 14:12:58 -05:00
c1fbeffde5 Adds support for more lexers
If you use cheat to save some programming snippets this might be useful.

For example if you have a long list of SQL Query cheats, you can do the
following:

Enter ```sql in the beginning of the file containing the cheats content.

Example file: sql
```sql

SELECT 17 & 16 = 16;
SELECT 2+4+8+16 & 1 = 0;
2015-12-02 14:47:13 +02:00
208 changed files with 2759 additions and 4414 deletions

4
.gitignore vendored
View File

@ -1,5 +1 @@
*.pyc
MANIFEST
build
cheat.egg-info
dist

View File

@ -1,3 +0,0 @@
Changelog
=========

View File

@ -1,9 +1,43 @@
Contributing
CONTRIBUTING
============
If you would like to contribute cheetsheets or program functionality, please
fork this repository, make your changes, and send me a pull request.
Do you want to contribute to `cheat`? There are a few ways to help:
Python code show follow the standards laid out by [PEP 8][].
#### Submit a cheatsheet ####
Do you have a witty bash one-liner to share? [Open a pull-request][pr] against
the [cheatsheets][] repository. (The `cheat` executable source code lives in
[cheat/cheat][cheat]. Cheatsheet content lives in
[cheat/cheatsheets][cheatsheets].)
#### Report a bug ####
Did you find a bug? Report it in the [issue tracker][issues]. (But before you
do, please look through the open issues to make sure that it hasn't already
been reported.)
#### Add a feature ####
Do you have a feature that you'd like to contribute? Propose it in the [issue
tracker][issues] to discuss with the maintainer whether it would be considered
for merging.
`cheat` is mostly mature and feature-complete, but may still have some room for
new features.
#### Add documentation ####
Did you encounter features, bugs, edge-cases, use-cases, or environment
considerations that were undocumented or under-documented? Add them to the
[wiki][]. (You may also open a pull-request against the `README`, if
appropriate.)
Do you enjoy technical writing or proofreading? Help keep the documentation
error-free and well-organized.
#### Spread the word ####
Are you unable to do the above, but still want to contribute? You can help
`cheat` simply by telling others about it. Share it with friends and coworkers
that might benefit from using it.
[PEP 8]: http://legacy.python.org/dev/peps/pep-0008/
[cheat]: https://github.com/cheat/cheat
[cheatsheets]: https://github.com/cheat/cheatsheets
[issues]: https://github.com/cheat/cheat/issues
[pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
[wiki]: https://github.com/cheat/cheat/wiki

View File

@ -1,2 +0,0 @@
This program is dual-licensed under the MIT and GPL3 licenses. See the licenses
directory for the license text in full.

View File

@ -1,4 +1,4 @@
The MIT License (MIT) Copyright (c) 2016 Chris Allen Lane
Copyright 2013 Christopher Allen Lane
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

248
README.md
View File

@ -7,149 +7,189 @@ remember.
![The obligatory xkcd](http://imgs.xkcd.com/comics/tar.png 'The obligatory xkcd')
`cheat` depends only on `python` and `pip`.
Use `cheat` with [cheatsheets][].
PyPI status:
[![Latest Version](https://pypip.in/version/cheat/badge.png)](https://pypi.python.org/pypi/cheat/)
[![Downloads](https://pypip.in/download/cheat/badge.png)](https://pypi.python.org/pypi/cheat/)
Example
-------
The next time you're forced to disarm a nuclear weapon without consulting
Google, you may run:
cheat tar
You will be presented with a cheatsheet resembling:
```sh
cheat tar
```
You will be presented with a cheatsheet resembling the following:
```sh
# To extract an uncompressed archive:
tar -xvf /path/to/foo.tar
tar -xvf '/path/to/foo.tar'
# To extract a .gz archive:
tar -xzvf /path/to/foo.tgz
tar -xzvf '/path/to/foo.tgz'
# To create a .gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/
tar -czvf '/path/to/foo.tgz' '/path/to/foo/'
# To extract a .bz2 archive:
tar -xjvf /path/to/foo.tgz
tar -xjvf '/path/to/foo.tgz'
# To create a .bz2 archive:
tar -cjvf /path/to/foo.tgz /path/to/foo/
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'
```
To see what cheatsheets are availble, run `cheat -l`.
Note that, while `cheat` was designed primarily for *nix system administrators,
it is agnostic as to what content it stores. If you would like to use `cheat`
to store notes on your favorite cookie recipes, feel free.
Installing
----------
### Using pip ###
sudo pip install cheat
### Using homebrew ###
brew install cheat
### Manually ###
First install the required python dependencies with:
sudo pip install docopt pygments
Then, clone this repository, `cd` into it, and run:
sudo python setup.py install
Modifying Cheatsheets
---------------------
The value of `cheat` is that it allows you to create your own cheatsheets - the
defaults are meant to serve only as a starting point, and can and should be
modified.
Cheatsheets are stored in the `~/.cheat/` directory, and are named on a
per-keyphrase basis. In other words, the content for the `tar` cheatsheet lives
in the `~/.cheat/tar` file.
Provided that you have an `EDITOR` environment variable set, you may edit
cheatsheets with:
cheat -e foo
If the 'foo' cheatsheet already exists, it will be opened for editing.
Otherwise, it will be created automatically.
After you've customized your cheatsheets, I urge you to track `~/.cheat/` along
with your [dotfiles][].
`cheat` has no dependencies. To install it, download the executable from the
[releases][] page and place it on your `PATH`.
Configuring
-----------
### conf.yml ###
`cheat` is configured by a YAML file that can be generated with `cheat --init`:
### Setting a DEFAULT_CHEAT_DIR ###
Personal cheatsheets are saved in the `~/.cheat` directory by default, but you
can specify a different default by exporting a `DEFAULT_CHEAT_DIR` environment
variable:
```sh
mkdir -p ~/.config/cheat && cheat --init > ~/.config/cheat/conf.yml
```
export DEFAULT_CHEAT_DIR=/path/to/my/cheats
By default, the config file is assumed to exist on an XDG-compliant
configuration path like `~/.config/cheat/conf.yml`. If you would like to store
it elsewhere, you may export a `CHEAT_CONFIG_PATH` environment variable that
specifies its path:
### Setting a CHEATPATH ###
You can additionally instruct `cheat` to look for cheatsheets in other
directories by exporting a `CHEATPATH` environment variable:
```sh
export CHEAT_CONFIG_PATH="~/.dotfiles/cheat/conf.yml"
```
export CHEATPATH=/path/to/my/cheats
Cheatsheets
-----------
Cheatsheets are plain-text files with no file extension, and are named
according to the command used to view them:
You may, of course, append multiple directories to your `CHEATPATH`:
```sh
cheat tar # file is named "tar"
cheat foo/bar # file is named "bar", in a "foo" subdirectory
```
export CHEATPATH=$CHEATPATH:/path/to/more/cheats
Cheatsheet text may optionally be preceeded by a YAML frontmatter header that
assigns tags and specifies syntax:
You may view which directories are on your `CHEATPATH` with `cheat -d`.
```
---
syntax: javascript
tags: [ array, map ]
---
// To map over an array:
const squares = [1, 2, 3, 4].map(x => x * x);
```
### Enabling Syntax Highlighting ###
`cheat` can apply syntax highlighting to your cheatsheets if so desired. To
enable this feature, set a `CHEATCOLORS` environment variable:
export CHEATCOLORS=true
### Enabling Command-line Autocompletion ###
The `cheat/autocompletion` directory contains scripts to enable command-line
autocompletion for various shells. To activate autocompletion, simply copy the
appropriate script to the appropriate path on your system. (The "appropriate
path" will vary on a per-platform basis, so this documentation shall not
speculate as to where that may be.)
The `cheat` executable includes no cheatsheets, but [community-sourced
cheatsheets are available][cheatsheets].
Related Projects
----------------
Cheatpaths
----------
Cheatsheets are stored on "cheatpaths", which are directories that contain
cheetsheets. Cheatpaths are specified in the `conf.yml` file.
- [lucaswerkmeister/cheats][1]: An implementation of this concept in pure bash
that also allows not only for numerical indexing of subcomands but also
supports running commands interactively.
It can be useful to configure `cheat` against multiple cheatpaths. A common
pattern is to store cheatsheets from multiple repositories on individual
cheatpaths:
- [jahendrie/cheat][2]: A bash-only implementation that additionally allows for
cheatsheets to be created and `grep` searched from the command-line.
([jahendrie][] contributed key ideas to this project as well.)
```yaml
# conf.yml:
# ...
cheatpaths:
- name: community # a name for the cheatpath
path: ~/documents/cheat/community # the path's location on the filesystem
tags: [ community ] # these tags will be applied to all sheets on the path
readonly: true # if true, `cheat` will not create new cheatsheets here
- [`cheat` RubyGem][3]: A clever gem from 2006 that clearly had similar
motivations. It is unclear whether or not it is currently maintained.
- name: personal
path: ~/documents/cheat/personal # this is a separate directory and repository than above
tags: [ personal ]
readonly: false # new sheets may be written here
# ...
```
- [`tldr`][tldr]: "Simplified and community-driven man pages".
The `readonly` option instructs `cheat` not to edit (or create) any cheatsheets
on the path. This is useful to prevent merge-conflicts from arising on upstream
cheatsheet repositories.
- [dufferzafar/cheat][5]: An implementation in golang that has syntax highlighting and allows to copy cheats directly to clipboard.
If a user attempts to edit a cheatsheet on a read-only cheatpath, `cheat` will
transparently copy that sheet to a writeable directory before opening it for
editing.
[dotfiles]: http://dotfiles.github.io/
[jahendrie]: https://github.com/jahendrie
[1]: https://github.com/lucaswerkmeister/cheats
[2]: https://github.com/jahendrie/cheat
[3]: http://errtheblog.com/posts/21-cheat
[4]: https://github.com/chrisallenlane/cheat/pull/77
[5]: https://github.com/dufferzafar/cheat
[tldr]: https://github.com/tldr-pages/tldr
Usage
-----
To view a cheatsheet:
```sh
cheat tar # a "top-level" cheatsheet
cheat foo/bar # a "nested" cheatsheet
```
To edit a cheatsheet:
```sh
cheat -e tar # opens the "tar" cheatsheet for editing, or creates it if it does not exist
cheat -e foo/bar # nested cheatsheets are accessed like this
```
To view the configured cheatpaths:
```sh
cheat -d
```
To list all available cheatsheets:
```sh
cheat -l
```
To list all cheatsheets that are tagged with "networking":
```sh
cheat -l -t networking
```
To list all cheatsheets on the "personal" path:
```sh
cheat -l -p personal
```
To search for the phrase "ssh" among cheatsheets:
```sh
cheat -s ssh
```
To search (by regex) for cheatsheets that contain an IP address:
```sh
cheat -r -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'
```
Flags may be combined in inuitive ways. Example: to search sheets on the
"personal" cheatpath that are tagged with "networking" and match a regex:
```sh
cheat -p personal -t networking -s --regex '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'
```
Advanced Usage
--------------
`cheat` may be integrated with [fzf][]. See [fzf.bash][bash] for instructions.
(Support for other shells will be added in future releases.)
[Releases]: https://github.com/cheat/cheat/releases
[bash]: https://github.com/cheat/cheat/blob/master/scripts/fzf.bash
[cheatsheets]: https://github.com/cheat/cheatsheets
[fzf]: https://github.com/junegunn/fzf

13
bin/build_devel.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# locate the cheat project root
BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APPDIR=$(readlink -f "$BINDIR/..")
# compile the executable
cd "$APPDIR/cmd/cheat"
go clean && go generate && go build
mv "$APPDIR/cmd/cheat/cheat" "$APPDIR/dist/cheat"
# display a build checksum
md5sum "$APPDIR/dist/cheat"

14
bin/build_release.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# locate the cheat project root
BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APPDIR=$(readlink -f "$BINDIR/..")
# build embeds
cd "$APPDIR/cmd/cheat"
go clean && go generate
# compile AMD64 for Linux, OSX, and Windows
env GOOS=darwin GOARCH=amd64 go build -o "$APPDIR/dist/cheat-darwin-amd64" "$APPDIR/cmd/cheat"
env GOOS=linux GOARCH=amd64 go build -o "$APPDIR/dist/cheat-linux-amd64" "$APPDIR/cmd/cheat"
env GOOS=windows GOARCH=amd64 go build -o "$APPDIR/dist/cheat-win-amd64.exe" "$APPDIR/cmd/cheat"

View File

@ -1,61 +0,0 @@
#!/usr/bin/env python
"""cheat
Usage:
cheat <cheatsheet>
cheat -e <cheatsheet>
cheat -s <keyword>
cheat -l
cheat -d
cheat -v
cheat allows you to create and view interactive cheatsheets on the
command-line. It was designed to help remind *nix system
administrators of options for commands that they use frequently,
but not frequently enough to remember.
Examples:
To look up 'tar':
cheat tar
To create or edit the cheatsheet for 'foo':
cheat -e foo
Options:
-d --directories List directories on CHEATPATH
-e --edit Edit cheatsheet
-l --list List cheatsheets
-s --search Search cheatsheets for <keyword>
-v --version Print the version number
"""
# require the dependencies
from cheat import *
from cheat.utils import *
from docopt import docopt
if __name__ == '__main__':
# parse the command-line options
options = docopt(__doc__, version='cheat 2.1.22')
# list directories
if options['--directories']:
print("\n".join(sheets.paths()))
# list cheatsheets
elif options['--list']:
print(sheets.list())
# create/edit cheatsheet
elif options['--edit']:
sheet.create_or_edit(options['<cheatsheet>'])
# search among the cheatsheets
elif options['--search']:
print(colorize(sheets.search(options['<keyword>'])))
# print the cheatsheet
else:
print(colorize(sheet.read(options['<cheatsheet>'])))

93
build/embed.go Normal file
View File

@ -0,0 +1,93 @@
// +build ignore
// This script embeds `docopt.txt and `conf.yml` into the binary during at
// build time.
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
)
func main() {
// get the cwd
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
// get the project root
root, err := filepath.Abs(cwd + "../../../")
if err != nil {
log.Fatal(err)
}
// specify template file information
type file struct {
In string
Out string
Method string
}
// enumerate the template files to process
files := []file{
file{
In: "cmd/cheat/docopt.txt",
Out: "cmd/cheat/str_usage.go",
Method: "usage"},
file{
In: "configs/conf.yml",
Out: "cmd/cheat/str_config.go",
Method: "configs"},
}
// iterate over each static file
for _, file := range files {
// delete the outfile
os.Remove(path.Join(root, file.Out))
// read the static template
bytes, err := ioutil.ReadFile(path.Join(root, file.In))
if err != nil {
log.Fatal(err)
}
// render the template
data := template(file.Method, string(bytes))
// write the file to the specified outpath
spath := path.Join(root, file.Out)
err = ioutil.WriteFile(spath, []byte(data), 0644)
if err != nil {
log.Fatal(err)
}
}
}
// template packages the
func template(method string, body string) string {
// specify the template string
t := `package main
// Code generated .* DO NOT EDIT.
import (
"strings"
)
func %s() string {
return strings.TrimSpace(%s)
}
`
return fmt.Sprintf(t, method, "`"+body+"`")
}

View File

@ -1,3 +0,0 @@
from . import sheet
from . import sheets
from . import utils

View File

@ -1,9 +0,0 @@
function _cheat_autocomplete {
sheets=$(cheat -l | cut -d' ' -f1)
COMPREPLY=()
if [ $COMP_CWORD = 1 ]; then
COMPREPLY=(`compgen -W "$sheets" -- $2`)
fi
}
complete -F _cheat_autocomplete cheat

View File

@ -1,12 +0,0 @@
#completion for cheat
complete -c cheat -s h -l help -f -x --description "Display help and exit"
complete -c cheat -l edit -f -x --description "Edit <cheatsheet>"
complete -c cheat -s e -f -x --description "Edit <cheatsheet>"
complete -c cheat -s l -l list -f -x --description "List all available cheatsheets"
complete -c cheat -s d -l cheat-directories -f -x --description "List all current cheat dirs"
complete -c cheat --authoritative -f
for cheatsheet in (cheat -l | cut -d' ' -f1)
complete -c cheat -a "$cheatsheet"
complete -c cheat -o e -a "$cheatsheet"
complete -c cheat -o '-edit' -a "$cheatsheet"
end

View File

@ -1,5 +0,0 @@
#compdef cheat
declare -a cheats
cheats=$(cheat -l | cut -d' ' -f1)
_arguments "1:cheats:(${cheats})" && return 0

View File

@ -1,29 +0,0 @@
7z
A file archiver with highest compression ratio
Args:
a add
d delete
e extract
l list
t test
u update
x extract with full paths
Example:
7z a -t7z -m0-lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
-t7z 7z archive
-m0=lzma lzma method
-mx=9 level of compression = 9 (ultra)
-mfb=64 number of fast bytes for lzma = 64
-md=32m dictionary size = 32 Mb
-ms=on solid archive = on
7z exit codes:
0 normal (no errors or warnings)
1 warning (non-fatal errors)
2 fatal error
7 bad cli arguments
8 not enough memory for operation
255 process was interrupted

View File

@ -1,4 +0,0 @@
import os
def sheets_dir():
return os.path.split(__file__)

View File

@ -1,5 +0,0 @@
# send 100 requests with a concurency of 50 requests to an URL
ab -n 100 -c 50 http://www.example.com/
# send requests during 30 seconds with a concurency of 50 requests to an URL
ab -t 30 -c 50 URL http://www.example.com/

View File

@ -1,14 +0,0 @@
# Install a package
apk add $package
# Remove a package
apk del $package
# Update repos
apk update
# Upgrade all packages
apk upgrade
# Find a package
apk search $package

View File

@ -1,18 +0,0 @@
# Desc: Apparmor will protect the system by confining programs to a limited set of resources.
# To activate a profile:
sudo aa-enforce usr.bin.firefox
# OR
export _PROFILE_='usr.bin.firefox' sudo $(rm /etc/apparmor.d/disable/$_PROFILE_ ; cat /etc/apparmor.d/$_PROFILE_ | apparmor_parser -a )
# TO disable a profile:
sudo aa-disable usr.bin.firefox
# OR
export _PROFILE_='usr.bin.firefox' sudo $(ln -s /etc/apparmor.d/$_PROFILE_ /etc/apparmor.d/disable/ && apparmor_parser -R /etc/apparmor.d/$_PROFILE_)
# To list profiles loaded:
sudo aa-status
# OR
sudo apparmor_status
# List of profiles aviables: /etc/apparmor.d/

View File

@ -1,23 +0,0 @@
# To search a package:
apt search package
# To show package informations:
apt show package
# To fetch package list:
apt update
# To download and install updates without installing new package:
apt upgrade
# To download and install the updates AND install new necessary packages:
apt dist-upgrade
# Full command:
apt update && apt dist-upgrade
# To install a new package(s):
apt install package(s)
# To uninstall package(s)
apt remove package(s)

View File

@ -1,12 +0,0 @@
# To search for apt packages:
apt-cache search "whatever"
# To display package records for the named package(s):
apt-cache show pkg(s)
# To display reverse dependencies of a package
apt-cache rdepends package_name
# To display package versions, reverse dependencies and forward dependencies
# of a package
apt-cache showpkg package_name

View File

@ -1,28 +0,0 @@
# Desc: Allows to update the operating system
# To fetch package list
apt-get update
# To download and install updates without installing new package.
apt-get upgrade
# To download and install the updates AND install new necessary packages
apt-get dist-upgrade
# Full command:
apt-get update && apt-get dist-upgrade
# To install a new package(s)
apt-get install package(s)
# Download a package without installing it. (The package will be downloaded in your current working dir)
apt-get download modsecurity-crs
# Change Cache dir and archive dir (where .deb are stored).
apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ...
# Show apt-get installed packages.
grep 'install ' /var/log/dpkg.log
# Silently keep old configuration during batch updates
apt-get update -o DPkg::Options::='--force-confold' ...

View File

@ -1,15 +0,0 @@
# To search for packages:
aptitude search "whatever"
# To display package records for the named package(s):
aptitude show pkg(s)
# To install a package:
aptitude install package
# To remove a package:
aptitude remove package
# To remove unnecessary package:
aptitude autoclean

View File

@ -1,22 +0,0 @@
# To show some text in ASCII Art:
figlet Cheat
# ____ _ _
# / ___| |__ ___ __ _| |_
#| | | '_ \ / _ \/ _` | __|
#| |___| | | | __/ (_| | |_
# \____|_| |_|\___|\__,_|\__|
#
# To have some text with color and other options:
# Show with a border
toilet -F border Cheat
# Basic show (filled)
toilet Cheat
# mmm # m
# m" " # mm mmm mmm mm#mm
# # #" # #" # " # #
# # # # #"""" m"""# #
# "mmm" # # "#mm" "mm"# "mm
#

View File

@ -1,17 +0,0 @@
# To connect to a running Asterisk session:
asterisk -rvvv
# To issue a command to Asterisk from the shell:
asterisk -rx "<command>"
# To originate an echo call from a SIP trunk on an Asterisk server, to a specified number:
asterisk -rx "channel originate SIP/<trunk>/<number> application echo"
# To print out the details of SIP accounts:
asterisk -rx "sip show peers"
# To print out the passwords of SIP accounts:
asterisk -rx "sip show users"
# To print out the current active channels:
asterisk -rx "core show channels"

View File

@ -1,17 +0,0 @@
# To schedule a one time task
at {time}
{command 0}
{command 1}
Ctrl-d
# {time} can be either
now | midnight | noon | teatime (4pm)
HH:MM
now + N {minutes | hours | days | weeks}
MM/DD/YY
# To list pending jobs
atq
# To remove a job (use id from atq)
atrm {id}

View File

@ -1,11 +0,0 @@
# sum integers from a file or stdin, one integer per line:
printf '1\n2\n3\n' | awk '{ sum += $1} END {print sum}'
# using specific character as separator to sum integers from a file or stdin
printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'
# print a multiplication table
seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'
# Specify output separator character
printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}'

View File

@ -1,27 +0,0 @@
# To implement a for loop:
for file in *;
do
echo $file found;
done
# To implement a case command:
case "$1"
in
0) echo "zero found";;
1) echo "one found";;
2) echo "two found";;
3*) echo "something beginning with 3 found";;
esac
# Turn on debugging:
set -x
# Turn off debugging:
set +x
# Retrieve N-th piped command exit status
printf 'foo' | fgrep 'foo' | sed 's/foo/bar/'
echo ${PIPESTATUS[0]} # replace 0 with N
# Lock file:
( set -o noclobber; echo > my.lock ) || echo 'Failed to create lock file'

View File

@ -1,26 +0,0 @@
# Install a package locally
bower install <package-name>
# Install a package locally directly from github
bower install <user>/<repo>
# Install a specific package locally
bower install <package-name>#<version>
# Install a package locally and save installed package into bower.json
bower install <package-name> --save
# Retrieve info of a particular package
bower info <package-name>
# List local packages
bower list
# Search for a package by name
bower search <package-name>
# Update a package to their newest version
bower update <package-name>
# Remove a local package
bower uninstall <package-name>

View File

@ -1,36 +0,0 @@
# Add execute for all (myscript.sh)
chmod a+x myscript.sh
# Set user to read/write/execute, group/global to read only (myscript.sh), symbolic mode
chmod u=rwx, go=r myscript.sh
# Remove write from user/group/global (myscript.sh), symbolic mode
chmod a-w myscript.sh
# Remove read/write/execute from user/group/global (myscript.sh), symbolic mode
chmod = myscript.sh
# Set user to read/write and group/global read (myscript.sh), octal notation
chmod 644 myscript.sh
# Set user to read/write/execute and group/global read/execute (myscript.sh), octal notation
chmod 755 myscript.sh
# Set user/group/global to read/write (myscript.sh), octal notation
chmod 666 myscript.sh
# Roles
u - user (owner of the file)
g - group (members of file's group)
o - global (all users who are not owner and not part of group)
a - all (all 3 roles above)
# Numeric representations
7 - full (rwx)
6 - read and write (rw-)
5 - read and execute (r-x)
4 - read only (r--)
3 - write and execute (-wx)
2 - write only (-w-)
1 - execute only (--x)
0 - none (---)

View File

@ -1,11 +0,0 @@
# Change file owner
chown user file
# Change file owner and group
chown user:group file
# Change owner recursively
chown -R user directory
# Change ownership to match another file
chown --reference=/path/to/ref_file file

View File

@ -1,19 +0,0 @@
# To resize an image to a fixed width and proportional height:
convert original-image.jpg -resize 100x converted-image.jpg
# To resize an image to a fixed height and proportional width:
convert original-image.jpg -resize x100 converted-image.jpg
# To resize an image to a fixed width and height:
convert original-image.jpg -resize 100x100 converted-image.jpg
# To resize an image and simultaneously change its file type:
convert original-image.jpg -resize 100x converted-image.png
# To resize all of the images within a directory:
# To implement a for loop:
for file in `ls original/image/path/`;
do new_path=${file%.*};
new_file=`basename $new_path`;
convert $file -resize 150 conerted/image/path/$new_file.png;
done

View File

@ -1,20 +0,0 @@
# set a shell
SHELL=/bin/bash
# crontab format
* * * * * command_to_execute
- - - - -
| | | | |
| | | | +- day of week (0 - 7) (where sunday is 0 and 7)
| | | +--- month (1 - 12)
| | +----- day (1 - 31)
| +------- hour (0 - 23)
+--------- minute (0 - 59)
# example entries
# every 15 min
*/15 * * * * /home/user/command.sh
# every midnight
0 * * * * /home/user/command.sh
# every Saturday at 8:05 AM
5 8 * * 6 /home/user/command.sh

View File

@ -1,5 +0,0 @@
# Split a file based on pattern
csplit input.file '/PATTERN/'
# Use prefix/suffix to improve resulting file names
csplit -f 'prefix-' -b '%d.extension' input.file '/PATTERN/' '{*}'

View File

@ -1,22 +0,0 @@
# Manage printers through CUPS:
http://localhost:631 (in web browser)
# Print file from command line
lp myfile.txt
# Display print queue
lpq
# Remove print job from queue
lprm 545
or
lprm -
# Print log location
/var/log/cups
# Reject new jobs
cupsreject printername
# Accept new jobs
cupsaccept printername

View File

@ -1,35 +0,0 @@
# Download a single file
curl http://path.to.the/file
# Download a file and specify a new filename
curl http://example.com/file.zip -o new_file.zip
# Download multiple files
curl -O URLOfFirstFile -O URLOfSecondFile
# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg
# Download a file and pass HTTP Authentication
curl -u username:password URL
# Download a file with a Proxy
curl -x proxysever.server.com:PORT http://addressiwantto.access
# Download a file from FTP
curl -u username:password -O ftp://example.com/pub/file.zip
# Get an FTP directory listing
curl ftp://username:password@example.com
# Resume a previously failed download
curl -C - -o partial_file.zip http://example.com/file.zip
# Fetch only the HTTP headers from a response
curl -I http://example.com
# Fetch your external IP and network info as JSON
curl http://ifconfig.me/all/json
# Limit the rate of a download
curl --limit-rate 1000B -O http://path.to.the/file

View File

@ -1,2 +0,0 @@
# To cut out the third field of text or stdoutput that is delimited by a #:
cut -d# -f3

View File

@ -1,5 +0,0 @@
# Print date in format suitable for affixing to file names
date +"%Y%m%d_%H%M%S"
# Convert Unix timestamp to Date
date -d @1440359821

View File

@ -1,20 +0,0 @@
# Read from {/dev/urandom} 2*512 Bytes and put it into {/tmp/test.txt}
# Note: At the first iteration, we read 512 Bytes.
# Note: At the second iteration, we read 512 Bytes.
dd if=/dev/urandom of=/tmp/test.txt count=512 bs=2
# Watch the progress of 'dd'
dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d /proc/$dd_pid ]]; do kill -USR1 $dd_pid && sleep 1 && clear; done
# Watch the progress of 'dd' with `pv` and `dialog` (apt-get install pv dialog)
(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0
# Watch the progress of 'dd' with `pv` and `zenity` (apt-get install pv zenity)
(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | zenity --title 'Running dd command (cloning), please wait...' --progress
# Watch the progress of 'dd' with the built-in `progress` functionality (introduced in coreutils v8.24)
dd if=/dev/zero of=/dev/null bs=128M status=progress
# DD with "graphical" return
dcfldd if=/dev/zero of=/dev/null bs=500K

View File

@ -1,2 +0,0 @@
# Printout disk free space in a human readable format
df -h

View File

@ -1,10 +0,0 @@
# To release the current IP address:
sudo dhclient -r
# To obtain a new IP address:
sudo dhclient
# Running the above in sequence is a common way of refreshing an IP.
# To obtain a new IP address for a specific interface:
sudo dhclient eth0

View File

@ -1,23 +0,0 @@
# To view the differences between two files:
diff -u version1 version2
# To view the differences between two directories:
diff -ur folder1/ folder2/
# To ignore the white spaces:
diff -ub version1 version2
# To ignore the blank lines:
diff -uB version1 version2
# To ignore the differences between uppercase and lowercase:
diff -ui version1 version2
# To report whether the files differ:
diff -q version1 version2
# To report whether the files are identical:
diff -s version1 version2
# To diff the output of two commands or scripts:
diff <(command1) <(command2)

View File

@ -1,29 +0,0 @@
# INSTALL
# ==============================================================================
# Edit /etc/default/distcc and set theses vars
# STARTDISTCC="true"
# ALLOWEDNETS="127.0.0.1 192.168.1.0/24"# Your computer and local computers
# #LISTENER="127.0.0.1"# Comment it
# ZEROCONF="true"# Auto configuration
# REMEMBER 1:
# Start/Restart your distccd servers before using one of these commands.
# service distccd start
# REMEMBER 2:
# Do not forget to install on each machine DISTCC.
# No need to install libs ! Only main host need libs !
# USAGE
# ==============================================================================
# Run make with 4 thread (a cross network) in auto configuration.
# Note: for gcc, Replace CXX by CC and g++ by gcc
ZEROCONF='+zeroconf' make -j4 CXX='distcc g++'
# Run make with 4 thread (a cross network) in static configuration (2 ip)
# Note: for gcc, Replace CXX by CC and g++ by gcc
DISTCC_HOSTS='127.0.0.1 192.168.1.69' make -j4 CXX='distcc g++'
# Show hosts aviables
ZEROCONF='+zeroconf' distcc --show-hosts

View File

@ -1,16 +0,0 @@
# To install the latest version of a package:
dnf install <package name>
# To search package details for the given string
dnf search <string>
# To find which package provides a binary
dnf provides <path to binary>
# The following are available after installing "dnf-plugins-core"
# Download a package
dnf download <package name>
# install the build dependencies for a SRPM or from a .spec file
dnf builddep <srpm/.spec file>

View File

@ -1,32 +0,0 @@
# Start docker daemon
docker -d
# start a container with an interactive shell
docker run -ti <image_name> /bin/bash
# "shell" into a running container (docker-1.3+)
docker exec -ti <container_name> bash
# inspect a running container
docker inspect <container_name> (or <container_id>)
# Get the process ID for a container
# Source: https://github.com/jpetazzo/nsenter
docker inspect --format {{.State.Pid}} <container_name_or_ID>
# List the current mounted volumes for a container (and pretty print)
# Source:
# http://nathanleclaire.com/blog/2014/07/12/10-docker-tips-and-tricks-that-will-make-you-sing-a-whale-song-of-joy/
docker inspect --format='{{json .Volumes}}' <container_id> | python -mjson.tool
# Copy files/folders between a container and your host
docker cp foo.txt mycontainer:/foo.txt
# list currently running containers
docker ps
# list all containers
docker ps -a
# list all images
docker images

View File

@ -1,11 +0,0 @@
# Install the package or upgrade it
dpkg -i test.deb
# Remove a package including configuration files
dpkg -P test.deb
# List all installed packages with versions and details
dpkg -I
# Find out if a Debian package is installed or not
dpkg -s test.deb | grep Status

View File

@ -1,5 +0,0 @@
# To sort directories/files by size
du -sk *| sort -rn
# To show cumulative humanreadable size
du -sh

View File

@ -1,70 +0,0 @@
# Basic usage
Indent Select text then press TAB
Cut CTRL-w
Copy ALT-w
Paste CTRL-y
Search/Find CTRL-s
Replace ALT-% (ALT-SHIFT-5)
Save CTRL-x CTRL-s
Load/Open CTRL-x CTRL-f
Undo CTRL-x u
Highlight all text CTRL-x h
Directory listing CTRL-x d
Cancel a command ESC ESC ESC
Font size bigger CTRL-x CTRL-+
Font size smaller CTRL-x CTRL--
# Buffers
Split screen vertically CTRL-x 2
Split screen vertically with 5 row height CTRL-u 5 CTRL-x 2
Split screen horizontally CTRL-x 3
Split screen horizontally with 24 column width CTRL-u 24 CTRL-x 3
Revert to single screen CTRL-x 1
Hide the current screen CTRL-x 0
Kill the current screen CTRL-x k
Move to the next buffer CTRL-x O
Select a buffer CTRL-x b
Run command in the scratch buffer CTRL-x CTRL-e
# Other stuff
Open a shell ALT-x eshell
Goto a line number ALT-x goto-line
Word wrap ALT-x toggle-word-wrap
Spell checking ALT-x flyspell-mode
Line numbers ALT-x linum-mode
Toggle line wrap ALT-x visual-line-mode
Compile some code ALT-x compile
List packages ALT-x package-list-packages
# Sudoing within eshell
By default when using the sudo command within eshell you'll just
get "permission denied" messages. To overcome that type:
alias sudo '*sudo $*'
# Line numbers
To add line numbers and enable moving to a line with CTRL-l:
(global-set-key "\C-l" 'goto-line)
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
# Org-mode
To begin org-mode ALT-x org-mode
Table column separator Vertical/pipe character
Reorganize table TAB
Section heading *
Open/collapse section TAB
Open/collapse All CTRL-TAB
Export in other file formats (eg HTML,PDF) CTRL-c CTRL-e
To make org-mode automatically wrap lines:
(add-hook 'org-mode-hook
'(lambda ()
(visual-line-mode 1)))

View File

@ -1,12 +0,0 @@
# Print file metadata etc.
ffmpeg -i path/to/file.ext
# Convert all m4a files to mp3
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 320k "${f%.m4a}.mp3"; done
# Listen to 10 seconds of audio from a video file
#
# -ss : start time
# -t : seconds to cut
# -autoexit : closes ffplay as soon as the audio finishes
ffmpeg -ss 00:34:24.85 -t 10 -i path/to/file.mp4 -f mp3 pipe:play | ffplay -i pipe:play -autoexit

View File

@ -1,44 +0,0 @@
# To find files by case-insensitive extension (ex: .jpg, .JPG, .jpG):
find . -iname "*.jpg"
# To find directories:
find . -type d
# To find files:
find . -type f
# To find files by octal permission:
find . -type f -perm 777
# To find files with setuid bit set:
find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l
# To find files with extension '.txt' and remove them:
find ./path/ -name '*.txt' -exec rm '{}' \;
# To find files with extension '.txt' and look for a string into them:
find ./path/ -name '*.txt' | xargs grep 'string'
# To find files with size bigger than 5 Mb and sort them by size:
find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z
# To find files bigger thank 2 MB and list them:
find . -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
# To find files modified more than 7 days ago and list file information
find . -type f -mtime +7d -ls
# To find symlinks owned by a user and list file information
find . -type l --user=username -ls
# To search for and delete empty directories
find . -type d -empty -exec rmdir {} \;
# To search for directories named build at a max depth of 2 directories
find . -maxdepth 2 -name build -type d
# To search all files who are not in .git directory
find . ! -iwholename '*.git*' -type f
# Find all files that have the same node (hard link) as MY_FILE_HERE
find . -type f -samefile MY_FILE_HERE 2>/dev/null

View File

@ -1,17 +0,0 @@
# basic loop
for i in 1 2 3 4 5 6 7 8 9 10
do
echo $i
done
# loop ls command results
for var in `ls -alF`
do
echo $var
done
# loop specified number of times
for i in `seq 1 10`
do
echo $i
done

View File

@ -1,21 +0,0 @@
# Compile a file
gcc file.c
# Compile a file with a custom output
gcc -o file file.c
# Debug symbols
gcc -g
# Debug with all symbols.
gcc -ggdb3
# Build for 64 bytes
gcc -m64
# Include the directory {/usr/include/myPersonnal/lib/} to the list of path for #include <....>
# With this option, no warning / error will be reported for the files in {/usr/include/myPersonnal/lib/}
gcc -isystem /usr/include/myPersonnal/lib/
# Build a GUI for windows (Mingw) (Will disable the term/console)
gcc -mwindows

View File

@ -1,26 +0,0 @@
# start the debugger
gdb your-executable
# set a breakpoint
b some-method, break some-method
# run the program
r, run
# when a breakpoint was reached:
# run the current line, stepping over any invocations
n, next
# run the current line, stepping into any invocations
s, step
# print a stacktrace
bt, backtrace
# evaluate an expression and print the result
p length=strlen(string)
# list surrounding source code
l, list
# continue execution
c, continue
# exit gdb (after program terminated)
q, quit

View File

@ -1,106 +0,0 @@
# To set your identity:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
# To set your editor:
git config --global core.editor emacs
# To enable color:
git config --global color.ui true
# To stage all changes for commit:
git add --all
# To commit staged changes
git commit -m "Your commit message"
# To edit previous commit message
git commit --amend
# Git commit in the past
git commit --date="`date --date='2 day ago'`"
git commit --date="Jun 13 18:30:25 IST 2015"
# more recent versions of Git also support --date="2 days ago" directly
# To change the date of an existing commit
git filter-branch --env-filter \
'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ]
then
export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800"
export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700"
fi'
# To removed staged and working directory changes
git reset --hard
# To go 2 commits back
git reset --hard HEAD~2
# To remove untracked files
git clean -f -d
# To remove untracked and ignored files
git clean -f -d -x
# To push to the tracked master branch:
git push origin master
# To push to a specified repository:
git push git@github.com:username/project.git
# To delete the branch "branch_name"
git branch -D branch_name
# To make an exisiting branch track a remote branch
git branch -u upstream/foo
# To see who commited which line in a file
git blame filename
# To sync a fork with the master repo:
git remote add upstream git@github.com:name/repo.git # Set a new repo
git remote -v # Confirm new remote repo
git fetch upstream # Get branches
git branch -va # List local - remote branches
git checkout master # Checkout local master branch
git checkout -b new_branch # Create and checkout a new branch
git merge upstream/master # Merge remote into local repo
git show 83fb499 # Show what a commit did.
git show 83fb499:path/fo/file.ext # Shows the file as it appeared at 83fb499.
git diff branch_1 branch_2 # Check difference between branches
git log # Show all the commits
git status # Show the changes from last commit
# Commit history of a set of files
git log --pretty=email --patch-with-stat --reverse --full-index -- Admin\*.py > Sripts.patch
# Import commits from another repo
git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k
# View commits that will be pushed
git log @{u}..
# View changes that are new on a feature branch
git log -p feature --not master
git diff master...feature
# Interactive rebase for the last 7 commits
git rebase -i @~7
# Diff files WITHOUT considering them a part of git
# This can be used to diff files that are not in a git repo!
git diff --no-index path/to/file/A path/to/file/B
# To pull changes while overwriting any local commits
git fetch --all
git reset --hard origin/master
# Update all your submodules
git submodule update --init --recursive
# Perform a shallow clone to only get latest commits
# (helps save data when cloning large repos)
git clone --depth 1 <remote-url>
# To unshallow a clone
git pull --unshallow

View File

@ -1,173 +0,0 @@
# Create a key
gpg --gen-key
# Show keys
To list a summary of all keys
gpg --list-keys
To show your public key
gpg --armor --export
To show the fingerprint for a key
gpg --fingerprint KEY_ID
# Search for keys
gpg --search-keys 'user@emailaddress.com'
# To Encrypt a File
gpg --encrypt --recipient 'user@emailaddress.com' example.txt
# To Decrypt a File
gpg --output example.txt --decrypt example.txt.gpg
# Export keys
gpg --output ~/public_key.txt --armor --export KEY_ID
gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID
Where KEY_ID is the 8 character GPG key ID.
Store these files to a safe location, such as a USB drive, then
remove the private key file.
shred -zu ~/private_key.txt
# Import keys
Retrieve the key files which you previously exported.
gpg --import ~/public_key.txt
gpg --allow-secret-key-import --import ~/private_key.txt
Then delete the private key file.
shred -zu ~/private_key.txt
# Revoke a key
Create a revocation certificate.
gpg --output ~/revoke.asc --gen-revoke KEY_ID
Where KEY_ID is the 8 character GPG key ID.
After creating the certificate import it.
gpg --import ~/revoke.asc
Then ensure that key servers know about the revokation.
gpg --send-keys KEY_ID
# Signing and Verifying files
If you're uploading files to launchpad you may also want to include
a GPG signature file.
gpg -ba filename
or if you need to specify a particular key:
gpg --default-key <key ID> -ba filename
This then produces a file with a .asc extension which can be uploaded.
If you need to set the default key more permanently then edit the
file ~/.gnupg/gpg.conf and set the default-key parameter.
To verify a downloaded file using its signature file.
gpg --verify filename.asc
# Signing Public Keys
Import the public key or retrieve it from a server.
gpg --keyserver <keyserver> --recv-keys <Key_ID>
Check its fingerprint against any previously stated value.
gpg --fingerprint <Key_ID>
Sign the key.
gpg --sign-key <Key_ID>
Upload the signed key to a server.
gpg --keyserver <keyserver> --send-key <Key_ID>
# Change the email address associated with a GPG key
gpg --edit-key <key ID>
adduid
Enter the new name and email address. You can then list the addresses with:
list
If you want to delete a previous email address first select it:
uid <list number>
Then delete it with:
deluid
To finish type:
save
Publish the key to a server:
gpg --send-keys <key ID>
# Creating Subkeys
Subkeys can be useful if you don't wish to have your main GPG key
installed on multiple machines. In this way you can keep your
master key safe and have subkeys with expiry periods or which may be
separately revoked installed on various machines. This avoids
generating entirely separate keys and so breaking any web of trust
which has been established.
gpg --edit-key <key ID>
At the prompt type:
addkey
Choose RSA (sign only), 4096 bits and select an expiry period.
Entropy will be gathered.
At the prompt type:
save
You can also repeat the procedure, but selecting RSA (encrypt only).
To remove the master key, leaving only the subkey/s in place:
gpg --export-secret-subkeys <subkey ID> > subkeys
gpg --export <key ID> > pubkeys
gpg --delete-secret-key <key ID>
Import the keys back.
gpg --import pubkeys subkeys
Verify the import.
gpg -K
Should show sec# instead of just sec.

View File

@ -1,29 +0,0 @@
# Search a file for a pattern
grep pattern file
# Case insensitive search (with line numbers)
grep -in pattern file
# Recursively grep for string <pattern> in folder:
grep -R pattern folder
# Read search patterns from a file (one per line)
grep -f pattern_file file
# Find lines NOT containing pattern
grep -v pattern file
# You can grep with regular expressions
grep "^00" file #Match lines starting with 00
grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add
# Find all files which match {pattern} in {directory}
# This will show: "file:line my research"
grep -rnw 'directory' -e "pattern"
# Exclude grep from your grepped output of ps.
# Add [] to the first letter. Ex: sshd -> [s]shd
ps aux | grep '[h]ttpd'
# Colour in red {bash} and keep all other lines
ps aux | grep -E --color 'bash|$'

View File

@ -1,3 +0,0 @@
# To reduce the size of a pdf file:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf

View File

@ -1,17 +0,0 @@
# To create a *.gz compressed file
gzip test.txt
# To create a *.gz compressed file to a specific location using -c option (standard out)
gzip -c test.txt > test_custom.txt.gz
# To uncompress a *.gz file
gzip -d test.txt.gz
# Display compression ratio of the compressed file using gzip -l
gzip -l *.gz
# Recursively compress all the files under a specified directory
gzip -r documents_directory
# To create a *.gz compressed file and keep the original
gzip < test.txt > test.txt.gz

View File

@ -1,32 +0,0 @@
# Display all hardware details
sudo lshw
# List currently loaded kernel modules
lsmod
# List all modules available to the system
find /lib/modules/$(uname -r) -type f -iname "*.ko"
# Load a module into kernel
modprobe modulename
# Remove a module from kernel
modprobe -r modulename
# List devices connected via pci bus
lspci
# Debug output for pci devices (hex)
lspci -vvxxx
# Display cpu hardware stats
cat /proc/cpuinfo
# Display memory hardware stats
cat /proc/meminfo
# Output the kernel ring buffer
dmesg
# Ouput kernel messages
dmesg --kernel

View File

@ -1,8 +0,0 @@
# To show the first 10 lines of file
head file
# To show the first N lines of file
head -n N file
# To show the first N bytes of file
head -c N file

View File

@ -1,3 +0,0 @@
# To see most used top 10 commands:
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10

View File

@ -1,195 +0,0 @@
# Custom HTTP method HTTP headers and JSON data:
http PUT example.org X-API-Token:123 name=John
# Submitting forms:
http -f POST example.org hello=World
# See the request that is being sent using one of the output options:
http -v example.org
# Use Github API to post a comment on an issue with authentication:
http -a USERNAME POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome!'
# Upload a file using redirected input:
http example.org < file.json
# Download a file and save it via redirected output:
http example.org/file > file
# Download a file wget style:
http --download example.org/file
# Use named sessions_ to make certain aspects or the communication
# persistent between requests to the same host:
# http --session=logged-in -a username:password httpbin.org/get API-Key:123
http --session=logged-in httpbin.org/headers
# Set a custom Host header to work around missing DNS records:
http localhost:8000 Host:example.com
# Simple JSON example:
http PUT example.org name=John email=john@example.org
# Non-string fields use the := separator, which allows you to embed raw
# JSON into the resulting object. Text and raw JSON files can also be
# embedded into fields using =@ and :=@:
http PUT api.example.com/person/1 name=John age:=29 married:=false hobbies:='["http", "pies"]' description=@about-john.txt bookmarks:=@bookmarks.json
# Send JSON data stored in a file:
http POST api.example.com/person/1 < person.json
# Regular Forms
http --form POST api.example.org/person/1 name='John Smith' email=john@example.org cv=@~/Documents/cv.txt
# File Upload Forms
# If one or more file fields is present, the serialization and content
# type is multipart/form-data:
http -f POST example.com/jobs name='John Smith' cv@~/Documents/cv.pdf
# To set custom headers you can use the Header:Value notation:
http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' X-Foo:Bar Referer:http://httpie.org/
# Basic auth:
http -a username:password example.org
# Digest auth:
http --auth-type=digest -a username:password example.org
# With password prompt:
http -a username example.org
# Authorization information from your ~/.netrc file is honored as well:
cat ~/.netrc
machine httpbin.org
login httpie
# password test
http httpbin.org/basic-auth/httpie/test
# You can specify proxies to be used through the --proxy argument for each
# protocol (which is included in the value in case of redirects across
# protocols):
http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org
# With Basic authentication:
http --proxy=http:http://user:pass@10.10.1.10:3128 example.org
# To skip the HOST'S SSL CERTIFICATE VERIFICATION, you can pass
# --verify=no (default is yes):
http --verify=no https://example.org
# You can also use --verify=<CA_BUNDLE_PATH> to set a CUSTOM CA BUNDLE path:
http --verify=/ssl/custom_ca_bundle https://example.org
# To use a CLIENT SIDE CERTIFICATE for the SSL communication, you can pass
# the path of the cert file with --cert:
http --cert=client.pem https://example.org
# If the PRIVATE KEY is not contained in the cert file you may pass the
# path of the key file with --cert-key:
http --cert=client.crt --cert-key=client.key https://example.org
# You can control what should be printed via several options:
# --headers, -h Only the response headers are printed.
# --body, -b Only the response body is printed.
# --verbose, -v Print the whole HTTP exchange (request and response).
# --print, -p Selects parts of the HTTP exchange.
http --verbose PUT httpbin.org/put hello=world
# Print request and response headers:
# Character Stands for
# ----------- -------------------
# H Request headers.
# B Request body.
# h Response headers.
# b Response body.
http --print=Hh PUT httpbin.org/put hello=world
# Let's say that there is an API that returns the whole resource when it
# is updated, but you are only interested in the response headers to see
# the status code after an update:
http --headers PATCH example.org/Really-Huge-Resource name='New Name'
# Redirect from a file:
http PUT example.com/person/1 X-API-Token:123 < person.json
# Or the output of another program:
grep '401 Unauthorized' /var/log/httpd/error_log | http POST example.org/intruders
# You can use echo for simple data:
echo '{"name": "John"}' | http PATCH example.com/person/1 X-API-Token:123
# You can even pipe web services together using HTTPie:
http GET https://api.github.com/repos/jkbrzt/httpie | http POST httpbin.org/post
# You can use cat to enter multiline data on the terminal:
cat | http POST example.com
<paste>
# ^D
cat | http POST example.com/todos Content-Type:text/plain
- buy milk
- call parents
^D
# On OS X, you can send the contents of the clipboard with pbpaste:
pbpaste | http PUT example.com
# Passing data through stdin cannot be combined with data fields specified
# on the command line:
echo 'data' | http POST example.org more=data # This is invalid
# AN ALTERNATIVE TO REDIRECTED stdin is specifying a filename (as
# @/path/to/file) whose content is used as if it came from stdin.
# It has the advantage that THE Content-Type HEADER IS AUTOMATICALLY SET
# to the appropriate value based on the filename extension. For example,
# the following request sends the verbatim contents of that XML file with
# Content-Type: application/xml:
http PUT httpbin.org/put @/data/file.xml
# Download a file:
http example.org/Movie.mov > Movie.mov
# Download an image of Octocat, resize it using ImageMagick, upload it
# elsewhere:
http octodex.github.com/images/original.jpg | convert - -resize 25% - | http example.org/Octocats
# Force colorizing and formatting, and show both the request and the
# response in less pager:
http --pretty=all --verbose example.org | less -R
# When enabled using the --download, -d flag, response headers are printed
# to the terminal (stderr), and a progress bar is shown while the response
# body is being saved to a file.
http --download https://github.com/jkbrzt/httpie/tarball/master
# You can also redirect the response body to another program while the
# response headers and progress are still shown in the terminal:
http -d https://github.com/jkbrzt/httpie/tarball/master | tar zxf -
# If --output, -o is specified, you can resume a partial download using
# the --continue, -c option. This only works with servers that support
# Range requests and 206 Partial Content responses. If the server doesn't
# support that, the whole file will simply be downloaded:
http -dco file.zip example.org/file
# Prettified streamed response:
http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track='Justin Bieber'
# Send each new tweet (JSON object) mentioning "Apple" to another
# server as soon as it arrives from the Twitter streaming API:
http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track=Apple | while read tweet; do echo "$tweet" | http POST example.org/tweets ; done
# Create a new session named user1 for example.org:
http --session=user1 -a user1:password example.org X-Foo:Bar
# Now you can refer to the session by its name, and the previously used
# authorization and HTTP headers will automatically be set:
http --session=user1 example.org
# To create or reuse a different session, simple specify a different name:
http --session=user2 -a user2:password example.org X-Bar:Foo
# Instead of a name, you can also directly specify a path to a session
# file. This allows for sessions to be re-used across multiple hosts:
http --session=/tmp/session.json example.orghttp --session=/tmp/session.json admin.example.orghttp --session=~/.httpie/sessions/another.example.org/test.json example.orghttp --session-read-only=/tmp/session.json example.org

View File

@ -1,74 +0,0 @@
As a contributor to open-source
-------------------------------
# clone your own project
$ git clone dotfiles
→ git clone git://github.com/YOUR_USER/dotfiles.git
# clone another project
$ git clone github/hub
→ git clone git://github.com/github/hub.git
# see the current project's issues
$ git browse -- issues
→ open https://github.com/github/hub/issues
# open another project's wiki
$ git browse mojombo/jekyll wiki
→ open https://github.com/mojombo/jekyll/wiki
## Example workflow for contributing to a project:
$ git clone github/hub
$ cd hub
# create a topic branch
$ git checkout -b feature
→ ( making changes ... )
$ git commit -m "done with feature"
# It's time to fork the repo!
$ git fork
→ (forking repo on GitHub...)
→ git remote add YOUR_USER git://github.com/YOUR_USER/hub.git
# push the changes to your new remote
$ git push YOUR_USER feature
# open a pull request for the topic branch you've just pushed
$ git pull-request
→ (opens a text editor for your pull request message)
As an open-source maintainer
----------------------------
# fetch from multiple trusted forks, even if they don't yet exist as remotes
$ git fetch mislav,cehoffman
→ git remote add mislav git://github.com/mislav/hub.git
→ git remote add cehoffman git://github.com/cehoffman/hub.git
→ git fetch --multiple mislav cehoffman
# check out a pull request for review
$ git checkout https://github.com/github/hub/pull/134
→ (creates a new branch with the contents of the pull request)
# directly apply all commits from a pull request to the current branch
$ git am -3 https://github.com/github/hub/pull/134
# cherry-pick a GitHub URL
$ git cherry-pick https://github.com/xoebus/hub/commit/177eeb8
→ git remote add xoebus git://github.com/xoebus/hub.git
→ git fetch xoebus
→ git cherry-pick 177eeb8
# `am` can be better than cherry-pick since it doesn't create a remote
$ git am https://github.com/xoebus/hub/commit/177eeb8
# open the GitHub compare view between two releases
$ git compare v0.9..v1.0
# put compare URL for a topic branch to clipboard
$ git compare -u feature | pbcopy
# create a repo for a new project
$ git init
$ git add . && git commit -m "It begins."
$ git create -d "My new thing"
→ (creates a new project on GitHub with the name of current directory)
$ git push origin master

View File

@ -1,14 +0,0 @@
# Display network settings of the first ethernet adapter
ifconfig wlan0
# Display all interfaces, even if down
ifconfig -a
# Take down / up the wireless adapter
ifconfig wlan0 {up|down}
# Set a static IP and netmask
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
# You may also need to add a gateway IP
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1

View File

@ -1,2 +0,0 @@
# format C/C++ source according to the style of Kernighan and Ritchie (K&R), no tabs, 3 spaces per indent, wrap lines at 120 characters.
indent -i3 -kr -nut -l120

View File

@ -1,32 +0,0 @@
# Display all interfaces with addresses
ip addr
# Take down / up the wireless adapter
ip link set dev wlan0 {up|down}
# Set a static IP and netmask
ip addr add 192.168.1.100/32 dev eth0
# Remove a IP from an interface
ip addr del 192.168.1.100/32 dev eth0
# Remove all IPs from an interface
ip address flush dev eth0
# Display all routes
ip route
# Display all routes for IPv6
ip -6 route
# Add default route via gateway IP
ip route add default via 192.168.1.1
# Add route via interface
ip route add 192.168.0.0/24 dev eth0
# Change your mac address
ip link set dev eth0 address aa:bb:cc:dd:ee:ff
# View neighbors (using ARP and NDP)
ip neighbor show

View File

@ -1,40 +0,0 @@
# Show hit for rules with auto refresh
watch --interval 0 'iptables -nvL | grep -v "0 0"'
# Show hit for rule with auto refresh and highlight any changes since the last refresh
watch -d -n 2 iptables -nvL
# Block the port 902 and we hide this port from nmap.
iptables -A INPUT -i eth0 -p tcp --dport 902 -j REJECT --reject-with icmp-port-unreachable
# Note, --reject-with accept:
# icmp-net-unreachable
# icmp-host-unreachable
# icmp-port-unreachable <- Hide a port to nmap
# icmp-proto-unreachable
# icmp-net-prohibited
# icmp-host-prohibited or
# icmp-admin-prohibited
# tcp-reset
# Add a comment to a rule:
iptables ... -m comment --comment "This rule is here for this reason"
# To remove or insert a rule:
# 1) Show all rules
iptables -L INPUT --line-numbers
# OR iptables -nL --line-numbers
# Chain INPUT (policy ACCEPT)
# num target prot opt source destination
# 1 ACCEPT udp -- anywhere anywhere udp dpt:domain
# 2 ACCEPT tcp -- anywhere anywhere tcp dpt:domain
# 3 ACCEPT udp -- anywhere anywhere udp dpt:bootps
# 4 ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
# 2.a) REMOVE (-D) a rule. (here an INPUT rule)
iptables -D INPUT 2
# 2.b) OR INSERT a rule.
iptables -I INPUT {LINE_NUMBER} -i eth1 -p tcp --dport 21 -s 123.123.123.123 -j ACCEPT -m comment --comment "This rule is here for this reason"

View File

@ -1,26 +0,0 @@
# To connect to an IRC server
/connect <server domain name>
# To join a channel
/join #<channel name>
# To set a nickname
/nick <my nickname>
# To send a private message to a user
/msg <nickname>
# To close the current channel window
/wc
# To switch between channel windows
ALT+<number>, eg. ALT+1, ALT+2
# To list the nicknames within a channel
/names
# To change the topic
/topic <description>
# To quit irssi
/exit

View File

@ -1,8 +0,0 @@
# Display wireless settings of the first wireless adapter
iwconfig wlan0
# Take down / up the wireless adapter
iwconfig wlan0 txpower {on|auto|off}
# Change the mode of the wireless adapter
iwconfig wlan0 mode {managed|ad-hoc|monitor}

View File

@ -1,32 +0,0 @@
# Actively follow log (like tail -f)
journalctl -f
# Display all errors since last boot
journalctl -b -p err
# Filter by time period
journalctl --since=2012-10-15 --until="2011-10-16 23:59:59"
# Show list of systemd units logged in journal
journalctl -F _SYSTEMD_UNIT
# Filter by specific unit
journalctl -u dbus
# Filter by executable name
journalctl /usr/bin/dbus-daemon
# Filter by PID
journalctl _PID=123
# Filter by Command, e.g., sshd
journalctl _COMM=sshd
# Filter by Command and time period
journalctl _COMM=crond --since '10:00' --until '11:00'
# List all available boots
journalctl --list-boots
# Filter by specific User ID e.g., user id 1000
journalctl _UID=1000

View File

@ -1,13 +0,0 @@
# Pretty print the json
jq "." < filename.json
# Access the value at key "foo"
jq '.foo'
# Access first list item
jq '.[0]'
# Slice & Dice
jq '.[2:4]'
jq '.[:3]'
jq '.[-2:]'

View File

@ -1,25 +0,0 @@
# Add entry to default jrnl (from your configured text editor)
jrnl
# Add entry to default jrnl
jrnl Write entry here.
# List of tags
jrnl --tags
# Entries per tag
jrnl @tag
# Export jrnl as json
jrnl --export json
# Entries in a timeframe
jrnl -from 2009 -until may
# Add Sublime text to .jrnl_config
# Windows
"editor": "F:\\Powerpack\\Sublime\\sublime_text.exe -w"
# Linux
"editor": "/usr/bin/sublime -w"

View File

@ -1,2 +0,0 @@
# To disable the terminal refresh when exiting
less -X

View File

@ -1,23 +0,0 @@
# Display available libraries
ldconfig -p
# Update library resources
ldconfig
# Display libraries and file location
ldd
# Libraries available to apps in real-time
"Dynamic Libraries" (.so.)
# Libraries only available to apps when installed (imported)
"Static Libraries" (.a.)
# Standard (usual) library file location
/lib
# Sofware-accessible source for library info
/etc/ld.so.cache # (binary)
# Human-readable source for library info
/etc/ld.so.conf # (points to /etc/ld.so.conf.d)

View File

@ -1,5 +0,0 @@
# To create a symlink:
ln -s path/to/the/target/directory name-of-symlink
# Symlink, while overwriting existing destination files
ln -sf /some/dir/exec /usr/bin/exec

View File

@ -1,17 +0,0 @@
# Displays everything in the target directory
ls path/to/the/target/directory
# Displays everything including hidden files
ls -a
# Displays all files, along with the size (with unit suffixes) and timestamp
ls -lh
# Display files, sorted by size
ls -S
# Display directories only
ls -d */
# Display directories only, include hidden
ls -d .*/ */

View File

@ -1,23 +0,0 @@
# List all IPv4 network files
sudo lsof -i4
# List all IPv6 network files
sudo lsof -i6
# To find listening ports:
lsof -Pnl +M -i4
# To find which program is using the port 80:
lsof -i TCP:80
# List all processes accessing a particular file/directory
lsof </path/to/file>
# List all files open for a particular user
lsof -u <username>
# List all files/network connections a given process is using
lsof -c <command-name>
# See this primer: http://www.danielmiessler.com/study/lsof/
# for a number of other useful lsof tips

View File

@ -1,7 +0,0 @@
#Exclusive Activation of a Volume Group in a Cluster
#Link --> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/High_Availability_Add-On_Administration/s1-exclusiveactive-HAAA.html
1> vgs --noheadings -o vg_name
2> volume_list = [ "rhel_root", "rhel_home" ]
3> dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
4> Reboot the node
5> uname -r to verify the correct initrd image

View File

@ -1,5 +0,0 @@
# Convert a man page to pdf
man -t bash | ps2pdf - bash.pdf
# View the ascii chart
man 7 ascii

View File

@ -1,44 +0,0 @@
# headers
h1 header
=========
h2 header
---------
# blockquotes
> first level and paragraph
>> second level and first paragraph
>
> first level and second paragraph
# lists
## unordered - use *, +, or -
* Red
* Green
* Blue
## ordered
1. First
2. Second
3. Third
# code - use 4 spaces/1 tab
regular text
code code code
or:
Use the `printf()` function
# hr's - three or more of the following
***
---
___
# links
This is [an example](http://example.com "Title") inline link.
# image
![Alt Text](/path/to/file.png)
# emphasis
*em* _em_
**strong** __strong__

View File

@ -1,58 +0,0 @@
# For the sake of briefness, we use Bash "group compound" stanza:
# /dev/sd{a,b,...}1 => /dev/sda1 /dev/sdb1 ...
# Along the following variables:
# ${M} array identifier (/dev/md${M})
# ${D} device identifier (/dev/sd${D})
# ${P} partition identifier (/dev/sd${D}${P})
# Create (initialize) a new array
mdadm --create /dev/md${M} --level=raid5 --raid-devices=4 /dev/sd{a,b,c,d,e}${P} --spare-devices=/dev/sdf1
# Manually assemble (activate) an existing array
mdadm --assemble /dev/md${M} /dev/sd{a,b,c,d,e}${P}
# Automatically assemble (activate) all existing arrays
mdadm --assemble --scan
# Stop an assembled (active) array
mdadm --stop /dev/md${M}
# See array configuration
mdadm --query /dev/md${M}
# See array component configuration (dump superblock content)
mdadm --query --examine /dev/sd${D}${P}
# See detailed array confiration/status
mdadm --detail /dev/md${M}
# Save existing arrays configuration
# (MAY be required by initrd for successfull boot)
mdadm --detail --scan > /etc/mdadm/mdadm.conf
# Erase array component superblock
# (MUST do before reusing a partition for other purposes)
mdadm --zero-superblock /dev/sd${D}${P}
# Manually mark a component as failed
# (SHOULD when a device shows wear-and-tear signs, e.g. through SMART)
mdadm --manage /dev/md${M} --fail /dev/sd${D}${P}
# Remove a failed component
# (SHOULD before preemptively replacing a device, after failing it)
mdadm --manage /dev/md${M} --remove /dev/sd${D}${P}
# Prepare (format) a new device to replace a failed one
sfdisk -d /dev/sd${D,sane} | sfdisk /dev/sd${D,new}
# Add new component to an existing array
# (this will trigger the rebuild)
mdadm --manage /dev/md${M} --add /dev/sd${D,new}${P}
# See assembled (active) arrays status
cat /proc/mdstat
# Rename a device
# (SHOULD after hostname change; eg. name="$(hostname -s)")
mdadm --assemble /dev/md${M} /dev/sd{a,b,c,d,e}${P} --name="${name}:${M}" --update=name

View File

@ -1,9 +0,0 @@
# Create a directory and all its parents
mkdir -p foo/bar/baz
# Create foo/bar and foo/baz directories
mkdir -p foo/{bar,baz}
# Create the foo/bar, foo/baz, foo/baz/zip and foo/baz/zap directories
mkdir -p foo/{bar,baz/{zip,zap}}

View File

@ -1,3 +0,0 @@
# To show the file start at line number 5
more +5 file

View File

@ -1,14 +0,0 @@
# To mount / partition as read-write in repair mode:
mount -o remount,rw /
# Bind mount path to a second location
mount --bind /origin/path /destination/path
# To mount Usb disk as user writable:
mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx
# To mount a remote NFS directory
mount -t nfs example.com:/remote/example/dir /local/example/dir
# To mount an ISO
mount -o loop disk1.iso /mnt/disk

View File

@ -1,31 +0,0 @@
# To connect to a database
mysql -h localhost -u root -p
# To backup all databases
mysqldump --all-databases --all-routines -u root -p > ~/fulldump.sql
# To restore all databases
mysql -u root -p < ~/fulldump.sql
# To create a database in utf8 charset
CREATE DATABASE owa CHARACTER SET utf8 COLLATE utf8_general_ci;
# To add a user and give rights on the given database
GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'IDENTIFIED BY 'password' WITH GRANT OPTION;
# To list the privileges granted to the account that you are using to connect to the server. Any of the 3 statements will work.
SHOW GRANTS FOR CURRENT_USER();
SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
# Basic SELECT Statement
SELECT * FROM tbl_name;
# Basic INSERT Statement
INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2);
# Basic UPDATE Statement
UPDATE tbl_name SET col1 = "example";
# Basic DELETE Statement
DELETE FROM tbl_name WHERE user = 'jcole';

View File

@ -1,23 +0,0 @@
# To dump a database to a file (Note that your password will appear in your command history!):
mysqldump -uusername -ppassword the-database > db.sql
# To dump a database to a file:
mysqldump -uusername -p the-database > db.sql
# To dump a database to a .tgz file (Note that your password will appear in your command history!):
mysqldump -uusername -ppassword the-database | gzip -9 > db.sql
# To dump a database to a .tgz file:
mysqldump -uusername -p the-database | gzip -9 > db.sql
# To dump all databases to a file (Note that your password will appear in your command history!):
mysqldump -uusername -ppassword --all-databases > all-databases.sql
# To dump all databases to a file:
mysqldump -uusername -p --all-databases > all-databases.sql
# To export the database structure only:
mysqldump --no-data -uusername -p the-database > dump_file
# To export the database data only:
mysqldump --no-create-info -uusername -p the-database > dump_file

View File

@ -1,20 +0,0 @@
# To open a TCP connection to port 42 of host.example.com, using port 31337 as the source port, with a timeout of 5 seconds:
nc -p 31337 -w 5 host.example.com 42
# To open a UDP connection to port 53 of host.example.com:
nc -u host.example.com 53
# To open a TCP connection to port 42 of host.example.com using 10.1.2.3 as the IP for the local end of the connection:
nc -s 10.1.2.3 host.example.com 42
# To create and listen on a UNIX-domain stream socket:
nc -lU /var/tmp/dsocket
# To connect to port 42 of host.example.com via an HTTP proxy at 10.2.3.4, port 8080. This example could also be used by ssh(1); see the ProxyCommand directive in ssh_config(5) for more information.
nc -x10.2.3.4:8080 -Xconnect host.example.com 42
# The same example again, this time enabling proxy authentication with username "ruser" if the proxy requires it:
nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
# To choose the source IP for the testing using the -s option
nc -zv -s source_IP target_IP Port

View File

@ -1,30 +0,0 @@
# Connect mode (ncat is client) | default port is 31337
ncat <host> [<port>]
# Listen mode (ncat is server) | default port is 31337
ncat -l [<host>] [<port>]
# Transfer file (closes after one transfer)
ncat -l [<host>] [<port>] < file
# Transfer file (stays open for multiple transfers)
ncat -l --keep-open [<host>] [<port>] < file
# Receive file
ncat [<host>] [<port>] > file
# Brokering | allows for multiple clients to connect
ncat -l --broker [<host>] [<port>]
# Listen with SSL | many options, use ncat --help for full list
ncat -l --ssl [<host>] [<port>]
# Access control
ncat -l --allow <ip>
ncat -l --deny <ip>
# Proxying
ncat --proxy <proxyhost>[:<proxyport>] --proxy-type {http | socks4} <host>[<port>]
# Chat server | can use brokering for multi-user chat
ncat -l --chat [<host>] [<port>]

View File

@ -1,28 +0,0 @@
# WARNING ! netstat is deprecated. Look below.
# To view which users/processes are listening to which ports:
sudo netstat -lnptu
# To view routing table (use -n flag to disable DNS lookups):
netstat -r
# Which process is listening to port <port>
netstat -pln | grep <port> | awk '{print $NF}'
Example output: 1507/python
# Fast display of ipv4 tcp listening programs
sudo netstat -vtlnp --listening -4
# WARNING ! netstat is deprecated.
# Replace it by:
ss
# For netstat-r
ip route
# For netstat -i
ip -s link
# For netstat-g
ip maddr

View File

@ -1,29 +0,0 @@
# check the file's charactor code
nkf -g test.txt
# convert charactor code to UTF-8
nkf -w --overwrite test.txt
# convert charactor code to EUC-JP
nkf -e --overwrite test.txt
# convert charactor code to Shift-JIS
nkf -s --overwrite test.txt
# convert charactor code to ISO-2022-JP
nkf -j --overwrite test.txt
# convert newline to LF
nkf -Lu --overwrite test.txt
# convert newline to CRLF
nkf -Lw --overwrite test.txt
# convert newline to CR
nkf -Lm --overwrite test.txt
# MIME encode
echo テスト | nkf -WwMQ
# MIME decode
echo "=E3=83=86=E3=82=B9=E3=83=88" | nkf -WwmQ

View File

@ -1,69 +0,0 @@
# Single target scan:
nmap [target]
# Scan from a list of targets:
nmap -iL [list.txt]
# iPv6:
nmap -6 [target]
# OS detection:
nmap -O --osscan_guess [target]
# Save output to text file:
nmap -oN [output.txt] [target]
# Save output to xml file:
nmap -oX [output.xml] [target]
# Scan a specific port:
nmap -source-port [port] [target]
# Do an aggressive scan:
nmap -A [target]
# Speedup your scan:
# -n => disable ReverseDNS
# --min-rate=X => min X packets / sec
nmap -T5 --min-parallelism=50 -n --min-rate=300 [target]
# Traceroute:
nmap -traceroute [target]
# Ping scan only: -sP
# Don't ping: -PN <- Use full if a host don't reply to a ping.
# TCP SYN ping: -PS
# TCP ACK ping: -PA
# UDP ping: -PU
# ARP ping: -PR
# Example: Ping scan all machines on a class C network
nmap -sP 192.168.0.0/24
# Force TCP scan: -sT
# Force UDP scan: -sU
# Use some script:
nmap --script default,safe
# Loads the script in the default category, the banner script, and all .nse files in the directory /home/user/customscripts.
nmap --script default,banner,/home/user/customscripts
# Loads all scripts whose name starts with http-, such as http-auth and http-open-proxy.
nmap --script 'http-*'
# Loads every script except for those in the intrusive category.
nmap --script "not intrusive"
# Loads those scripts that are in both the default and safe categories.
nmap --script "default and safe"
# Loads scripts in the default, safe, or intrusive categories, except for those whose names start with http-.
nmap --script "(default or safe or intrusive) and not http-*"
# Scan for the heartbleed
# -pT:443 => Scan only port 443 with TCP (T:)
nmap -T5 --min-parallelism=50 -n --script "ssl-heartbleed" -pT:443 127.0.0.1
# Show all informations (debug mode)
nmap -d ...

View File

@ -1,4 +0,0 @@
# To send a desktop notification via dbus:
notify-send -i 'icon-file/name' -a 'application_name' 'summary' 'body of message'
# The -i and -a flags can be omitted if unneeded.

View File

@ -1,20 +0,0 @@
# To list VMs on current tenant:
nova list
# To list VMs of all tenants (admin user only):
nova list --all-tenants
# To boot a VM on a specific host:
nova boot --nic net-id=<net_id> \
--image <image_id> \
--flavor <flavor> \
--availability-zone nova:<host_name> <vm_name>
# To stop a server
nova stop <server>
# To start a server
nova start <server>
# To attach a network interface to a specific VM:
nova interface-attach --net-id <net_id> <server>

View File

@ -1,33 +0,0 @@
# Verify ntpd running:
service ntp status
# Start ntpd if not running:
service ntp start
# Display current hardware clock value:
sudo hwclock -r
# Apply system time to hardware time:
sudo hwclock --systohc
# Apply hardware time to system time:
sudo hwclock --hctosys
# Set hwclock to local time:
sudo hwclock --localtime
# Set hwclock to UTC:
sudo hwclock --utc
# Set hwclock manually:
sudo hwclock --set --date="8/10/15 13:10:05"
# Query surrounding stratum time servers
ntpq -pn
# Config file:
/etc/ntp.conf
# Driftfile:
location of "drift" of your system clock compared to ntp servers
/var/lib/ntp/ntp.drift

View File

@ -1,2 +0,0 @@
# Convert bytes to Human readable format
numfmt --to=iec --suffix=B --padding=7 1048576

View File

@ -1,11 +0,0 @@
# Dump file in octal format
od /path/to/binaryfile
od -o /path/to/binaryfile
od -t o2 /path/to/binaryfile
# Dump file in hexadecimal format
od -x /path/to/binaryfile
od -t x2 /path/to/binaryfile
# Dump file in hexadecimal format, with hexadecimal offsets and a space between each byte
od -A x -t x1 /path/to/binaryfile

View File

@ -1,24 +0,0 @@
# To create a 2048-bit private key:
openssl genrsa -out server.key 2048
# To create the Certificate Signing Request (CSR):
openssl req -new -key server.key -out server.csr
# To sign a certificate using a private key and CSR:
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
# (The above commands may be run in sequence to generate a self-signed SSL certificate.)
# To show certificate information for a certificate signing request
openssl req -text -noout -in server.csr
# To show certificate information for generated certificate
openssl x509 -text -noout -in server.crt
# To view certificate expiration:
echo | openssl s_client -connect <hostname>:443 2> /dev/null | \
awk '/-----BEGIN/,/END CERTIFICATE-----/' | \
openssl x509 -noout -enddate
# Generate Diffie-Hellman parameters:
openssl dhparam -outform PEM -out dhparams.pem 2048

View File

@ -1,5 +0,0 @@
# Print details related to Client and server configuration
p4 info
# Open a file and add it to depot
p4 add <filename>

View File

@ -1,48 +0,0 @@
# All the following command work as well with multiple package names
# To search for a package
pacman -Ss <package name>
# To update the local package base and upgrade all out of date packages
pacman -Suy
# To install a package
pacman -S <package name>
# To uninstall a package
pacman -R <package name>
# To uninstall a package and his depedencies, removing all new orphans
pacman -Rcs <package name>
# To get informations about a package
pacman -Si <package name>
# To install a package from builded package file (.tar.xz)
pacman -U <file name/file url>
# To list the commands provided by an installed package
pacman -Ql <package name> | sed -n -e 's/.*\/bin\///p' | tail -n +2
# To list explicitly installed packages
pacman -Qe
# To list orphan packages (installed as dependencies and not required anymore)
pacman -Qdt
# You can't directly install packages from the Arch User Database (AUR) with pacman.
# You need yaourt to perform that. But considering yaourt itself is in the AUR, here is how to build a package from its tarball.
# Installing a package from AUR is a relatively simple process:
# - Retrieve the archive corresponding to your package from AUR website
# - Extract the archive (preferably in a folder for this purpose)
# - Run makepkg in the extracted directory. (makepkg-s allows you to install any dependencies automatically from deposits.)
# - Install the package created using pacman
# Assuming $pkgname contains the package name.
wget "https://aur.archlinux.org/packages/${pkgname::2}/$pkgname/$pkgname.tar.gz"
tar zxvf "$pkgname.tar.gz"
cd "$pkgname"
# Build the package
makepkg -s
# Install
sudo pacman -U <package file (.pkg.tar.xz)>

View File

@ -1,15 +0,0 @@
# Concat columns from files
paste file1 file2 ...
# List the files in the current directory in three columns:
ls | paste - - -
# Combine pairs of lines from a file into single lines:
paste -s -d '\t\n' myfile
# Number the lines in a file, similar to nl(1):
sed = myfile | paste -s -d '\t\n' - -
# Create a colon-separated list of directories named bin,
# suitable for use in the PATH environment variable:
find / -name bin -type d | paste -s -d : -

Some files were not shown because too many files have changed in this diff Show More