Skip to content

Instantly share code, notes, and snippets.

View IuryAlves's full-sized avatar

Iury Alves de Souza IuryAlves

View GitHub Profile
prompt_kubectl() {
currentCluster=$(kubectx -c 2>/dev/null)
currentNamespace=$(kubens -c 2>/dev/null)
if test -n "$currentCluster"; then
prompt_segment yellow black "kubernetes($currentCluster:$currentNamespace)"
fi
}
@IuryAlves
IuryAlves / test.go
Last active April 8, 2022 12:05
test.shell
➜ go run ./main.go
Running ....
Active cluster: europe-west1-b/gke-eu
Grid emissions percentage: 48
Active cluster: europe-west1-b/gke-eu
Grid emissions percentage: 48
Active cluster: europe-west1-b/gke-us
Grid emissions percentage: 40
Active cluster: europe-west1-b/gke-us
Grid emissions percentage: 40
@IuryAlves
IuryAlves / ftpClient.py
Last active September 15, 2021 11:54
Cliente FTP implementado em python
# coding: utf-8
from ftplib import FTP
import log
import logging
#log.criarLog()
log.atualizarLog()
# A função abaixa um arquivo definido por 'filename' na pasta definida por local com o nome
# especificado por 'name'
def download(handler, name, filename="musica1.mp3"):
@IuryAlves
IuryAlves / ftpServer.py
Last active July 28, 2019 23:40
Uso básico de um servidor FTP implementado em python com a biblioteca pyftpdlib https://code.google.com/p/pyftpdlib/
#encoding: utf-8
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
import sys
# importante: a biblioteca pyftpdlib não é padrão do python, precisa ser instalada
# link: https://code.google.com/p/pyftpdlib/downloads/list
# coding: utf-8
import requests
from multiprocessing import Process, Pipe
def downloader(url, chunk_size, conn):
downloaded_parts = 0
with open('download', 'wb') as fp:
# coding: utf-8
import requests
chunk_size = 1024 * 1024 # 1mb
download_url = 'http://speedtest.ftp.otenet.gr/files/test10Mb.db'
downloaded_parts = 0
with open('download', 'wb') as fp:
response = requests.get(download_url, stream=True)
from pprint import pprint
from datetime import datetime
from project_files import *
from git_hub_scrapper import *
from file import *
DOMAIN = 'https://github.com'
def main():
print('[INICIO.{_date:%Y/%m/%d %H:%M:%S}]'.format(_date=datetime.now()))
def get_depth(self):
parent = self.parent
depth = 0
while parent is not None:
parent = parent.parent
depth += 1
return depth
# coloca isso na classe Link
# coding: utf-8
"""
pip install requests beautifulsoup4
"""
import requests
from bs4 import BeautifulSoup
import java.util.List;
public class Teste {
public static void main(String[] args) {
Estoque e = new Estoque();
//cadastrando carros