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 | |
## Setup NAT (IP Masquerading egress + Port Forwarding ingress) on Proxmox | |
## See https://blog.rymcg.tech/blog/proxmox/02-networking/ | |
SYSTEMD_UNIT="my-iptables-rules" | |
SYSTEMD_SERVICE="/etc/systemd/system/${SYSTEMD_UNIT}.service" | |
IPTABLES_RULES_SCRIPT="/etc/network/${SYSTEMD_UNIT}.sh" | |
## Default network address is for a /24 based on the the bridge number: |
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
# Version key/value should be on his own line | |
PACKAGE_VERSION=$(cat package.json \ | |
| grep version \ | |
| head -1 \ | |
| awk -F: '{ print $2 }' \ | |
| sed 's/[",]//g') | |
echo $PACKAGE_VERSION |
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
/** | |
* Generates number of random geolocation points given a center and a radius. | |
* @param {Object} center A JS object with lat and lng attributes. | |
* @param {number} radius Radius in meters. | |
* @param {number} count Number of points to generate. | |
* @return {array} Array of Objects with lat and lng attributes. | |
*/ | |
function generateRandomPoints(center, radius, count) { | |
var points = []; | |
for (var i=0; i<count; 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
SSE3=1 SSSE3=1 SSE4_1=1 SAHF=1 AVX=0 FMA3=0 BMI1=0 BMI2=0 LZCNT=0 POPCNT=1 ATOM=0 | |
Usage: | |
shell [options] -e string | |
execute string in V8 | |
shell [options] file1 file2 ... filek | |
run JavaScript scripts in file1, file2, ..., filek | |
shell [options] | |
shell [options] --shell [file1 file2 ... filek] | |
run an interactive JavaScript shell | |
d8 [options] file1 file2 ... filek |
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/sh | |
echo You should have the project tracked by version control in case something goes wrong. | |
printf 'Press any key to continue...' | |
read -r | |
path=${1:-.} | |
echo Optimizing images in "$path" | |
if [ -z "$(command -v jpeg-recompress)" ] || [ -z "$(command -v ladon)" ] || [ -z "$(command -v mogrify)" ]; then |
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
{"lastUpload":"2019-09-24T14:53:11.869Z","extensionVersion":"v3.4.3"} |
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
function whmAPI($server_ip, $root_pass, $function, $parameter = '', $type='') | |
{ | |
$whmusername = "root"; | |
if ($type == 'cpanel') { | |
$query = "https://" . $server_ip . ":2087/json-api/cpanel?api.version=1&cpanel_jsonapi_apiversion=2" . $parameter; | |
} else { | |
$query = "https://" . $server_ip . ":2087/json-api/" . $function . "?api.version=1" . $parameter; | |
} | |
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
<?php | |
// source: http://cubiq.org/the-perfect-php-clean-url-generator | |
// author: Matteo Spinelli | |
// MIT License / http://creativecommons.org/licenses/by-sa/3.0/ (please re-check at source) | |
setlocale(LC_ALL, 'en_US.UTF8'); | |
function toAscii($str, $replace=array(), $delimiter='-') { | |
if( !empty($replace) ) { | |
$str = str_replace((array)$replace, ' ', $str); | |
} |
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
<?php | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <[email protected]> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |
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/sh | |
# Usage 1: | |
# optimize-images.sh /images/dir | |
# | |
# Usage 2: | |
# cd /images/dir | |
# optimize-images.sh | |
EXTENSIONS="jpe?g" |
NewerOlder