This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery addons | |
// Serialize form fields recursively into json type object, | |
// so for example <input type="text" name="record[type][x]" value="1"> becomes {type: {x: 1}} | |
var | |
rbracket = /\[\]$/, | |
rarrayKeys = /\[(.*?)\]/g, | |
rarrayKeysPrefix = /^(.*?)\[.*/g, | |
rCRLF = /\r?\n/g, | |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Unifi NVR + letsencrypt certificate | |
# Remember to use fullchain.pem | |
# Thanks: https://www.john.geek.nz/2018/05/using-letsencrypt-with-ubiquiti-unifi-video-server/ | |
# | |
# Also remember adding `ufv.custom.certs.enable=true` to the `/usr/lib/unifi-video/data/system.properties` file | |
# | |
HOSTNAME=XXX.gm.lv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Make sure you have screen installed (on debian). On Arch linux no screen is required. | |
# Debian: | |
# apt-get install screen | |
# | |
# Monit example: | |
# check process ssh-tunnel matching "^ssh -N sshtunnel" | |
# user root | |
# start program = "/root/ssh_tunnel.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This script will cleanup docker registry images, that are older than 7 days (see REMOVE_OLDER_THAN_DAYS). | |
# Note: This will only work on v2 registry. | |
# Before running make sure you have: | |
# 1. Installed requirements by running `python3 -m pip install -r requirements.txt` | |
# 2. Put registry password in `.registry-password` file | |
# 3. Updated correct values in `Constants` section | |
# Then run `python3 cleanup.py` or `chmod +x cleanup.py && ./cleanup.py` | |
# After cleaning registry, run garbage collector on registry, for example: `docker compose exec registry sh -c "/bin/registry garbage-collect --delete-untagged /etc/docker/registry/config.yml"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import re | |
import shutil | |
from datetime import datetime | |
from pathlib import Path | |
from PIL import Image | |
import argparse | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
1. install openai and memory_profiler | |
2. Add following to class Completions(SyncAPIResource): | |
def forceClose(self): | |
self.with_raw_response = None | |
3. Add following to class class OpenAI(SyncAPIClient): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/docker-prune.service | |
[Unit] | |
Description=Daily Prune of Docker Images and Containers | |
Documentation=https://docs.docker.com/config/pruning/ | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/docker system prune -f | |
ExecStartPost=/usr/bin/echo "Docker environment now as clean as a whistle, or at least cleaner than yesterday." |
OlderNewer