From 9443eb4006a06bc3d9a2ac3d5339ac394d2c5c6e Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 4 Oct 2020 22:25:33 +0200 Subject: Update some cheat --- dotfiles/cheat/docker | 5 +++++ dotfiles/cheat/gpp | 3 +++ dotfiles/cheat/image | 28 ++++++++++++++++++++++++++++ dotfiles/cheat/mongodb | 11 +++++++++++ dotfiles/cheat/sphinxdoc | 24 ++++++++++++++++++++++++ dotfiles/cheat/vim | 2 ++ 6 files changed, 73 insertions(+) create mode 100644 dotfiles/cheat/gpp create mode 100644 dotfiles/cheat/image create mode 100644 dotfiles/cheat/sphinxdoc (limited to 'dotfiles') diff --git a/dotfiles/cheat/docker b/dotfiles/cheat/docker index 86187f5..12b572a 100644 --- a/dotfiles/cheat/docker +++ b/dotfiles/cheat/docker @@ -42,3 +42,8 @@ DO: echo N | sudo tee /sys/module/overlay/parameters/metacopy # command for launch GUI soft, sometimes custom Dockerfile is needed --user $UID -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix + +# Remove shit +for image in $(docker images | grep "^" | awk '{print $3}'); do docker rmi $image; done +# in case there is no important data in volumes: +sudo rm -rf /var/lib/docker/volumes diff --git a/dotfiles/cheat/gpp b/dotfiles/cheat/gpp new file mode 100644 index 0000000..de45408 --- /dev/null +++ b/dotfiles/cheat/gpp @@ -0,0 +1,3 @@ +Export secret key + +gpg --export-secret-keys -a > secret.asc diff --git a/dotfiles/cheat/image b/dotfiles/cheat/image new file mode 100644 index 0000000..c531f16 --- /dev/null +++ b/dotfiles/cheat/image @@ -0,0 +1,28 @@ +# Prepare image for the web with gimp + +Resources: +- https://docs.gimp.org/en/gimp-using-web.html +- https://logosbynick.com/gimp-reduce-file-size-png/ + +## Optimize color palette + +Image > Mode > Indexed + +Check generate optimum palette with 35 value (255 is the default) then click on +Convert + +## Lower resolution + +Image > Scale + +Set witch to 700 and then click on Scale + +## Remove alpha chanel + +Remove Alpha channel by flattering the image (Image -> Flatten Image) + +## Save + +Save in PNG format with uncheck all and best compression + +Don't forget to check if the final image is ok with what you want diff --git a/dotfiles/cheat/mongodb b/dotfiles/cheat/mongodb index 54b8652..d7a7d42 100644 --- a/dotfiles/cheat/mongodb +++ b/dotfiles/cheat/mongodb @@ -1,10 +1,21 @@ +# Admin user full +use admin +db.createUser({user:"admin", pwd:"admin", roles: ["userAdminAnyDatabase", "clusterAdmin", "dbAdminAnyDatabase"]}) + +# list all dbs users +db.system.users.find() + # Create user, don't forget to use the correct database use db.createUser({user:"root", pwd:"root", roles: ["readWrite"]}) # Create use in another database: +use madbtest db.createUser({user:"admin", pwd:"vIhVPwy81sdf5fPt3a2", roles: [{role: "readWrite" , db: "madbtest"}]}) +# udpate pwd +db.updateUser("username", {pwd: ""}) + # mongoshell get schema collection # Source: https://medium.com/@ahsan.ayaz/how-to-find-schema-of-a-collection-in-mongodb-d9a91839d992 diff --git a/dotfiles/cheat/sphinxdoc b/dotfiles/cheat/sphinxdoc new file mode 100644 index 0000000..3e081d7 --- /dev/null +++ b/dotfiles/cheat/sphinxdoc @@ -0,0 +1,24 @@ +# Add a strike html component + +In conf.py file: + +``` +rst_prolog = """ +.. role:: strike +""" +``` + +Extend the layout theme template `layout.html` with: + +``` +{% extends "!layout.html" %} +{% set css_files = css_files + ["_static/style.css"] %} +``` + +In the `style.css`: + +``` +.strike { + text-decoration: line-through; +} +``` diff --git a/dotfiles/cheat/vim b/dotfiles/cheat/vim index 5c14dae..e6416bb 100644 --- a/dotfiles/cheat/vim +++ b/dotfiles/cheat/vim @@ -85,6 +85,8 @@ And save it in a better name: `:WorkspaceSave {name}` :set foldmethod=indent foldlevel=1 za # toggle indent +:w !sudo tee % + # spellchecking `:set spell` ``:set spelllang=fr` -- cgit v1.2.1