Compare commits

...

14 Commits

Author SHA1 Message Date
Chris Lane
cafa2fb2fd Version 2.1.15
Added new cheatsheets.
2015-09-09 18:06:23 -04:00
Chris Lane
9c31ba5102 Merge pull request #233 from cedric-dufour/master
A few additional cheats
2015-09-09 17:58:58 -04:00
Chris Lane
da65ea32d8 Merge pull request #234 from t-stark/master
New cheatsheets
2015-09-09 17:56:52 -04:00
t-stark
e1aec49ed6 modified cheatsheets 2015-09-07 20:57:17 -05:00
Blake Huber
ab86ac970d new cheatsheets 2015-09-07 20:56:09 -05:00
Cedric Dufour
90f66ccaf3 (fixed typo) 2015-09-04 11:16:18 +02:00
Cedric Dufour
f63406bc3e Lock file 2015-09-04 11:09:39 +02:00
Cedric Dufour
b3a93bc128 Retrieve N-th piped command exit status 2015-09-04 10:16:54 +02:00
Cedric Dufour
8f0d2e9fc3 Specify output separator character 2015-09-04 10:12:46 +02:00
Cedric Dufour
4c2d0d2d8e Generate Diffie-Hellman parameters 2015-09-04 10:10:32 +02:00
Cedric Dufour
ac445388d9 Keep old configuration during update 2015-09-04 10:08:42 +02:00
Cedric Dufour
705601f0b1 Added parallel (multi-threaded) processing 2015-09-04 10:06:37 +02:00
Chris Lane
2d7fdb5425 Patch version bump 2015-08-25 19:10:28 -04:00
Aravinth Panchadcharam
4512a61086 New Sheet Added: Vagrant - A portable development environment 2015-08-24 21:07:55 +02:00
16 changed files with 222 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ from docopt import docopt
if __name__ == '__main__':
# parse the command-line options
options = docopt(__doc__, version='cheat 2.1.13')
options = docopt(__doc__, version='cheat 2.1.15')
# list directories
if options['--directories']:

View File

@@ -23,3 +23,6 @@ apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" i
# 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

@@ -6,3 +6,6 @@ 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

@@ -18,3 +18,10 @@ 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'

22
cheat/cheatsheets/cups Normal file
View File

@@ -0,0 +1,22 @@
# 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

@@ -0,0 +1,32 @@
# 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

23
cheat/cheatsheets/lib Normal file
View File

@@ -0,0 +1,23 @@
# 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)

33
cheat/cheatsheets/ntp Normal file
View File

@@ -0,0 +1,33 @@
# 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

@@ -19,3 +19,6 @@ openssl x509 -text -noout -in server.crt
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

5
cheat/cheatsheets/ping Normal file
View File

@@ -0,0 +1,5 @@
# ping a host with a total count of 15 packets overall.
ping -c 15 www.example.com
# ping a host with a total count of 15 packets overall, one every .5 seconds (faster ping).
ping -c 15 -i .5 www.example.com

View File

@@ -4,6 +4,9 @@ rpm -ivh <rpm>
# To remove a package:
rpm -e <package>
# To remove a package, but not its dependencies
rpm -e --nodeps <package>
# To find what package installs a file:
rpm -qf </path/to/file>
@@ -17,3 +20,12 @@ rpm -q --whatrequires <file>
# To list all installed packages:
rpm -qa
# To find a pkg's dependencies
rpm -i --test <package>
# Display checksum against source
rpm -K <package>
# Verify a package
rpm -V <package>

View File

@@ -0,0 +1,21 @@
'rss2email -- converts rss feeds and emails them to your inbox'
# List all feeds
r2e list
# Convert RSS entries to email
r2e run
# Add a new feed
r2e add <feed address>
# Add a new feed with new email address
r2e add <feed address> [newemail address]
# Delete a feed
r2e delete <# of feed in list/>
# Help
r2e -h

18
cheat/cheatsheets/systemd Normal file
View File

@@ -0,0 +1,18 @@
# Display process startup time
systemd-analyze
# Display process startup time at service level
systemd-analyze blame
# List running units
systemctl list-units
# Load a unit at startup
systemctl enable foo.service
# Start or Stop a unit
systemctl <start | stop> foo.service
# Unit file locations
/etc/systemd/system
/usr/lib/systemd/system

View File

@@ -24,3 +24,8 @@ tar -jtvf /path/to/foo.tgz
# To create a .gz archive and exclude all jpg,gif,... from the tgz
tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/
# To use parallel (multi-threaded) implementation of compression algorithms:
tar -z ... -> tar -Ipigz ...
tar -j ... -> tar -Ipbzip2 ...
tar -J ... -> tar -Ipixz ...

33
cheat/cheatsheets/vagrant Normal file
View File

@@ -0,0 +1,33 @@
# Initate Vagrant
mkdir vag-vm; cd vag-vm
vagrant init
# Add a box to vagrant repo
vagrant box add hashicorp/precise32
# Add a box Vagrant file
config.vm.box = "hashicorp/precise32"
# Add vm to public network as host
config.vm.network "public_network"
# Add provision script to vagrant file
config.vm.provision :shell, path: "provision.sh"
# Start vm
vagrant up
# Connect to started instance
vagrant ssh
# Shutdown vm
vagrant halt
# Hibernate vm
vagrant suspend
# Set vm to initial state by cleaning all data
vagrant destroy
# Restart vm with new provision script
vagran reload --provision

View File

@@ -3,7 +3,7 @@ import os
setup(
name = 'cheat',
version = '2.1.13',
version = '2.1.15',
author = 'Chris Lane',
author_email = 'chris@chris-allen-lane.com',
license = 'GPL3',