Skip to content

Instantly share code, notes, and snippets.

@caraar12345
caraar12345 / proxmox-proxy.md
Last active April 19, 2024 13:01 — forked from basoro/proxmox-proxy
Running Proxmox behind a single IP address

I ran into the battle of running all of my VMs and the host node under a single public IP address. Luckily, the host is just pure Debian, and ships with iptables.

What needs to be done is essentially to run all the VMs on a private internal network. Outbound internet access is done via NAT. Inbound access is via port forwarding.

Network configuration

Here’s how it’s done:

  • Create a virtual interface that serves as the gateway for your VMs:
@scriptdev
scriptdev / .php
Last active April 19, 2024 13:01
REMOVER ACENTOS DO TEXTO
<?php
class Funcao
{
public static function remover_acento($texto)
{
$caracteres = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ń'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
@hiqsociety
hiqsociety / sysctl.conf
Created February 4, 2021 21:55 — forked from JoeyBurzynski/sysctl.conf
sysctl.conf Optimization / Ubuntu 18.04
# Kernel sysctl configuration file for Linux
#
# Version 1.14 - 2019-04-05
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@scriptdev
scriptdev / .php
Created October 27, 2022 03:04
JUNTANDO DADOS DA ARRAY ( array_push )
<?php
TTransaction::open(self::$database);
$vendas = Venda::where('cliente_id','=', $cliente_id)->load();
$lista_vendas = array();
foreach ($vendas as $venda) {
array_push($lista_vendas, $venda->toArray());
@scriptdev
scriptdev / .php
Created October 23, 2022 20:18
REMOVER MÁSCARAS de CEP, CPF, CNPJ, CELULAR e VALOR ( str_replace )
<?php
$cep = str_replace(['.','-'], ['',''], $cep);
$cpf = str_replace(['.','-'], ['',''], $cpf);
$cnpj = str_replace(['.','/','-'], ['','',''], $cnpj);
$celular = str_replace(['(',')','-',' '], ['','','',''], $celular);
@valyala
valyala / README.md
Last active April 19, 2024 13:00
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@scriptdev
scriptdev / .php
Created October 28, 2022 20:36
EXECUTAR MÉTODO A CADA x TEMPO AUTOMATICAMENTE
<?php
TScript::create( "
setInterval(function () {
Adianti.waitMessage = 'Carregando';
__adianti_post_data('form_PedidosList', 'class=PedidosList&method=onReload');
return false;
}, 10000); // 10000 milliseconds => 10 segundos
");
@scriptdev
scriptdev / .php
Last active April 19, 2024 12:59
ENVIO DE EMAIL DO PHPMailer
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
/* SMTP - CONEXÃO
587 > TLS
465 > SSL
G-MAIL:
你长的怪像人殊不知是只人面犬
你的脸有碍观瞻
当初惊艳,完完全全,只为世面见得少。
嫉妒是一种不好的情感,我理解你嫉妒我有家人,可你这么说有点过分了
你自拍一张就是你的全家福
远看是美景,近看想报警
你在无中生有 你在暗度陈仓 你在凭空想象 你在凭空捏造 你在无言无语 你在无可救药 你是逝者安息 你是一路走好 你是傻子巴拉 你是永无止境 你是没钱买药 你是头脑有病 你是眼里有泡 你是嘴里刘能 你是污言秽语 你是咎由自取 你是殃及无辜 你是祸害众生 你是仓皇失措 你是暗度陈仓 你是无可救药
胖姑娘袭花衫,花都胖起来。
即使是做咸鱼,也要做最咸的那一条。
@scriptdev
scriptdev / .php
Created November 1, 2022 22:56
EXEMPLO GRÁFICO DE BARRAS ( VendaGraficoBarChart )
<?php
class VendaGraficoBarChart extends TPage
{
private $form;
private $loaded;
private static $database = 'exemplos';
private static $activeRecord = 'VendaGrafico';
private static $primaryKey = 'id';
private static $formName = 'form_VendaGrafico';