Skip to content

Instantly share code, notes, and snippets.

View constrict0r's full-sized avatar
👘
The plan is programmed in all of my thousand robots

Victor Mattei constrict0r

👘
The plan is programmed in all of my thousand robots
View GitHub Profile
@constrict0r
constrict0r / molecule.yml
Created January 26, 2020 04:10
Molecule yml with steps.
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: stretch
image: debian:9
@constrict0r
constrict0r / github-gitlab-img-url-conf.py
Created January 19, 2020 19:35
Github/Gitlab Img URL conf.py
Doom
# github
img_base_url = "https://raw.githubusercontent.com/"
img_url = img_base_url + author + "/img/master/" + project + "/"
# gitlab
@constrict0r
constrict0r / .gitignore
Last active January 19, 2020 17:22
Gitignore one-to-rule-all
# Ansible.
*.retry
.galaxy_install_info
# Binaries.
*.jpg
# Buffers.
*~
@constrict0r
constrict0r / mariadb-backup-docker.sh
Created December 2, 2019 16:29
Mariadb Backup/Restore with Docker
# Backup - from the host machine run:
docker exec CONTAINER mysqldump -u root --password=PASS DATABASE > CONTAINER.sql
# Restore - from the host machine run:
cat CONTAINER.sql | docker exec -i CONTAINER mysql -u root --password=PASS DATABASE
@constrict0r
constrict0r / docker-volumes.sh
Created December 1, 2019 23:24
Handle Docker volumes
docker volume ls => List all volumes.
docker rm volume_id => Delete volume with id volume_id.
@constrict0r
constrict0r / docker-ciencia-para-el-mal.sh
Last active November 28, 2019 19:50
Ejecutar docker de ciencia para el mal.
# Descargar y ejecutar.
docker run -v /home/constrict0r/repos/ciencia-para-el-mal/jupyter/:/home/jovyan -p 8888:8888/tcp --name ciencia-para-el-mal -ti jupyter/scipy-notebook:latest
# Conectarse a la terminal.
docker exec -it ciencia-para-el-mal /bin/bash
@constrict0r
constrict0r / 1366_x_768.sh
Last active December 3, 2019 15:04
Add 1366x768 resolution.
# Add the 1366x768_60.00 mode, dont' use sudo.
xrandr --newmode "1366x768_60.00" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync
# Run xrandr an check the output, don't use sudo.
xrandr
# Screen 0: minimum 320 x 200, current 2390 x 768, maximum 8192 x 8192
# LVDS-1 connected 1366x768+1024+0 (normal left inverted right x axis y axis) 293mm x 165mm
# 1366x768 59.98*+ 39.99
# ...
@constrict0r
constrict0r / emacs-keys.txt
Last active October 25, 2019 20:45
Emacs common keys.
# Editor.
C-d => Delete character.
C-x C-f => Open file.
C-g => Get me out of everything!!!
C-x u => Undo.
C-x C-b => Buffers list.
C-x b => Go to previous buffer.
C-x k => Close current buffer.
C-s => Incremental search forward.
C-r => Incremental search backwards.
@constrict0r
constrict0r / bash-conditionals-regex-subs.sh
Last active October 18, 2019 18:11
Bash conditionals, regex and substitutions.
# Verify if variable contains text.
if [[ "$my_var" =~ 'my-word' ]]; then
echo 'Contains it.'
fi
# Replace text inside variable.
my_var="${my_var//search/replacement}"
# Trim string.
my_var="${my_var## }"
@constrict0r
constrict0r / git-remove-origin.sh
Last active October 20, 2019 13:21
Remove git origin.
git remote remove <origin-name>
# Sometimes is necessary to fetch prunning the deleted branches origins.
git fetch -p