MISCELLANEUS


IMAGEMAGICK

Official Examples

  • Convert background to transparent
convert input.png -transparent red output.png
  • Convert in formats
convert image.png image.jpg
// with less quality
convert image.png -quality 90 image.jpg
  • Convert background color to transparent or another color.
convert image.png -background white white.png
  • Mount images
montage -label 'FRONT END' frontEnd.png  
 -label 'BACK END' backEnd.png   
 -label 'DATABASE' database.png   
 -label 'UTILS' utils.png   
 -tile 2x2  -geometry 200x200 total.png
  • Cut borders
shave
  • Make canvas bigger to allow image in
convert input.png -gravity center -background white -extent 500x500
output.png
  • Optimize images

-png

convert INPUT.png -strip [-resize WxH] [-alpha Remove] OUTPUT.png

-jpg

convert INPUT.jpg -sampling-factor 4:2:0 -strip [-resize WxH] 
[-quality 85] [-interlace JPEG] [-colorspace Gray/sRGB] OUTPUT.jpg

GIT

  • Install
// Debian backports to get last version
deb http://ftp.debian.org/debian strecth-backports main
aptitude -t strecth-backports install "package"

// debian
aptitude install git
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --list
nano ~/.gitconfig
  • Commands

git init [project-name] - Creates a new local repository with the specified name

git status - Lists all new or modified files to be committed

git add [file] - Snapshots the file in preparation for versioning
git add . - Snapshots recursive all
git reset [file] - Unstages the file, but preserve its contents

git diff - Shows file differences not yet staged
git diff --staged - Shows file differences between staging and the last file version

git commit -m "message" - Records file snapshots permanently in version history

git reset [file] - Unstages the file, but preserve its contents
git reset [commit] - Undoes all commits after [commit] , preserving changes locally

git log - Lists version history for the current branch

  • .gitignore to github

If we add something to .gitignore it will no longer be committed but neither does the existing in github disappear. To be removed from github ...

git rm -r --cached some-directory
git commit -m 'Remove the now ignored directory "some-directory"'
git push origin master - usually git push is enough

  • branchs

git checkout -b branchName - create new branch
git checkout -d branchName - delete branchName
git checkout brancName - change to branchName
git push origin branchName - push branchName commits

git stash - uncommitted changes will move from one branch to other. To keep them separated, you must stash those changes before moving to another branch.
git stash apply - when you return to your branch, you can apply those changes to retrieve them.


MKDOCS

  • Install

apt-get install python-pip
pip install --user mkdocs - Use --user for avoid sudo and permission problems
pip install --user -U mkdocs - update

Install themes

pip install mkdocs-bootstrap
pip install mkdocs-bootswatch
pip install mkdocs-material
pip install mkdocs-alabaster
pip install mkdocs-cinder

  • Configuration
mkdocs new my-project
cd my-project
$ mkdocs serve
Running at: http://127.0.0.1:8000/
  • Comandos

mkdocs build - creates a site directory with all static content you will upload to the server

mkdocs build --clean - clean old content

mkdocs build -d path/for/new/content - creates content in path

  • mkdocs.yml Example
site_name: Notes
google_analytics: ["UA-106460623-1", "auto"]
repo_url: https://github.com/jolav/notes
strict: true
extra:
  logo: '_img/notes128.png'
  include_toc: false

pages:
  - 'Menu': 'index.md'
  - 'HTML': 'html.md'  
  - 'CSS': 'css.md'
  - 'Javascript': 'javascript.md'
  - 'Javascript snippets': 'javascript-snippets.md'
  - 'Reactjs': 'reactjs.md'
  - 'Front End': 'frontend.md'
  - 'Nodejs + Expressjs': 'nodejs-expressjs.md'
  - 'Nodejs snippets': 'nodejs-snippets.md'
  - 'DataBase': 'database.md'
  - 'Debian + MacOS': 'debian.md'
  - 'Third Party': 'third-party.md'

#theme: alabaster
theme_dir: "notes-theme"
site_dir: 'notes'
docs_dir: 'docs'
extra_css:
- '_extra/css/extra.css'

GLITCH.COM

Template package.json

{
  "name": "sp500",
  "version": "0.1.11",
  "description": "betazone finance sp500 stock real time data",
  "main": "sp.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node sp.js"
  },
  "engines": {
    "node": "8.x"
  },
  "author": "jolav",
  "license": "BSD-3-Clause",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/jolav/betazone.git"
  },
  "bugs": {
    "url": "https://github.com/jolav/betazone/issues"
  },
  "homepage": "https://github.com/jolav/betazone#readme",
  "dependencies": {
    "express": "^4.16.2",
    "dotenv": "^5.0.0",
  }
}