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 / preseed-late-command.sh
Last active February 22, 2022 07:59
Preseed late command
# Post install script.
# Execute kick.sh to setup the system.
d-i preseed/late_command string \
wget https://raw.githubusercontent.com/constrict0r/kick/master/kick.sh -O /target/usr/local/sbin/kick.sh; \
chmod +x /target/usr/local/sbin/kick.sh; \
cp /custom-config.yml /target/usr/local/sbin/custom-config.yml &>/dev/null; \
sed -i '/^\ *deb\ cdrom/s/^\(.*\)$/#\1/' /target/etc/apt/sources.list; \
mkdir /dev/shm; \
mount --bind /dev/pts /target/dev/pts; \
mount --bind /dev/shm /target/dev/shm; \
@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 / bash-alias.sh
Last active December 6, 2019 20:41
Set bash aliases.
#!/bin/bash
#
# @file bash-alias
# @brief Add useful bash commands aliases.
alias changes="find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;"
alias runit="ansible-playbook -i tests/inventory tests/test-playbook.yml"
alias gic="git add . && git commit -m 'Updated repository' && git push"
alias fixme="xrandr --newmode '1366x768_60.00' 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync && xrandr --addmode VGA-1 '1366x768_60.00' && xrandr --output VGA-1 --mode '1366x768_60.00'"
@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 / 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 / fresh.xml
Last active November 30, 2019 22:24
Virsh snapshot file layout
<domainsnapshot>
<name>fresh</name>
<description>Fresh installation.</description>
</domainsnapshot>
<!-- cd /var/lib/libvirt/images -->
<!-- sudo virsh snapshot create <VM-Name> fresh.xml -->
<!-- sudo virsh snapshot revert <VM-Name> fresh -->
@constrict0r
constrict0r / resting-configuration.yml
Last active November 30, 2019 21:58
Final configuration to apply.
---
packages:
- bridge-utils
- libvirt-daemon-system
# ansible-galaxy install constrict0r.constructor
# ansible localhost -m include_role -a name=constrict0r.constructor -K -e "configuration=/home/username/resting-configuration.yml"
# sudo addgroup libvirtd
# sudo adduser username libvirtd
# sudo apt install qemu-utils