Skip to content

Instantly share code, notes, and snippets.

View maietta's full-sized avatar

Nick Maietta maietta

View GitHub Profile
@maietta
maietta / deploy.sh
Created March 22, 2023 16:26
Bash script to deploy SvelteKit apps to CapRover. Auto-installs CapRover and configures app for Node Servers.
#!/bin/bash
# This script prepares and deploys SvelteKit for Node servers. See: https://kit.svelte.dev/docs/adapter-node#deploying for details.
APP_NAME="<replace_with_app_name>"
APP_TOKEN="<replace_with_token>"
CAPROVER_URL="https://root-domain.com"
if ! [ -x "$(command -v caprover)" ]; then
echo "Installing CapRover globally."
@maietta
maietta / .env.production
Created January 24, 2023 21:40
Deploy SvelteKit app to CapRover using .env.production and local bash script.
# Caprover App Config
APP_NAME=cool-app-frontend
APP_TOKEN=113771eb3437d6df5c03bd47017270b584e9d894ed95fb353a607441c9f1d349
CAPROVER_SERVER=https://captain.example.com
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman" language="en-US">All systems are operational at this time.</Say>
</Response>
@maietta
maietta / multipart_upload.go
Created June 1, 2022 23:57 — forked from adisheshsm/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@maietta
maietta / docker.md
Created April 19, 2022 02:35 — forked from FreddieOliveira/docker.md
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@maietta
maietta / puppeteer.js
Created January 1, 2022 03:59 — forked from guillemcanal/puppeteer.js
control a chrome instance running on you Mac using a containerized puppeteer script
// First, run a Chrome instance on your Mac:
// /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 &> /dev/null &; disown
const puppeteer = require('puppeteer-core');
const axios = require('axios');
const getBrowserWSEndpoint = async (baseUrl) => {
const response = await axios.get(`http://${baseUrl}/json/version`);
return response.data.webSocketDebuggerUrl;
@maietta
maietta / OpenWrt SSH tunnel.md
Created November 11, 2021 01:39 — forked from ssalonen/OpenWrt SSH tunnel.md
OpenWrt SSH tunnel

Short how-to for creating a reverse ssh tunnel to a remote server. Useful for breaking NATted connection for example.

  1. At OpenWrt:
opkg update
opkg install sshtunnel
  1. At remote server: create client ssh keys
@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;
});