Skip to content

Instantly share code, notes, and snippets.

View theagoliveira's full-sized avatar

Thiago Cavalcante theagoliveira

View GitHub Profile
@theagoliveira
theagoliveira / iterate_files.sh
Created April 15, 2021 06:24
Recursively iterate through files in a directory
# SOURCE: https://unix.stackexchange.com/a/139381/454027
while IFS= read -r -d '' -u 9
do
echo "Filename is '$REPLY'"
done 9< <( find "PATH" -regex ".*\.EXTENSION" -exec printf '%s\0' {} + )
import 'package:flutter/material.dart';
void main() {
runApp(Exemplo2());
}
class Exemplo2 extends StatefulWidget {
@override
_Exemplo2State createState() => _Exemplo2State();
}
@theagoliveira
theagoliveira / .amazon-wishlist-prices
Last active December 24, 2022 21:15
Python scripts using Buku to update an wishlist of Amazon products
We couldn’t find that file to show.
@theagoliveira
theagoliveira / encoding_methods.rb
Created July 29, 2020 21:26
Encoding methods for tests using Ruby
def convert_iso_8859_1_to_utf8_a(text)
text.force_encoding('iso-8859-1').encode('utf-8')
end
def convert_iso_8859_1_to_utf8_b(text)
text.encode('utf-8').force_encoding('iso-8859-1')
end
def convert_iso_8859_1_to_utf8_c(text)
text.force_encoding('utf-8').encode('iso-8859-1')
@theagoliveira
theagoliveira / jadlog.sh
Last active October 12, 2021 19:12
Get latest tracking message from Jadlog using CT-e or Shipping (Remessa) codes
#!/usr/bin/env bash
jadlog_url="http://jadlog.com/siteInstitucional/tracking_dev.jad?cte=$1"
user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0"
src=$(curl -A "$user_agent" -s "$jadlog_url")
headers=$(echo "$src" | pup 'thead tr th text{}')
data=$(echo "$src" | pup 'tbody tr:last-of-type td text{}')
IFS=$'\n' read -d "" -ra arr_h <<< "$headers"
IFS=$'\n' read -d "" -ra arr_d <<< "$data"
@theagoliveira
theagoliveira / .export-outline
Last active December 24, 2022 21:20
Use the outline.com API to create a new link (header extracted from Firefox's Network Monitor)
We couldn’t find that file to show.
@theagoliveira
theagoliveira / starred.sh
Created May 15, 2020 07:37
Get a list of all starred GitHub repositories
#!/usr/bin/env bash
# STARTING POINT: https://gist.github.com/sebble/e5af3d03700bfd31c62054488bfe8d4f
## Add username
user="USERNAME"
starred_url="https://api.github.com/users/$user/starred?per_page=100"
# With authentication
@theagoliveira
theagoliveira / springer.py
Last active April 13, 2020 06:33
Python script to bulk download free Springer books
#!/usr/bin/env python
import os
import csv
import urllib
import wget
with open("./textbooks.csv", newline="") as csvfile:
textbooks = csv.DictReader(csvfile)
@theagoliveira
theagoliveira / .download_videos
Last active December 24, 2022 21:21
Use bash, python and buku to subscribe do YouTube Channels and download videos
We couldn’t find that file to show.
@theagoliveira
theagoliveira / artic.sh
Last active April 7, 2020 22:16
Bash script to list and/or download files from The Art Institute of Chicago website
#!/usr/bin/env bash
DownloadFlag=false
DownloadFromFileFlag=false
ListFlag=false
ArtDir="./ArtIC"
ArtDirPD="$ArtDir/PD"
ArtDirNPD="$ArtDir/NPD"
ListName=""