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
client = openai.OpenAI(api_key=token) | |
# Define a Pydantic model for the extracted data part (the inner dictionary) | |
class ExtractedData(BaseModel): | |
root: Dict[str, str] | |
@field_validator('root') | |
def validate_keys(cls, field): | |
for k in field.keys(): | |
if not (len(k) <= 2 and k.isdigit()): |
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
import os | |
import glob | |
import openai | |
# Configure your OpenAI API key | |
openai.api_key = OPENAI_API_KEY | |
# Define your prompt for editing | |
PROMPT_TEMPLATE = """ | |
TASK: Edit the following Python Django models.py file by adding Meta class configurations for sensitive fields. |
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 | |
MAIN_BRANCH="master" | |
changed_files=$(git diff --name-only $MAIN_BRANCH) | |
markdown_summary="# Diff Summary\n\n" | |
for file in $changed_files; do | |
file_diff=$(git diff $MAIN_BRANCH -- "$file") |
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
import s3fs | |
import os | |
AWS_ACCESS_KEY_ID=os.getenv('AWS_ACCESS_KEY_ID') | |
AWS_SECRET_ACCESS_KEY=os.getenv('AWS_SECRET_ACCESS_KEY') | |
BUCKET_ROOT = os.getenv('BUCKET_ROOT') | |
fs = s3fs.S3FileSystem(key=AWS_ACCESS_KEY_ID, secret=AWS_SECRET_ACCESS_KEY) | |
def load_from_s3(target_function, s3_path, *args, **kwargs): |
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
const fs = require('fs'); | |
const ANSI_OUTPUT = fs.readFileSync('./data/Saidaimpressora_ansi_01.txt'); | |
const LINE_DELIMITER = "\r\n"; | |
const READING_DELIMITER = '\x00--------------------'; | |
const REGEXP_TIMESTAMP = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}\s{1,}[0-9]{2}\:[0-9]{2}\:[0-9]{2}/gi | |
const REGEXP_WEIGHT = /p\.liq/gi | |
const REGEXP_WEIGHT_MEASUREMENT = /[0-9]{1,}\.[0-9]{1,}.[a-z]{1}/gi | |
const REGEXP_MODEL = /modelo/gi |
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
const fs = require('fs'); | |
const ANSI_OUTPUT = fs.readFileSync('./data/Saidaimpressora_ansi_01.txt'); | |
const LINE_DELIMITER = "\r\n"; | |
const READING_DELIMITER = '\x00--------------------'; | |
const REGEXP_TIMESTAMP = /[0-9]{2}\/[0-9]{2}\/[0-9]{4}\s{1,}[0-9]{2}\:[0-9]{2}\:[0-9]{2}/gi | |
const REGEXP_WEIGHT = /p\.liq/gi | |
const REGEXP_WEIGHT_MEASUREMENT = /[0-9]{1,}\.[0-9]{1,}.[a-z]{1}/gi | |
const REGEXP_MODEL = /modelo/gi |
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
[user] | |
name = Matheus Deister | |
email = deistermatheus@gmail.com | |
[alias] | |
# checkouts | |
co = checkout | |
cb = checkout -b # to new named branch | |
cm = checkout master | |
cmp = !git checkout master && git pull |
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
db.getCollection('list').aggregate([ | |
{ | |
$facet: { | |
"events":[{ | |
$match: { | |
'type': 'Event' | |
} | |
}], | |
"tasks": [{ | |
$match: { |
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
/** | |
* Função de renderização condicional que envolve um elemento JSX e retorna | |
* um AlertDialog informando que não é possível realizar a ação. Se for passado | |
* um elemento composto (ex: ConfirmationDialog(Button)), retorna o elemento interno | |
* envolvido por um AlertDialog. | |
* @param {JSX.Element} renderedComponent - Elemento JSX renderizado que deve ser desabilitado pelo Dialog. | |
* @param {Object} AlertDialogProps - {@link https://github.com/assisrafael/react-bootstrap-utils/blob/master/src/dialog/AlertDialog.jsx react-bootstrap-utils/AlertDialog } | |
* @returns {JSX.Element} - componente envolvido por um Alert Dialog | |
*/ | |
const somenteLeitura = function(Component, AlertDialogProps = { |
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
/** | |
* Spiral Walk over a matrix. | |
* @param {Array[] | Array} matrix | |
* @param {Boolean} values - defaults to false. Returns an ordered array of {x,y} coordinates or the values in the matrix. | |
*/ | |
function spiralMatrix(matrix, values = false) { | |
const { rows, columns } = getMatrixDimensions(matrix); | |
if (!columns) { | |
return matrix; |
NewerOlder