Skip to content

Instantly share code, notes, and snippets.

View webysther's full-sized avatar
👨‍🔬
Can you solve the 3n + 1 problem?

Webysther Sperandio webysther

👨‍🔬
Can you solve the 3n + 1 problem?
View GitHub Profile
@christopherhan
christopherhan / createSecureString.yaml
Last active August 25, 2022 18:35
Custom Lambda-backed CloudFormation resource to create a SecureString in ParameterStore
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:
@mrshu
mrshu / list_available_packages.py
Created February 4, 2019 15:49
Python list available packages
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)
@mrshu
mrshu / aws_glue_python_shell_installed_packages.txt
Created February 1, 2019 09:22
AWS Glue Python Shell -- pre-installed packages
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

Getting Started With Superset: Airbnb’s data exploration platform

These instructions are for Amazon Linux Version 2

Update Python and PIP versions on EC2 (Amazon AMI)

sudo yum update -y
sudo yum install python3 -y
@uhho
uhho / pandas_s3_streaming.py
Last active December 2, 2022 18:57
Streaming pandas DataFrame to/from S3 with on-the-fly processing and GZIP compression
def s3_to_pandas(client, bucket, key, header=None):
# get key using boto3 client
obj = client.get_object(Bucket=bucket, Key=key)
gz = gzip.GzipFile(fileobj=obj['Body'])
# load stream directly to DF
return pd.read_csv(gz, header=header, dtype=str)
def s3_to_pandas_with_processing(client, bucket, key, header=None):
@kirpit
kirpit / bash.py
Last active March 17, 2023 06:29
Enables to run subprocess commands in a different thread with TIMEOUT option!
#! /usr/bin/env python
import threading
import subprocess
import traceback
import shlex
class Command(object):
"""
Enables to run subprocess commands in a different thread with TIMEOUT option.
@bblanchon
bblanchon / settings.json
Created February 9, 2016 10:28
Sublime Text: Restore Quick Switch Project shortcut
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }
@g0t4
g0t4 / _README.md
Created November 30, 2016 03:46
Setting up a Docker Hub registry mirror on a Synology NAS

Instructions

  • Save the docker-compose.yml and config.yml in the same directory on one of your volumes on the NAS.
  • SSH in and use docker-compose up -d
  • Test the mirror with curl --head http://NAS-IP:55000
  • Start up docker daemons with the following option or put this in the daemon config file or copy into Docker for Mac/Windows settings. --registry-mirror=http://NAS-IP:55000
  • Pull an image and then check that it is cached in your mirror with curl http://NAS-IP:55000/v2/_catalog
    • or check that a large image isn't slow after the first pull :)

Notes

@veselosky
veselosky / s3gzip.py
Last active May 8, 2023 21:42
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@saurabhshri
saurabhshri / pip.md
Last active September 24, 2023 11:07
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

Why?

Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.

How?