aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
committerneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
commit469e62e70891a37ec4016fcd025f979859074ef7 (patch)
tree690faf01abd10b7d6721d4e46b5dcbfd0727efb3
parent537e727f43311bc30d93c9af645dde3450605129 (diff)
downloaddotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.tar.xz
dotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.zip
Add moooore cheat
Diffstat (limited to '')
-rw-r--r--cheat/.cheat/cal26
-rw-r--r--cheat/.cheat/convert22
-rw-r--r--cheat/.cheat/django19
-rw-r--r--cheat/.cheat/djangocms29
-rw-r--r--cheat/.cheat/find4
-rw-r--r--cheat/.cheat/rename2
-rw-r--r--cheat/.cheat/svg12
7 files changed, 112 insertions, 2 deletions
diff --git a/cheat/.cheat/cal b/cheat/.cheat/cal
new file mode 100644
index 0000000..f28b348
--- /dev/null
+++ b/cheat/.cheat/cal
@@ -0,0 +1,26 @@
+# Auto update all agandas
+
+## vdirsync
+
+Just enable user service vdirsyncer.timer
+/!\ Update 5 min after start and 15min after first vdirsync update
+
+## ikhal
+
+Create a ikhal service with the following content:
+
+```
+[Unit]
+Description=Update khal's cache
+Documentation=man:khal(1)
+After=vdirsyncer.service
+RefuseManualStart=true
+
+[Service]
+ExecStart=/usr/bin/khal
+Type=oneshot
+StandardOutput=null
+
+[Install]
+WantedBy=vdirsyncer.service
+```
diff --git a/cheat/.cheat/convert b/cheat/.cheat/convert
new file mode 100644
index 0000000..6e99e5b
--- /dev/null
+++ b/cheat/.cheat/convert
@@ -0,0 +1,22 @@
+# 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
+
+# Resize multi-image and blur it from <filename>.jpg to <filename>_tiny.jpg:
+for file in $(ls .); do convert $(echo "$(echo $file | cut -f 1 -d '.').jpg") -resize 5% -blur 0x8 $(echo "$(echo $file | cut -f 1 -d '.')_tiny.jpg") ; done
diff --git a/cheat/.cheat/django b/cheat/.cheat/django
index ebb5817..97efafc 100644
--- a/cheat/.cheat/django
+++ b/cheat/.cheat/django
@@ -29,3 +29,22 @@ django-admin makemessages -l fr
# compil translations files
django-admin compilemessages
+
+# Pour tester avec debug=False et manage.py runserver
+source : https://stackoverflow.com/a/49722734
+
+In urls.py I added this line:
+
+```
+from django.views.static import serve
+```
+
+add those two urls in urlpatterns:
+
+```
+url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
+url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}),
+```
+
+and both static and media files were accesible when DEBUG=FALSE.
+Hope it helps :)
diff --git a/cheat/.cheat/djangocms b/cheat/.cheat/djangocms
new file mode 100644
index 0000000..76c0826
--- /dev/null
+++ b/cheat/.cheat/djangocms
@@ -0,0 +1,29 @@
+# Apphook theme integration
+
+This is maybe not the best way to do this but it's work.
+
+First doc is here : http://docs.django-cms.org/en/latest/introduction/05-apphooks.html
+
+(`.` is the root of the django-cms project)
+(`myApp` is the django app to be ingreted to django-cms)
+
+Create another django app specialy for integrate the wanted django app.
+(ex: `./myApp_cms_integration/`)
+
+For apply the theme you need, in the cms app create a folder, to create a
+`templates` folder for the integrated django app.
+(ex: `./myApp_cms_integration/templates/myApp/`)
+
+Copy the base.html template of myApp django app and modify the file with this
+code:
+
+```
+{% extends "base.html" %}
+
+{% block apps %}
+# Here come all the code from the base.html of myApp (In this example)
+{% endblock %}
+```
+
+You also need to add somewhere in the template of the django-cms project
+`{% block apps %}{% endblock %}`.
diff --git a/cheat/.cheat/find b/cheat/.cheat/find
index 680abb3..aecacbd 100644
--- a/cheat/.cheat/find
+++ b/cheat/.cheat/find
@@ -46,5 +46,5 @@ find . -type f -samefile MY_FILE_HERE 2>/dev/null
# To find all files in the current directory and modify their permissions
find . -type f -exec chmod 644 {} \;
-# Find last edited files
-find $1 -type f \( \! -iname ".DS_Store" \) -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head
+# Find last edited files and ignore .DS_Store file and #recycle path (fuck mac)
+find . -type f -not \( -iname ".DS_Store" -o -path "*#recycle*" \) -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head
diff --git a/cheat/.cheat/rename b/cheat/.cheat/rename
new file mode 100644
index 0000000..46a017c
--- /dev/null
+++ b/cheat/.cheat/rename
@@ -0,0 +1,2 @@
+# Lowercase all files and folders in current directory
+rename 'y/A-Z/a-z/' *
diff --git a/cheat/.cheat/svg b/cheat/.cheat/svg
index baa48da..5df2da4 100644
--- a/cheat/.cheat/svg
+++ b/cheat/.cheat/svg
@@ -3,3 +3,15 @@
`background-image: url("data:image/svg+xml;charset=utf8,<svg [...]");`
Don't use `#` but `%23`.
+
+# svg inline
+Source de l'idée: https://stackoverflow.com/a/33833561
+
+Pour inclure svg en mode inline mais sans l'avoir en mode sale ds
+le code il faut l'inclure ds le template.
+
+Par exemple sous django possibilité de faire:
+
+```
+{% include 'file.svg' %}
+```