https://nanonets.com/blog/chat-with-pdfs-using-chatgpt-and-openai-gpt-api/
domingo, 15 de octubre de 2023
lunes, 9 de octubre de 2023
Google tts audio generation
https://cloud.google.com/text-to-speech/docs/audio-profiles
To generate an audio file, make a POST request and provide the appropriate request body. The following shows an example of a POST request using curl. The example uses the access token for a service account set up for the project using the Google Cloud Platform Cloud SDK. For instructions on installing the Cloud SDK, setting up a project with a service account, and obtaining an access token, see the Quickstarts.
The following example shows how to send a request to the text:synthesize endpoint.
curl \
-H "Authorization: Bearer "$(gcloud auth print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'This is a sentence that helps test how audio profiles can change the way Cloud Text-to-Speech sounds.'
},
'voice':{
'languageCode':'en-us',
},
'audioConfig':{
'audioEncoding':'LINEAR16',
'effectsProfileId': ['telephony-class-application']
}
}" "https://texttospeech.googleapis.com/v1beta1/text:synthesize" > audio-profile.txt
If the request is successful, the Text-to-Speech API returns the synthesized audio as base64-encoded data contained in the JSON output. The JSON output in the audio-profiles.txt file looks like the following:
{
"audioContent": "//NExAASCCIIAAhEAGAAEMW4kAYPnwwIKw/BBTpwTvB+IAxIfghUfW.."
}
To decode the results from the Cloud Text-to-Speech API as an MP3 audio file, run the following command from the same directory as the audio-profiles.txt file.
sed 's|audioContent| |' < audio-profile.txt > tmp-output.txt && \
tr -d '\n ":{}' < tmp-output.txt > tmp-output-2.txt && \
base64 tmp-output-2.txt --decode > audio-profile.wav && \
rm tmp-output*.txtmiércoles, 27 de septiembre de 2023
PDF search and sort
pdfgrep -P '\(809|829|849\)\d{7}' VILLA-NAZARET-BAYONA.pdf | grep -oP '\((809|829|849)\).{10}'
pdfgrep -P '\(809|829|849\)\d{7}' VILLA-NAZARET-BAYONA.pdf | grep -oP '\((809|829|849)\).{10}' | sed 's/[^0-9]//g'
pdfgrep -P '\(809|829|849\)\d{7}' PRM_HATO NUEVO.pdf | grep -oP '\((809|829|849)\).{10}' | sed 's/[^0-9]//g' > PRM _ MANOGUAYABO.txt
miércoles, 9 de agosto de 2023
ding sounds
https://pixabay.com/sound-effects/search/ding/
domingo, 25 de junio de 2023
find if a word or substring exist based on php array
<?php
$acctname = array(
"Nash_paid",
"Nash_Orange",
"Sagi_Orange",
"Sagu_paid",
"Red_Phone",
"Main_Paid",
"Abi_Orange",
"Abi_paid",
"Repeated client_",
"Meni_Road",
"Meni_Towing",
"Main_line");
$string="Red_Phone";
foreach($acctname as $substring){
if (stripos($string, $substring) !== false) {
echo "$substring<br>";
}
}
?>
get the the monday and sunday from a week a go
<?php
// Get the current date
$currentDate = date('Y-m-d');
// Calculate the previous week's Monday
$previousMonday = date('Y-m-d', strtotime($currentDate . ' -1 week monday'));
// Calculate the previous week's Sunday
$previousSunday = date('Y-m-d', strtotime($currentDate . ' -1 week sunday'));
// Display the results
echo "Previous Week's Monday: " . $previousMonday . "<br>";
echo "Previous Week's Sunday: " . $previousSunday . "<br>";
?>
sábado, 6 de mayo de 2023
html table
<!DOCTYPE html>
<html>
<head>
<style>
* {
/* Change your font family */
font-family: sans-serif;
}
.content-table {
border-collapse: collapse;
margin: 25px 0;
font-size: 0.9em;
min-width: 400px;
border-radius: 5px 5px 0 0;
overflow: hidden;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
.content-table thead tr {
background-color: #009879;
color: #ffffff;
text-align: left;
font-weight: bold;
}
.content-table th,
.content-table td {
padding: 12px 15px;
}
.content-table tbody tr {
border-bottom: 1px solid #dddddd;
}
.content-table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
.content-table tbody tr:last-of-type {
border-bottom: 2px solid #009879;
}
.content-table tbody tr.active-row {
font-weight: bold;
color: #009879;
}
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How to Style HTML Tables with CSS</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<table class="content-table">
<thead>
<tr>
<th>Rank</th>
<th>Name</th>
<th>Points</th>
<th>Team</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Domenic</td>
<td>88,110</td>
<td>dcode</td>
</tr>
<tr class="active-row">
<td>2</td>
<td>Sally</td>
<td>72,400</td>
<td>Students</td>
</tr>
<tr>
<td>3</td>
<td>Nick</td>
<td>52,300</td>
<td>dcode</td>
</tr>
</tbody>
</table>
</body>
</html>
https://dcode.domenade.com/tutorials/how-to-style-html-tables-with-css