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 / 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
@constrict0r
constrict0r / new-ssh-key.sh
Created October 12, 2019 19:08
Generate a new ssh key.
ssh-keygen -t rsa -b 4096
@constrict0r
constrict0r / madvillain.yml
Last active October 25, 2019 17:20
Madvillain config
---
packages:
- https://is.gd/XXhPd9
- fritzing
- fritzing-data
- fritzing-parts
- telegram-desktop
- wesnoth
packages_pip:
@constrict0r
constrict0r / set-date.sh
Last active October 10, 2019 22:34
Set date from terminal.
date -s '2019-10-09'
date -s '20:09:00'
# Or
sudo hwclock --hctosys
@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 / 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 / crontab-one-time.sh
Created October 9, 2019 15:04
Crontab add one time job.
printf %b '@reboot root (sleep 90; /bin/bash /usr/local/sbin/kick.sh -u {{ username }} {{ desktop_parameters }} {{ custom_parameters }})\n' >> /target/etc/crontab; \
@constrict0r
constrict0r / ansible-iso-create.sh
Last active October 25, 2019 17:39
Create an iso using Ansible roles.
ansible localhost -m include_role -a name=constrict0r.iso -K -e \
'username=constrict0r userpass=1234 rootpass=1234 device=sdb preseed=true \
preseed_wireless=true preseed_partitioning=true preseed_last_question=true \
preseed_custom=/home/constrict0r/repos/madvillain/defaults/main.yml networkname="MY NETWORK" \
networkpass="my-network-pass" hostname="latveria" domain="amanita"'
@constrict0r
constrict0r / git-branch-rebase-merge.sh
Last active September 14, 2019 07:23
Git branch-rebase-merge process.
# Git new branch-rebase-merge process.
# On this snippet we changed the name of the folder
# license to license-repo.
# Get last changes and create a new branch.
git pull origin master
git checkout -b license-repo
# Here we make changes to the repository and add our commits.
# Rename folder license to license-repo.
@constrict0r
constrict0r / ansible-role-ssh.sh
Last active October 25, 2019 13:55
Run ansible role via ssh.
ansible my_pattern -i inventory -m ping -e "ansible_user=debian ansible_ssh_pass=debian"
ansible my_pattern -i inventory -m include_role -a name=constrict0r.task -e "{ansible_user: username, ansible_ssh_pass: 1234, ansible_become_pass: 1234, users: username, user_tasks: ['https://is.gd/uE0TTp']}"
# Inventory:
# [my_pattern]
# 192.168.100.196