Skip to content

Commit

Permalink
Update to Python3 (#29)
Browse files Browse the repository at this point in the history
- Upgrade the plugin to Python3 support.
  • Loading branch information
giovannicoppola authored Sep 17, 2022
1 parent 7dea081 commit b9a4ae4
Show file tree
Hide file tree
Showing 264 changed files with 9,811 additions and 1,154 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alfred-cheat <img src="icon.png" width="100" align="right"/> ![GitHub All Releases](https://img.shields.io/github/downloads/wx-Yao/alfred-cheat/total.svg)
# Alfred-cheat <img src="icon.png" width="100" align="right"/> ![GitHub All Releases](https://img.shields.io/github/downloads/wayneyaoo/alfred-cheat/total.svg)
**Start writing your very own cheat sheets in your way and make them searchable using Alfred!**

# Notice
Expand Down
49 changes: 49 additions & 0 deletions assets/cheatsheets/7z
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
tags: [ compression ]
---
7z [Args] [archive.7z] [files / folders to archive]
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

DO NOT USE the 7-zip format for backup purpose on Linux/Unix.
7-zip does not store the owner/group of the file.

On Linux/Unix, in order to backup directories you must use tar :
- to backup a directory : tar cf - directory | 7z a -si directory.tar.7z
- to restore your backup : 7z x -so directory.tar.7z | tar xf -

If you want to send files and directories (not the owner of file) to others
Unix/MacOS/Windows users, you can use the 7-zip format.

Example 1: Quick and Easy - Add all files in dir1 to archive.7z with Default Settings.
7z a archive.7z dir1

Example 2: Add all files in dir1 to archive.7z with Max Compression
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

Example 3: Add (store) all files in dir1 to archive.7z with No Compression
7z a -m0=copy archive.7z dir1

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
5 changes: 5 additions & 0 deletions assets/cheatsheets/ab
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To send 100 requests with a concurency of 50 requests to a URL:
ab -n 100 -c 50 <url>

# To send requests for 30 seconds with a concurency of 50 requests to a URL:
ab -t 30 -c 50 <url>
29 changes: 29 additions & 0 deletions assets/cheatsheets/acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Get ACL
getfacl <file>

# Add or modify ACL on file
setfacl -m u:username:rX <file>
setfacl -m g:groupname:rw <file>
setfacl -m o::- <file>

# or provide all permissions at once
setfacl -m u::rwx,g:groupname:rX,o::- <file>

# Copy ACL from file-A to file-B
getfacl file-A | setfacl -M - file-B

# Apply ACL recursivelly to directory
setfacl -R -m u:username:rX <directory>

# Delete ACL
setfacl -x u:username,g:groupname <file>

# Delete all ACL on file, including default
setfacl -b <file>

# Same operations works for default ACLs
setfacl -m d:u:username:rx <directory>
setfacl -x d:u:username <directory>

# Delete only default ACLs
setfacl -k <directory>
11 changes: 11 additions & 0 deletions assets/cheatsheets/ag
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To exclude a directory from a search:
ag <phrase> --ignore-dir=<dir>

# To exclude a file from a search:
ag <phrase> --ignore=<file>

# To force colorization:
ag <phrase> --color | less -R

# To search for <phrase> in files whose names match <pattern>:
ag <phrase> -G <pattern>
8 changes: 8 additions & 0 deletions assets/cheatsheets/alias
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# To show a list of your current shell aliases:
alias

# To alias `ls -l` to `ll`:
alias ll='ls -l'

# To remove alias:
unalias ll
72 changes: 72 additions & 0 deletions assets/cheatsheets/ansi
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Reset
Color_Off='\e[0m' # Text Reset

# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White

# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White

# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White

# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White

# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White

# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White

# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
5 changes: 5 additions & 0 deletions assets/cheatsheets/ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tags: [ orchestration ]
---
# To run a command on multiple instances at once - using `servers` group from `inventory.yml`:
ansible -u ansible -i inventory.yml servers -m shell -a "ls /var"
20 changes: 20 additions & 0 deletions assets/cheatsheets/ansible-galaxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
tags: [ orchestration ]
---
# To install a role:
ansible-galaxy install <user>.<role>

# To remove a role:
ansible-galaxy remove <user>.<role>

# To list installed roles:
ansible-galaxy list

# To search for a given role:
ansible-galaxy search <role>

# To create a new role:
ansible-galaxy init <role>

# To get the information for the role # or a collection if you replace `role` with `collection`:
ansible-galaxy role info <user>.<role>
5 changes: 5 additions & 0 deletions assets/cheatsheets/ansible-vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tags: [ orchestration ]
---
# To enncrypt string using keyfile `backup_encryption_key`:
ansible-vault encrypt_string 'SupersecretPa$$phrase' --name 'backup_encryption_key'
17 changes: 17 additions & 0 deletions assets/cheatsheets/apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
tags: [ packaging ]
---
# To install a package:
apk add <package>

# To remove a package:
apk del <package>

# To update repos:
apk update

# To upgrade all packages:
apk upgrade

# To find a package:
apk search <package>
18 changes: 18 additions & 0 deletions assets/cheatsheets/apparmor
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# apparmor will protect a 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 available profiles: /etc/apparmor.d/
36 changes: 36 additions & 0 deletions assets/cheatsheets/apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
tags: [ packaging ]
---
# To find packages matching <phrase>:
apt search <phrase>

# To show information on a package:
apt show <package>

# To fetch package list:
apt update

# To download and install the updates and (UNLIKE apt-get) install new necessary packages:
apt upgrade

# To download and install the updates AND install new necessary packages
# AND remove packages that stand in the way of the upgrade - use with caution!
apt dist-upgrade

# To perform a full system upgrade:
apt update && apt upgrade # use dist-upgrade carefully if needed

# To install package(s):
apt install <package>...

# To uninstall package(s):
apt remove <package>...

# To remove automatically all unused packages:
apt autoremove

# To list dependencies of a package:
apt depends <package>...

# To remove packages and delete their config files:
apt purge <package>...
19 changes: 19 additions & 0 deletions assets/cheatsheets/apt-cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
tags: [ packaging ]
---
# To find packages matching <phrase>:
apt-cache search <phrase>

# To display package records for the named package(s):
apt-cache show <package>...

# To display reverse dependencies of a package:
apt-cache rdepends <package>

# To display package versions, reverse dependencies and forward dependencies of
# a package
apt-cache showpkg <package>

# To display package installation status and what version is available from
# its repository
apt-cache policy <package>
30 changes: 30 additions & 0 deletions assets/cheatsheets/apt-get
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
tags: [ packaging ]
---
# To fetch package list:
apt-get update

# To download and install package updates:
apt-get upgrade

# To download and install the updates AND install new necessary packages
# AND remove any packages that stand in the way of the upgrade:
apt-get dist-upgrade

# Full command:
apt-get update && apt-get dist-upgrade

# To install a new package(s):
apt-get install <package>...

# To download a package without installing it. (The package will be downloaded in your current working dir)
apt-get download <package>

# To change cache dir and archive dir (where .deb are stored):
apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ...

# To show apt-get installed packages:
grep 'install ' /var/log/dpkg.log

# To silently keep old configuration during batch updates:
apt-get update -o DPkg::Options::='--force-confold' ...
17 changes: 17 additions & 0 deletions assets/cheatsheets/aptitude
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
tags: [ packaging ]
---
# To find packages matching <phrase>:
aptitude search <phrase>

# To display package records for the named package(s):
aptitude show <package>...

# To install package(s):
aptitude install <package>...

# To remove package(s):
aptitude remove <package>...

# To remove unnecessary package:
aptitude autoclean
12 changes: 12 additions & 0 deletions assets/cheatsheets/aria2c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To download a file:
# The url can be a http(s), ftp, .torrent file or even a magnet link
aria2c <url>

# To prevent downloading the .torrent file:
aria2c --follow-torrent=mem <url>

# Download 1 file at a time (-j)
# continuing (-c) any partially downloaded ones
# to the directory specified (-d)
# reading urls from the file (-i)
aria2c -j 1 -c -d ~/Downloads -i /path/to/file
22 changes: 22 additions & 0 deletions assets/cheatsheets/asciiart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
#
Loading

0 comments on commit b9a4ae4

Please sign in to comment.