Skip to content

Instantly share code, notes, and snippets.

👨‍🔬
Can you solve the 3n + 1 problem?

Webysther Nunes webysther

👨‍🔬
Can you solve the 3n + 1 problem?
View GitHub Profile
View security-group-cleanup.py
#!/usr/bin/env python
import os
import boto3
import argparse
import json
# `pip install -U PTable` will get you the right fork of PrettyTable
from prettytable import PrettyTable
from botocore.exceptions import ClientError
@webysther
webysther / paralelo.py
Last active Jun 16, 2020
Envio de arquivos paralelo
View paralelo.py
#!/usr/bin/env python3
# coding: utf-8
import subprocess, time, multiprocessing
arquivos = (
'file1.csv',
'file2.csv',
'file3.csv',
'file4.csv',
@webysther
webysther / pandas_to_hyper.py
Created May 21, 2020
Convert dataframe to hyper
View pandas_to_hyper.py
USER = 'user'
PASS = 'passowrkd'
SITE = 'site name'
URI = 'url of tableau server'
tableau_auth = TSC.TableauAuth(USER, PASS, SITE)
server = TSC.Server(URI)
with server.auth.sign_in(tableau_auth):
all_datasources, pagination_item = server.datasources.get()
@webysther
webysther / createSecureString.yaml
Created May 18, 2020 — forked from christopherhan/createSecureString.yaml
Custom Lambda-backed CloudFormation resource to create a SecureString in ParameterStore
View createSecureString.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Put a SecureString parameter in SSM Parameter Store
Parameters:
KmsKeyId:
Type: String
Description: The KMS Key you want to use to encrypt the string.
SSMParameterKey:
Type: String
Description: The Parameter Store Key
SSMParameterValue:
@webysther
webysther / list_available_packages.py
Last active May 14, 2020 — forked from mrshu/list_available_packages.py
Python list available packages
View list_available_packages.py
import pkg_resources
installed_packages = pkg_resources.working_set
for package in sorted(installed_packages, lambda x: x.key):
print "{}=={}".format(package.key, package.version)
import pkg_resources
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
View aws_glue_python_shell_installed_packages.txt
awscli==1.14.45
boto3==1.5.35
botocore==1.8.49
colorama==0.3.7
docutils==0.14
futures==3.2.0
jmespath==0.9.3
numpy==1.14.0
pandas==0.22.0
pip==9.0.1
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@webysther
webysther / sp
Created Mar 4, 2020 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
View sp
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
View tricks.sql
date_parse('2019-05-01 23:05:04','%Y-%m-%d %H:%i:%s');
date_format(col,'%Y-%m-%d %H:%i:%s');
# athena snapshot
date_parse('20190501T23:00:00','%Y%m%dT%H:%i:%s');
# converte data em milisegundos para segundos
from_unixtime(to_unixtime(created_at)/1000)
@webysther
webysther / folder_bucket_clean.py
Created Sep 27, 2018
Bucket 'folder' cleanup
View folder_bucket_clean.py
def bucket_cleanup(name, path):
s3 = boto3.resource('s3')
bucket = s3.Bucket(name)
objects_to_delete = []
for obj in bucket.objects.filter(Prefix=path):
objects_to_delete.append({'Key': obj.key})
bucket.delete_objects(
Delete={
You can’t perform that action at this time.