Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .txt
Created May 31, 2023 03:07
Pieces for Developers ( SALVAR SNIPPETS )
Pieces for Developers
https://pieces.app/
EXTENSÃO VSCODE:
https://marketplace.visualstudio.com/items?itemName=MeshIntelligentTechnologiesInc.pieces-vscode
SALVAR SNIPPET: SHIFT + CTRL + V
BUSCAR SNIPPET: CTRL + K
@leahcim
leahcim / 25_pre-os-prober
Created March 3, 2014 19:13
In Ubuntu, /etc/grub.d/30_os-prober overrides grub menu style and timeout defined by the user in /etc/default/grub. Here is a workaround to save the menu style and timeout values before os-prober changes them, and to restore them afterwards. The two files need to be placed under /etc/grub.d and made executable. Finally, "sudo update-grub" should…
#! /bin/sh
set -e
# Save the $timeout and $timeout_style values set by /etc/grub.d/00_header
# before /etc/grub.d/30_os-prober messes them up.
cat << EOF
set timeout_bak=\${timeout}
set timeout_style_bak=\${timeout_style}
EOF
@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:09
VALIDAÇÃO TAMANHO DE ARQUIVO NO UPLOAD
<?php
$tamanho = intval(filesize($arquivo) / (1024 * 1024));
if ($tamanho > 50)
{
if (file_exists($arquivo)) {unlink($arquivo)}
new TMessage('error', 'TAMANHO MÁXIMO DE ARQUIVO ATÉ 50 MEGAS');
return;
}
@DakotaLMartinez
DakotaLMartinez / instructions.md
Last active April 19, 2024 03:09
Adding an SSH key to GitHub (Mac OS X or Linux)

You need to do this if you try this command:

ssh -T git@github.com

and you get something that says

git@github.com: Permission denied (public key).
@nkhitrov
nkhitrov / structlog_fastapi.py
Created March 16, 2023 00:04
Structlog FastAPI example
"""
Structlog example configuration with FastAPI.
Features:
- async bound logger
- contextvars to log request-id and other meta data
- custom format for default logging loggers and structlog loggers
"""
import asyncio
import logging
@scriptdev
scriptdev / .php
Created June 7, 2023 19:37
ABRIR FORMULÁRIO EM EDIÇÃO NO ONSHOW
<?php
class EmpresaForm extends TPage
{
public function __construct( $param )
{
parent::__construct();
parent::add($container);
@scriptdev
scriptdev / .php
Created June 8, 2023 17:06
DEFINIR FORMULÁRIO NÃO EDITÁVEL
<?php
$this->form->setEditable(false);
@scriptdev
scriptdev / .php
Created June 8, 2023 18:23
RETORNAR A URL DO SISTEMA
<?php
$url = $_SERVER['HTTP_HOST'];
# RETORNO: https://fabricio.com.br/
@pkunc
pkunc / ansible-prefix-suffix.md
Last active April 19, 2024 03:08
Ansible: Add a prefix or suffix to all items of a list

Ansible: Add a prefix or suffix to all items of a list

Add prefix to a list items

- debug:
    var: result
  vars:
    prefix: foo
    a_list: [ "bar", "bat", "baz" ]
 result: "{{ [prefix] | product(a_list) | map('join') | list }}"