Skip to content

Instantly share code, notes, and snippets.

Avatar

Renan LE CARO renanlecaro

View GitHub Profile
@renanlecaro
renanlecaro / make-output.log
Created Apr 21, 2022
Error output when compiling smstools on ubuntu 21.10, running make instead of using apt-get
View make-output.log
cd src && make -
make[1]: Entering directory '/home/renan/Downloads/smstools3/src'
cc -D NUMBER_OF_MODEMS=64 -D NOSTATS -W -Wall -D_FILE_OFFSET_BITS=64 -c -o extras.o extras.c
extras.c: In function ‘my_system’:
extras.c:1077:42: warning: ‘/smsd_’ directive output may be truncated writing 6 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
1077 | snprintf(tmp1, sizeof(tmp1), ">%s/smsd_%s_1.XXXXXX", tmpdir, info);
| ^~~~~~
extras.c:1077:9: note: ‘snprintf’ output 17 or more bytes (assuming 4112) into a destination of size 4096
1077 | snprintf(tmp1, sizeof(tmp1), ">%s/smsd_%s_1.XXXXXX", tmpdir, info);
@renanlecaro
renanlecaro / rate-limit.js
Last active Mar 14, 2021
Rate limiting for Meteor in 2021
View rate-limit.js
/*
Ensures that a function "fn" is only run every "delay" milliseconds.
Let's say you have two meteor users, and they want to call a function repeatedly to send 300 emails each.
Your mailing API blocks you if you go over 2 req per second.
Your SERVER code would look like this
// the expensive function
function rawSendMail(a,b,c){
@renanlecaro
renanlecaro / gist:2e2f6d1c4766463056a65d2fff6fc46c
Last active Mar 7, 2020
Bookmarklet to copy table data as json
View gist:2e2f6d1c4766463056a65d2fff6fc46c
document.addEventListener('click', function extractDataFromTable(e) {
var target = e.target;
while (target.parentElement && target.tagName !== 'TABLE') {
target = target.parentElement;
};
if (target.tagName === 'TABLE') {
var header = [].map.call(target.querySelector('tr').children, function (n){return n.innerText});
var trs=[].map.call(target.querySelectorAll('tr'),function (i){return i});
var values = trs.map(function(tr) {
var cells=[].map.call(tr.querySelectorAll('td'),function (n){return n.innerText});
View gist:232feb84ef776046dde0
<div id='Dymadoc'>Dymadoc</div><div id='ADDADYMADOC'>Ajouter une dymadoc</div><div id='ADDADYMADOCNEWDOCURL'>Url de la dymadoc à ajouter</div><div id='PLEASEWRITEDDOCURL'>Merci d'entrer l'url de la Dymadoc à ajouter</div><div id='NOTMOBILEENABLED'>Désolé, cette Dymadoc n'a pas l'option mobile activée</div><div id='NEWDOCISOK'>Cette dymadoc est valide</div><div id='Unnamed Documents'>[Document sans nom]</div><div id='Unnamed Courrier départ'>[Courrier sans nom]</div><div id='Unnamed Courrier arrivé'>[Courrier sans nom]</div><div id='Unnamed Person'>[Contact sans nom]</div><div id='doc.shareModes.notShared'>Pas encore diffusé</div><div id='LASTUPDATED'>Mis à jours </div><div id='UPDATING'>Chargement en cours</div><div id='HELPGOTIT'>Compris</div><div id='MENUGENRECHERCHERAPIDE'>Rechercher ici</div><div id='HOMEMAILSTITLE'>Courriers</div><div id='HOMEDOCSTITLE'>Documents</div><div id='HOMEPHOTOSTITLE'>Albums Photos</div><div id='HOMEDIRECTORYTITLE'>Partenaires</div><div id='HELPDRAFTREMINDER'>Ce document est un