Skip to content

Instantly share code, notes, and snippets.

@heartshare
heartshare / proxmox-backup.md
Created May 7, 2024 05:55 — forked from scyto/proxmox-backup.md
setup promox backup server and synology as data store over SMB

Proxmox Backup

At this time proxmox backup only backs up VM and Containers - ths guide covers that.

What i didn't realize is the backup job is still defined on the cluster and PBS provides a new storage type that dedupes and managed all the vzdump files created - which is cool.

I decided to run proxmox backup on my Synology NAS where it has more reliable connection to the NAS (i.e. via memory) for doing deduple, garbage collection, prune, verification etc. However the steps here generally remain true.

Once again i used one of Derek Seaman's Awesome Blogs for the basis of this - but with my own tweaks (like using SMB instead of CIFS. As of 9/21 my tweaks are signifcnant, in the original blog it is missing steps to enable encoding acceleration in CTs and VMs.

this gist is part of this series

@heartshare
heartshare / HandleInertiaRequests.php
Created July 28, 2023 07:33 — forked from lukaskleinschmidt/HandleInertiaRequests.php
inertia-laravel multiple root views
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{
# Not a production ready deployment solution.
# Shell commands to enable docker swarm on multiple Ubuntu nodes.
# Use these commands for reference.
# Copy ssh public key to all nodes
# Will ask for root password, once the ssh successful root ssh public key will be added to docker manager node
for host in host1 host2 host3 host4
do
ssh-copy-id root@${host}
done

Introduction

A software development that plans development how developer coding and testing that process is a continuous integration and then continuous delivery is a process that auto testing on staging[docker] that will marge other code committed by other developers and then deploy to production server manually OR continuous deployment is a process that auto testing and auto-deploy to a production server, aim to automatic DevOps.

How CI/CD works

every time you do git push will trigger CI operation that will follow the user script instruction (gitlab-ci.yml) to do DevOps operation.

create a git project

@heartshare
heartshare / cloudflare.sh
Created June 8, 2023 08:23 — forked from Manouchehri/cloudflare.sh
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
# Static Brotli:
# Browser accepts brotli, and matching pre-compressed file exists => rewrite to .br file
# For each file format set the correct mime type (otherwise brotli mime type is returned) and prevent Nginx for recompressing the files
set $extension "";
if ($http_accept_encoding ~ br) {
set $extension .br;
}
if (-f $request_filename$extension) {
rewrite (.*) $1$extension break;
@heartshare
heartshare / php-return-redis-handle-into-redis-pool.php
Created May 31, 2023 01:16 — forked from linuxd3v/php-return-redis-handle-into-redis-pool.php
PHP Swoole - properly returning the pooled redis handle into the pool in a "finally" block
protected function removeSomeListItemBlahBlah(string $name, string $key)
{
try {
$cacheHandle = $this->pool->borrow();
$result = $cacheHandle->lrem($name, $key, 0);
} catch (Throwable $e) {
// Log the error
$this->logger->error('Exception while trying to removeSomeListItemBlahBlah', ['exception' => $e]);
import SwiftUI
struct ContentView: View {
@StateObject var service = ChatGPTService()
@State var textResponse = ""
var body: some View {
VStack {
Text("Bot says: \(textResponse)")
Button {
Task {
@heartshare
heartshare / nginx-wordpress.conf
Created February 21, 2023 01:12 — forked from nfsarmento/nginx-wordpress.conf
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}