Skip to content

Instantly share code, notes, and snippets.

@tatumroaquin
tatumroaquin / archlinux-qemu-kvm.md
Last active April 19, 2024 03:52
QEMU-KVM Installation for Arch Linux

Arch Linux QEMU-KVM

install all necessary packages

sudo pacman -S virt-manager virt-viewer qemu qemu-arch-extra \
edk2-ovmf vde2 ebtables dnsmasq bridge-utils openbsd-netcat libguestfs

enable libvirt daemon

@MuhammadSaim
MuhammadSaim / rarreg.key
Last active April 19, 2024 03:52
Step 1: Create a file called rarreg.key Step 2: Paste into the file the raw content of this gist Step 3: Go to Winrar install directory (by default => c:\ProgramFiles\WinRAR\ ) Step 4: Paste the rarreg.key into WinRAR directory Step 5: Enjoy
RAR registration data
WinRAR
Unlimited Company License
UID=4b914fb772c8376bf571
6412212250f5711ad072cf351cfa39e2851192daf8a362681bbb1d
cd48da1d14d995f0bbf960fce6cb5ffde62890079861be57638717
7131ced835ed65cc743d9777f2ea71a8e32c7e593cf66794343565
b41bcf56929486b8bcdac33d50ecf773996052598f1f556defffbd
982fbe71e93df6b6346c37a3890f3c7edc65d7f5455470d13d1190
6e6fb824bcf25f155547b5fc41901ad58c0992f570be1cf5608ba9
@anselmobattisti
anselmobattisti / gstreamer pipeline
Created September 10, 2019 23:37
Grab video from webcam and stream it using udpsink via x264
Pipeline to send video (simulating SRC) get the data from video0
gst-launch-1.0 v4l2src device=/dev/video0 \
! decodebin \
! x264enc \
! rtph264pay \
! udpsink host=localhost port=5000
// if you are running it inside a docker container be aware of the host ip in udpsink
gst-launch-1.0 v4l2src device=/dev/video0 \
! decodebin \
@scriptdev
scriptdev / .php
Created November 12, 2022 20:09
CAPTURAR O VALOR DO CAMPO DIRETO PELO MÉTODO find
<?php
TTransaction::open(self::$database);
$uf = Estado::find($param['key'])->uf;
TScript::create("$('input[name=\"estado\"]').val('$uf')");
TTransaction::close();
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:51
ABRIR O FORMULÁRIO EM MODO DE EDIÇÃO NO MÉTODO onShow
<?php
# 1° EXEMPLO
public function onShow($param = null)
{
$this->onEdit(['key' => $param['key']);
}
# 2º EXEMPLO
public function onShow($param = null)
@scriptdev
scriptdev / .php
Created November 25, 2022 12:45
LAYOUT DOS CAMPOS NO FORMULÁRIO
<?php
$id = new TEntry('id');
$nome = new TEntry('nome');
$linha1 = $this->form->addFields([new TLabel("CÓDIGO", null, '14px', null, '100%'),$id],[new TLabel("NOME", null, '14px', null, '100%'),$nome]);
$linha1->layout = [' col-sm-2',' col-sm-10'];
@scriptdev
scriptdev / .php
Created November 26, 2022 07:42
CALCULAR DESCONTO DE UM PRODUTO
<?php
# Um produto com valor de R$ 178,00. Quanto fica um desconto de 15%?:
$valor = 178.00;
$percentual = 15.0 / 100.0;
$valor_final = $valor + ($percentual * $valor);
echo 'O valor final do produto é: ' . $valor_final;
# Resultado é R$ 204,70
@scriptdev
scriptdev / .php
Created November 26, 2022 07:47
CALCULAR COMISSÃO DE UM PRODUTO VENDIDO PARA O VENDEDOR
<?php
# Uma loja repassa 5% de comissão a seus vendedores nas vendas.
# se um produto foi vendido por R$ 70,00 reais
# qual o valor da comissão em reais repassado ao vendedor?
$valor = 70;
$porcentagem = 5 / 100;
$comissao = $porcentagem * $valor;
@scriptdev
scriptdev / .php
Created November 26, 2022 07:50
OBTER O DIA DA SEMANA DA DATA ATUAL
<?php
$dias_semana = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado');
echo "Hoje é: " . $dias_semana[date("w")];
@joeycastillo
joeycastillo / convert.py
Created June 15, 2022 16:16
Convert Standard Ebooks EPUBs to plain text with front matter
import io
import sys
from epub2txt import epub2txt
# Designed for use with Standard Ebooks EPUB files.
# May work with others, but their structure is excellent.
try:
filepath = sys.argv[1]
except:
print('usage: python3 convert.py book_to_convert.epub')