This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: labservers | |
user: root | |
gather_facts: no | |
vars: | |
ansible_ssh_common_args: '-o StrictHostKeyChecking=no' | |
ssh_user: "stupid" | |
ssh_pass: "letmein" | |
tasks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BOKSTAV="h" | |
for a in $(ls -1 ${BOKSTAV}*); do | |
echo ${a} | |
if [ $(wc -l ${a} | awk '{print $1}') -gt 10 ]; then | |
echo "Filen ${a} har fler än 10 rader!" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
import sqlite3 | |
app = Flask(__name__) | |
def init_db(): | |
with sqlite3.connect('todo.db') as conn: | |
cursor = conn.cursor() | |
cursor.execute('''CREATE TABLE IF NOT EXISTS todos ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import sqlite3 | |
app = Flask(__name__) | |
def init_db(): | |
with sqlite3.connect('todo.db') as conn: | |
cursor = conn.cursor() | |
cursor.execute('''CREATE TABLE IF NOT EXISTS todos ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $EUID -ne 0 ] ; then | |
echo "You need to run this as root! (use the sudo)" | |
exit 1 | |
fi | |
if [ $# -lt 1 ] ; then | |
echo "You need to specify username" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config | |
systemctl restart sshd | |
useradd -s /bin/bash -m lernia | |
gpasswd -a lernia sudo | |
passwd lernia | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for u in $(seq 1001 1004); do | |
echo "debug -> $u" | |
id ${u} &>/dev/null | |
if [ $? -eq 0 ] ; then | |
NAMN=$(id -nu ${u}) | |
sudo userdel -r ${NAMN} | |
else | |
echo "ID NOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Install Google Chrome in Ubuntu / WSL2 on Windows 11: | |
# $ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
# $ sudo apt install libgbm1 libu2f-udev libwayland-server0 | |
# $ sudo dpkg -i google-chrome-stable_current_amd64.deb | |
# | |
# Start Google Chrome: | |
# $ google-chrome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello, World!") | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MASTERS=$(oc get nodes -o name --no-headers --selector='node-role.kubernetes.io/master') | |
MASTERS_CNT=$(oc get nodes -o name --no-headers --selector='node-role.kubernetes.io/master' | wc -l) | |
WORKERS=$(oc get nodes -o name --no-headers --selector='node-role.kubernetes.io/worker') | |
WORKERS_CNT=$(oc get nodes -o name --no-headers --selector='node-role.kubernetes.io/worker' | wc -l) | |
echo "> Masters: ${MASTERS_CNT} | Workers: ${WORKERS_CNT}" | |
echo "" |
NewerOlder