Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Giuliano Oliveira giuliano-oliveira

🏠
Working from home
  • Brazil
View GitHub Profile
@giuliano-oliveira
giuliano-oliveira / gdown_folder_regex.py
Last active Oct 25, 2020
Shallow download files from Google Drive folder with requests,bs4 and regex
View gdown_folder_regex.py
import re
from bs4 import BeautifulSoup
import requests
import gdown
import json
import argparse
parser=argparse.ArgumentParser()
parser.add_argument("url")
View download_folder.py
from .download import download
from bs4 import BeautifulSoup
import json
import re
import requests
import sys
if sys.version_info.major < 3:
from pathlib2 import Path
else:
@giuliano-oliveira
giuliano-oliveira / custom_commands.sh
Created Nov 2, 2020
some common custom shell commands i use, you can add to your home directory and add "source custom_commands.sh" on your .bashrc file to add them.
View custom_commands.sh
function notify_when_online(){
host=$1
while true; do
ping -c1 $host > /dev/null && break;
done && notify-send --icon=dialog-information "$host is online"
}
@giuliano-oliveira
giuliano-oliveira / download_file.rs
Last active Nov 25, 2021
Download large files in rust with progress bar using reqwest, future_util and indicatif
View download_file.rs
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
View print_json.go
package main
import (
"encoding/json"
"fmt"
)
func printJson(data interface{}) {
bs, err := json.MarshalIndent(data, "", " ")
if err != nil {
@giuliano-oliveira
giuliano-oliveira / quadratic_bezier.rs
Last active Nov 18, 2021
Quadratic bézier function in rust (not the most performant, focused in readability)
View quadratic_bezier.rs
use std::fmt;
#[derive(Debug, Clone, Copy)]
struct Point {
x: f64,
y: f64,
}
impl fmt::Display for Point {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@giuliano-oliveira
giuliano-oliveira / cubic_bezier.rs
Last active Nov 15, 2021
Cubic bézier function in rust (not the most performant, focused in readability)
View cubic_bezier.rs
use std::fmt;
#[derive(Debug, Clone, Copy)]
struct Point {
x: f64,
y: f64,
}
impl fmt::Display for Point {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {