This small cheat sheet has been created by me after duing the OBS training with mpluskal. Hope it is of help to anybody that is starting with obs :-)
First, let's set some aliases for the shell
$ vim ~/.bashrc
#!/bin/bash | |
# call this script with an email address (valid or not). | |
# like: | |
# ./makecert.sh [email protected] | |
mkdir certs | |
rm certs/* | |
echo "make server cert" | |
openssl req -new -nodes -x509 -out certs/server.pem -keyout certs/server.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1" | |
echo "make client cert" | |
openssl req -new -nodes -x509 -out certs/client.pem -keyout certs/client.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1" |
# WTFPL, phoenix - http://www.wtfpl.net/ | |
# | |
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. | |
# | |
# This file contains the mappings of IP addresses to host names. Each | |
# entry should be kept on an individual line. The IP address should | |
# be placed in the first column followed by the corresponding host name. | |
# The IP address and the host name should be separated by at least one | |
# space. | |
# |
#!/bin/bash | |
## 2019, phoenix | |
## Start Raspberry Pi in QEMU instance | |
## | |
# | |
# 1. Get the Raspian image: https://www.raspberrypi.org/downloads/raspbian/ | |
# 2. Get Raspberry Kernel and dtb: https://github.com/dhruvvyas90/qemu-rpi-kernel | |
# 3. Extract Raspbian and put the Kernel and the dtb into a directory | |
# 4. Convert the IMG to a QCOW2: qemu-img convert -f raw -O qcow22019-09-26-raspbian-buster-lite.img 2019-09-26-raspbian-buster-lite.qcow | |
# 5. Make some more space: qemu-img resize 2019-09-26-raspbian-buster-lite.qcow2 +5G |
// Convert a struct sockaddr address to a string, IPv4 and IPv6: | |
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen) | |
{ | |
switch(sa->sa_family) { | |
case AF_INET: | |
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr), | |
s, maxlen); | |
break; |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import random | |
import numpy as np | |
from math import * | |
import time | |
import sys | |
class Gauss2d : |
--- | |
- hosts: ap-nodes | |
gather_facts: no | |
tasks: | |
- name: shutdown | |
command: /sbin/shutdown -h now | |
sudo: yes | |
- name: wait go down | |
local_action: wait_for host={{ ansible_ssh_host }} port=22 state=stopped |
#!/bin/bash | |
# Shell script to stop all KVM instances, create a BTRFS snapshot (read-only) and restart the stopped KVM instances | |
# https://gist.github.com/grisu48/535c27cd25c096248ce234ad81abf1b9 | |
## Configuration ############################################################## | |
IMGDIR="/mnt/RAID/libvirt/images" | |
SNAPDIR="/mnt/RAID/libvirt/snapshots" | |
# timeout in seconds | |
TIMEOUT=300 |
#!/bin/bash | |
alias killall="killall -u `whoami` -i" | |
alias weather="curl 'http://wttr.in/'" | |
ctrim() { | |
if [ $# -lt 1 ]; then | |
echo "ctrim - trim the given pictures (using convert --trim)" | |
else | |
for i in $@; do |
#!/bin/bash | |
# Bash function to trim pictures using imagemagick | |
# This snippet is meant to be inserted as function in ~/.bashrc | |
ctrim() { | |
if [ $# -lt 1 ]; then | |
echo "ctrim - trim the given pictures (using convert --trim)" | |
else | |
# TODO: Parallel runs | |
for i in $@; do |