https://dev.mysql.com/doc/refman/8.4/en/
sábado, 5 de octubre de 2024
https://developers.facebook.com/docs/pages-api/comments-mentions/
Get comments
To get the comments for a Page post, send a GET request to the /page_post_id/comments endpoint with the fields parameter set to a comma-separated list that includes the message field, to get the content for the comment and the from field, to get the Page-scoped ID (PSID) for the person or Page who commented on the post, if you would like to @mention the person or Page in the comment.
Example Request
Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.curl -i -X GET "https://graph.facebook.com/page_post_id/comments?fields=from,message"
On success, your app receives the following JSON response with the commentor's name, PSID, message and the comment ID:
{ "data": [ { "created_time": "2020-02-19T23:05:53+0000", "from": { "name": "commentor_name", "id": "commentor_PSID" }, "message": "comment_content", "id": "comment_id" } ], "paging": { "cursors": { "before": "MQZDZD", "after": "MQZDZD" } }
}
https://developers.facebook.com/docs/pages-api/comments-mentions/
lunes, 27 de noviembre de 2023
Count Textarea Characters with JavaScript
I've been playing around with the Twitter API lately and, as you know, Tweets can only be 140 characters long. I wanted to use a textarea element, not an input type="text", so I couldn't just use maxchars to limit the number of characters. Additionally, I get annoyed when my text is chopped off when pasting. So, what to do? Well, I thought, why not make a little character counter like the one you find on the actual Twitter?
The first step is to create the JavaScript function. I placed mine in a file called count-chars.js and it looks like this:
function countChars(textbox, counter, max) {
var count = max - document.getElementById(textbox).value.length;
if (count < 0) { document.getElementById(counter).innerHTML = "<span style=\"color: red;\">" + count + "</span>"; }
else { document.getElementById(counter).innerHTML = count; }
}textbox and counter are the IDs of the elements of the textarea we're counting and the span where the count is going to go, respectively.
There's lots you can customize there. You could disable the form if too many characters are entered or you could automatically truncate the text. But, I prefer to just have the warning show up in red text.
The next step is to write the HTML itself:
<script type="text/javascript" src="/js/count-chars.js"></script>
<form action="#" method="POST">
<p>Tweet Something: <span id="char_count"></span><br><textarea name="tweet" id="textbox" class="form-control" rows="3" cols="60" onFocus="countChars('textbox','char_count',140)" onKeyDown="countChars('textbox','char_count',140)" onKeyUp="countChars('textbox','char_count',140)"></textarea></p>
<p><input type="submit" class="btn btn-primary" value="Tweet" /></p>
</form>
domingo, 15 de octubre de 2023
GPT PDF
https://nanonets.com/blog/chat-with-pdfs-using-chatgpt-and-openai-gpt-api/
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/