Skip to content

Instantly share code, notes, and snippets.

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]" " } }'
#!/bin/bash
#
# iMSCP dns entries importer
#
# What you need: standard zone file with columns separated by a TAB and the target domain ID
# Usage:
# named2imscpSQL.sh domain.tld 93
#
# Copyleft alecs@negulescu.me
#
@alecs
alecs / comfy-auth.lua
Created August 9, 2017 14:29 — forked from Schnouki/comfy-auth.lua
SSL client certificate / HTTP basic auth -- dual-method authentication for lighttpd
-- comfy-auth.lua
-- Copyright (c) 2014, Thomas Jost <schnouki@schnouki.net>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@alecs
alecs / gist:5956089
Created July 9, 2013 09:45
perl find in path or print path
perl -e "use POSIX; my $path = $ENV{PATH}; @cale = split '\;', $path; foreach my $el (@cale) { print $el.\"\n\"; }"
perl -e "use POSIX; my $path = $ENV{PATH}; @cale = split '\;', $path; foreach my $el (@cale) { print $el.\"\n\"; `nixfind $el -type f -name \"*glib*\"`; print \"\n\n\"; }"
@alecs
alecs / modulefinder.pl
Created March 13, 2013 16:02
perl modules
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
my $modPattern = shift;
my @match;
find( { wanted => \&findModules,
@alecs
alecs / twproxy.pl
Last active December 14, 2015 07:29
twproxy.pl
#!/usr/bin/env perl
use strict;
use warnings;
#use 5.008;
our $HOSTURI = '#';
our $CONSUMER_KEY = '#';
our $CONSUMER_SECRET = '#';
our $SECRET = '#';
our $CALLBACK_URL = '#';