From df7a1f481e26f9c495db76809f7e9b7f7b6e30d3 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 31 Mar 2019 23:13:43 +0200 Subject: Add more cheat --- cheat/.cheat/ansible | 11 +++++++++++ cheat/.cheat/kraken | 3 +++ cheat/.cheat/pip | 34 ++++++++++++++++++++++++++++++++++ cheat/.cheat/poezio | 2 ++ cheat/.cheat/power | 6 ++++++ cheat/.cheat/systemd | 28 ++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+) create mode 100644 cheat/.cheat/ansible create mode 100644 cheat/.cheat/kraken create mode 100644 cheat/.cheat/pip create mode 100644 cheat/.cheat/poezio create mode 100644 cheat/.cheat/power create mode 100644 cheat/.cheat/systemd diff --git a/cheat/.cheat/ansible b/cheat/.cheat/ansible new file mode 100644 index 0000000..13fce19 --- /dev/null +++ b/cheat/.cheat/ansible @@ -0,0 +1,11 @@ +# Troubleshoutting + +When the error is "Operation not permitted" when "chown: changing ownership" you +just need to activate the following options in file `ansible.cfg`: + +``` +allow_world_readable_tmpfiles = True +pipelining = True +``` + +Source: https://stackoverflow.com/questions/47873671/becoming-non-root-user-in-ansible-fails?rq=1 diff --git a/cheat/.cheat/kraken b/cheat/.cheat/kraken new file mode 100644 index 0000000..58b3bd1 --- /dev/null +++ b/cheat/.cheat/kraken @@ -0,0 +1,3 @@ +# bitcoin + +echo $(clikraken bal | grep XBT | awk '{print $2}')"*"$(clikraken t | grep XBTEUR | awk '{print $2}') | bc diff --git a/cheat/.cheat/pip b/cheat/.cheat/pip new file mode 100644 index 0000000..9b438ea --- /dev/null +++ b/cheat/.cheat/pip @@ -0,0 +1,34 @@ +# Search for packages +pip search SomePackage + +# Install some packages +pip install SomePackage + +# Install some package in user space +pip install --user SomePackage + +# Upgrade some package +pip install --upgrade SomePackage + +# Output and install packages in a requirement file +pip freeze > requirements.txt +pip install -r requirements.txt + +# Show details of a package +pip show SomePackage + +# List outdated packages +pip list --outdated + +# Upgrade all outdated packages, thanks to http://stackoverflow.com/a/3452888 +pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U + +# Upgrade outdated packages on latest version of pip +pip list --outdated --format=freeze | cut -d = -f 1 | xargs -n1 pip install -U + +# Install specific version of a package +pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4' + +# Best pratice to use pip +# source: https://linuxfr.org/users/oliver_h/journaux/quelques-bonnes-pratiques-python-pour-2019 +python3 -m pip diff --git a/cheat/.cheat/poezio b/cheat/.cheat/poezio new file mode 100644 index 0000000..8b713c7 --- /dev/null +++ b/cheat/.cheat/poezio @@ -0,0 +1,2 @@ +# Refresh srv +/server_cycle diff --git a/cheat/.cheat/power b/cheat/.cheat/power new file mode 100644 index 0000000..51fb4c4 --- /dev/null +++ b/cheat/.cheat/power @@ -0,0 +1,6 @@ +# Close laptoper cover/lip + +in file /etc/systemd/logind.conf + +#HandleLidSwitch=suspend +HandleLidSwitch=ignore diff --git a/cheat/.cheat/systemd b/cheat/.cheat/systemd new file mode 100644 index 0000000..4389bb6 --- /dev/null +++ b/cheat/.cheat/systemd @@ -0,0 +1,28 @@ +# 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 foo.service + +# Unit file locations +/etc/systemd/system +/usr/lib/systemd/system + +# Manage service with battery status +ConditionACPower= + +True is AC connecter and false if on battery. + +# Modify unit file without altering upstring unit file +# Source: https://serverfault.com/questions/840996/modify-systemd-unit-file-without-altering-upstream-unit-file +Use commande `systemctl edit --full ` for example +For `--user` : `systemctl edit --full ` -- cgit v1.2.1