Skip to content

Instantly share code, notes, and snippets.

@alecs
alecs / ssl_scanner.awk
Created October 5, 2022 13:35
ssl scanner
#!/usr/bin/awk -f
#
# Print validty of a cert from a nmap scan report
#
# Alex Negulescu
#
BEGIN {
nd=0
start=0
has_ssl=0
@alecs
alecs / portainer-only.yml
Created September 28, 2022 12:00
traefik v28 + portainer 2.15 docker-compose
#
# mkdir -p /shared/portainer/data/
# docker-compose -f portainer-only.yml -p portainer up -d
#
version: '3.7'
services:
portainer:
image: portainer/portainer-ce:latest
container_name: 'portainer'
@alecs
alecs / sqlite3.sh
Last active July 22, 2022 11:10
add-sqlite3-to-grafana-var-lib
#!/bin/bash
cd /var/lib/grafana/; mkdir sqtemp; apk fetch sqlite; tar -C sqtemp/ -xzf sqlite-*.apk ; mv sqtemp/usr/bin/sqlite3 sqlite3; rm -rf sqtemp sqlite-*.apk
@alecs
alecs / system-sleep-xhci.sh
Last active February 23, 2022 09:16 — forked from ioggstream/system-sleep-xhci.sh
Disable broken xhci device before suspend and avoid freeze.
#!/bin/sh
#
# This script should prevent the following suspend errors
# which freezes the Dell Inspiron laptop.
#
# Put it in /usr/lib/systemd/system-sleep/xhci.sh
#
# The PCI 00:14.0 device is the usb xhci controller.
#
# kernel: [67445.560610] pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
@alecs
alecs / gist:606ec763ddf3fcaf675f3a682c11d623
Created November 19, 2021 17:11
mongodb entrypoint.sh
#!/bin/sh
# short circuit if first arg is not 'mongod'
[ "$1" = "mongod" ] || exec "$@" || exit $?
: ${MONGO_USERNAME}
: ${MONGO_PASSWORD}
# Database owned by mongodb
[ "$(stat -c %U /data/db)" = mongodb ] || chown -R mongodb /data/db
FROM alpine:3.8
LABEL maintainer "Alex Negulescu <alecs@sysops.ro>"
ENV MONGO_USERNAME root
ENV MONGO_PASSWORD password
RUN addgroup -S -g 9999 mongodb 2>/dev/null
RUN adduser -S -D -h /var/lib/mongodb -s /sbin/nologin -G mongodb -g mongodb -u 9999 mongodb 2>/dev/null
version: '3.7'
services:
trudesk:
# polonel/trudesk:1.1.3
image: polonel/trudesk:next
restart: always
# ports:
# - 8118:8118
environment:
NODE_ENV: production
@alecs
alecs / gist:b9507fb44895e10ebafab1d463b4009d
Created October 29, 2021 09:46
Trudesk shell helper functions
sd_make() {
local accesstoken=""
local domain=""
local subject=$1
local description=$2
echo $1
echo $2
if [ -n "${subject}" -a -n "${description}" ]; then
curl "https://${domain}/api/v1/tickets/create" --compressed \
-H "authority: ${domain}" -H 'accept: application/json, text/plain, */*' \
@alecs
alecs / gist:ab6b606cc92f8d6315d54d6c454e9fae
Created February 18, 2021 16:54
open-rc minimal init - template
#!/sbin/openrc-run
USER=root
GROUP=root
SERVICE="${SERVICE}"
DIR="/opt/${SERVICE}"
PDIR="/run/${SERVICE}"
PID_FILE="${PDIR}/${SERVICE}.pid"
COMMAND=""
CMD_ARGS=""
@alecs
alecs / gist:897b53b19880ec43f2a8bc6b8e8a0fb2
Created February 7, 2020 12:37
dpkg --get-selections for alpine
apk list -I -v | awk 'BEGIN {i=0}; { word=substr($3,2,index($3,"}")-2); if (word != "") { packs[i]=word; let i++ } }; END { for (id in packs) { printf packs[id]" " } }'