All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login

All New Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated

admin / create_owrt.sh

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/bin/sh
2
3 set -e
4
5 echo '----------Create Openwrt VM!----------'
6
7 wget https://downloads.openwrt.org/releases/24.10.5/targets/x86/64/openwrt-24.10.5-x86-64-rootfs.tar.gz -O /var/lib/vz/template/cache/openwrt-24.10.5-x86-64-rootfs.tar.gz
8 pct create 190 local:vztmpl/openwrt-24.10.5-x86-64-rootfs.tar.gz --hostname openwrt --rootfs local:1 --memory 256 --cores 1 --ostype unmanaged --unprivileged 1
9
10 echo '----------Create DONE!----------'

admin / base_rest.py

0 likes
0 forks
1 files
Last active 3 months ago
1 from typing import List
2 from fastapi import APIRouter, HTTPException
3 import peewee as pw
4 from peewee import DoesNotExist
5 from pydantic import BaseModel
6
7
8 class BaseRest:
9 def __init__(self, model: pw.Model, pydantic_model: BaseModel, methods: List[str]=None):
10 self.model = model

admin / assign_static_ip_nspawn_container.md

0 likes
0 forks
1 files
Last active 3 months ago

Assign static IP address to systemd-nspawn container (private networking mode)

(Get from here)

On the host

Configure the host interface which will be exposed to the container.

$ sudo cp /lib/systemd/network/80-container-ve.network /etc/systemd/network/80-container-<MY_CONTAINER>.network

admin / croudsec.md

0 likes
0 forks
1 files
Last active 3 months ago
  233  curl -s https://install.crowdsec.net | sudo sh
  234  apt -y install crowdsec
  235  systemctl reload crowdsec && systemctl status crowdsec
  236  cscli metrics
  237  apt -y install crowdsec-firewall-bouncer-iptables
  238  cscli allowlist create my_allowlist -d 'my-ips'
  239  cscli allowlist add my_allowlist 1.2.3.4
  240  cscli allowlist add my_allowlist 5.6.7.8/24
  241  cscli decisions list

admin / models.py

0 likes
0 forks
1 files
Last active 3 months ago
1 import json
2 import peewee as pw
3 from datetime import datetime
4
5 db = pw.SqliteDatabase('example.db')
6
7
8 class JSONField(pw.TextField):
9 def db_value(self, value):
10 return json.dumps(value, ensure_ascii=False)

admin / upd_restart.py

0 likes
0 forks
1 files
Last active 3 months ago
1 import subprocess
2 import sys
3
4 @router.message(F.text == "/reboot")
5 async def command_handler(msg: types.Message, *args, **kwargs):
6 if msg.from_user.id in [1234567890, 123123123]:
7 subprocess.run(["git", "pull"], check=True, stdout=subprocess.PIPE).stdout
8 python = sys.executable
9 os.execl(python, python, *sys.argv)

admin / Locales.md

0 likes
0 forks
1 files
Last active 3 months ago

Добавляем поддержку русского языка в Ubuntu\Debian системах:

Установим\обновим пакет locales:

apt-get install locales

После чего выполним команду:

admin / inlux_grafana.yml

0 likes
0 forks
1 files
Last active 3 months ago
1 services:
2 influxdb:
3 image: influxdb:1.8-alpine
4 container_name: "stats-influxdb"
5 env_file: .env
6 volumes:
7 - "./influxdb:/var/lib/influxdb"
8 ports:
9 - "8086:8086"

admin / apparmor.md

0 likes
0 forks
1 files
Last active 3 months ago

Отключение AppArmor в Ubuntu 24.04

Опубликовано 9 октября 2024, 10:51

Выключение сервиса

systemctl disable --now apparmor

Удаление AppArmor

admin / StepCA.sh

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/bin/sh
2
3 set -e
4
5 echo '----------Install StepCA!----------'
6 apt-get update && apt-get install -y --no-install-recommends curl vim gpg ca-certificates jq
7
8 curl -fsSL https://packages.smallstep.com/keys/apt/repo-signing-key.gpg -o /etc/apt/trusted.gpg.d/smallstep.asc && \
9 echo 'deb [signed-by=/etc/apt/trusted.gpg.d/smallstep.asc] https://packages.smallstep.com/stable/debian debs main' \
10 | tee /etc/apt/sources.list.d/smallstep.list
Newer Older

Powered by Opengist ⋅ Load: 296ms⋅

English
العربية Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 简体中文 繁體中文