Skip to content

Instantly share code, notes, and snippets.

View thelink2012's full-sized avatar

Denilson das Mercês Amorim thelink2012

View GitHub Profile
@danperrout
danperrout / TesouroDireto.gs
Last active May 6, 2024 17:53
API Função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto.
* Fonte: https://www.tesourodireto.com.br/titulos/precos-e-taxas.htm
**/
function TESOURODIRETO(bondName, argumento="r") {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsondata = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsondata.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {
@willurd
willurd / web-servers.md
Last active May 6, 2024 13:43
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@xinfengliu
xinfengliu / gen_include_guard.sh
Created January 23, 2013 04:25
Create "include guard" in C/C++ header files in a batch. Used for compiling mongodb using SunCC since currently SunCC does not support "#program once".
#!/usr/bin/bash
if [[ ! -d $1 ]] || [[ ! -d $2 ]]
then
echo "\nUsage: $0 dirname_for_adding_guard source_root_dirname\n"
echo "Example: $0 src/mongo/db src"
echo -n "Will find '#pragma once' and add MONGO_DB_FOO_H in foo.h if the guard of foo.h is not there. "
echo "If the guard is already there, then skip.\n"
echo "Be careful with the dirname passed to this script, args1 must be a subdir of args2. If the condition is not met, the script will exit immediately. \n"
exit 1