Skip to content

Instantly share code, notes, and snippets.

View maietta's full-sized avatar

Nick Maietta maietta

View GitHub Profile
@maietta
maietta / gist:0b05efa38901afdbaedc363b78e3852a
Created October 26, 2021 03:38
Caprover Reveal IP to containers
Pre-deploy function:
var preDeployFunction = function (captainAppObj, dockerUpdateObject) {
var ports = dockerUpdateObject.EndpointSpec.Ports || [];
ports.forEach(function (port) {
port.PublishMode = 'host';
});
return Promise.resolve(dockerUpdateObject);
};
@maietta
maietta / ssh-copy-id-openwrt
Created October 4, 2021 05:07 — forked from Juul/ssh-copy-id-openwrt
ssh-copy-id but for openwrt / dropbear
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Example: ${0} [email protected]"
exit 1
fi
cat ~/.ssh/id_rsa.pub | ssh ${1} "cat >> /etc/dropbear/authorized_keys && chmod 0600 /etc/dropbear/authorized_keys && chmod 0700 /etc/dropbear"
@maietta
maietta / gist:d089d35805584bcf65ceed8abca803d4
Created May 8, 2021 22:38
Bigfoot Bite: Altering page titles sitewide.
// Place this in your /index.php, modified to your satisfaction.
// Hook into the end of dom to extend the F3 template engine to inject `{{ @page_title }}` for landing or `{{ @page_title }} | RETSQL` everywhere
// else and set to "Untitled Document" when not present.
Bigfoot::instance()->on("end_of_dom", function($dom){
$format = ( Base::instance()->get("PATH") != "/" ) ? '{{@page_title}} | RETSQL' : '{{@page_title}}';
$dom->getElementsByTagName('title')->item(0)->nodeValue = $format;
return $dom;
});
@maietta
maietta / gist:975af256a412d65f84d75b01cfdb9eda
Created February 5, 2021 23:24
Creds (Yes, this is public)
Username: 9m3nHcEQ47TO9a19
Password: L4nLj5hNkiWL31JQ
@maietta
maietta / gist:0f13dfb1ea071532e036fe937f81a4f7
Created July 30, 2020 21:39
Quick sFTP jail for sftp-only group
echo -n "User to create: " && read user && \
useradd -m $user && chsh -s /bin/bash $user && \
chr=/websites/$user && mkdir -pv $chr && chown -v root:root $chr && \
mkdir -pv $chr/home/$user && chown -Rv $user:$user $chr/home/$user && chmod -Rv 700 $chr/home/$user && \
usermod -aG sftp-only $user && \
mv $chr/.ssh/ /home/$user
@maietta
maietta / entry.sh
Last active July 24, 2020 00:12
Companion to nickmaietta/alpine-sshd image. DO NOTE DELETE!
#!/usr/bin/env bash
set -e
[ "$DEBUG" == 'true' ] && set -x
DAEMON=sshd
echo "> Starting SSHD"
@maietta
maietta / docker_events.sh
Created May 6, 2020 23:59 — forked from pragmasoft-ua/docker_events.sh
bash script to monitor and do something with docker events
#!/bin/sh
docker events --filter 'event=start' --filter 'event=stop' | while read event
do
container_id=`echo $event | sed 's/.*Z\ \(.*\):\ .*/\1/'`
echo $container_id
{
"require": {
"troydavisson/phrets": "2.*"
}
}
@maietta
maietta / gist:70b746c9497364a63b9bfbe36ec74f37
Last active January 28, 2019 07:10
PHP DOM. Find element, get parent, then find sibblings. Build JSON
<?php
$raw_content = file_get_contents("NBA_example.txt");
$dom = new DOMDocument;
$dom->loadHTML("$raw_content");
$block = $dom->getElementById("oddsGridContainer");
$results = [];
$assets = $block->getElementsByTagName('script');
@maietta
maietta / gist:6ba0cfd322f40c67536950a499ea9e84
Created January 25, 2019 16:44
PHRETS 2.x: Easy way to identify methods available for any object.
$objects = $rets->Search('Property', 'RE_1', '(L_ListingID=1800394)');
$test = get_class_methods($objects);
print_r($test);
// GIVES:
/*
Array