Skip to content

Instantly share code, notes, and snippets.

View seporaitis's full-sized avatar

Julius Seporaitis seporaitis

View GitHub Profile
@seporaitis
seporaitis / aioboto3_test.py
Created February 8, 2019 14:37
aioboto3 pagination
import asyncio
import os
import aioboto3
loop = asyncio.get_event_loop()
async def test():
async with aioboto3.client('s3', region_name='us-east-1') as s3:
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S
@seporaitis
seporaitis / ec2.py
Last active June 6, 2018 10:10
Botocore credentials resolver example and updated ansible dynamic inventory script
#!/usr/bin/env python
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
@seporaitis
seporaitis / iam.py
Created April 23, 2018 09:36 — forked from adamchainz/iam.py
Ansible IAM modules
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@seporaitis
seporaitis / my_filters.py
Created April 23, 2018 09:36 — forked from adamchainz/my_filters.py
Ansible Jinja2 filters for deleting anonymous ec2 instances
import datetime as dt
import time
import unittest
def aws_age_seconds(ec2_launch_time):
"""
Parse the ec2 launch time string and return how old it is in seconds.
"""
# Strip trailing subsecond part
@seporaitis
seporaitis / docker-cleanup-resources.md
Created September 18, 2017 11:41 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@seporaitis
seporaitis / prlint
Created September 13, 2017 10:10
prlint.sh
#!/usr/bin/env bash
prlint() {
if [ "$1" = "" ]
then
echo "prlint <pr>"
return 1
fi
pr_number=$1
@seporaitis
seporaitis / arc.sh
Last active September 7, 2017 13:28
Poor mans arcanist :~~~~~~~(
#!/usr/bin/env bash
arc() {
if [ "$1" = "" ]
then
echo "arc (feature|diff|reset)"
return 1
fi
command=$1
@seporaitis
seporaitis / tries.py
Created May 2, 2017 19:21
Simple tries implementation in python
#!/usr/bin/env python3
class Node(dict):
def __init__(self, *args, **kwargs):
super(*args, **kwargs)
self.end = kwargs.get('end', False)
def add_word(self, word):
if not word:
Komisaras Vytenis Andriukaitis
=> patarėja Vilija Sysaitė
=> socialdemokrato Algirdo Syso dukra
Buvęs premjeras Algirdas Butkevičius
=> buvęs atstovas spaudai Mindaugas Janulionis
=> dabar naujojo ūkio ministro Mindaugo Sinkevičiaus atstovas spaudai
=> tėtis Rimantas Sinkevičius buvo susisiekimo ministras
=> tėtis dukterinės „Lietuvos geležinkelių“ įmonės „Gelmagis“ vadovas
=> vėliau sujungta su kita dukterine LG įmone UAB „Geležinkelių tiesimo centru“