Skip to content

Instantly share code, notes, and snippets.

View vincentclaes's full-sized avatar
:octocat:

Vincent Claes vincentclaes

:octocat:
View GitHub Profile
@timesler
timesler / deploy_dolly_v2.ipynb
Created April 21, 2023 23:03
Deploy Dolly v2.0 to SageMaker
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@markymarkus
markymarkus / sf_paginate.yml
Last active June 18, 2024 18:37
Step Functions with paginate
---
Parameters:
pBucketName:
Type: String
Default: ''
Description: Input S3 Bucket
Resources:
StateMachine:
Type: AWS::StepFunctions::StateMachine
Properties:
@wongcyrus
wongcyrus / cloud9-code-server
Last active September 11, 2021 12:25
Install and run Visual Studio Code (Code-Server) in AWS Cloud9
ip=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
echo "Code Server"
echo "http://$ip:8443"
security_group=$(ec2-metadata -s | cut -d " " -f 2);
aws ec2 authorize-security-group-ingress --group-name $security_group --protocol tcp --port 8443 --cidr 0.0.0.0/0
version="1.32.0-310"
wget https://github.com/codercom/code-server/releases/download/$version/code-server-$version-linux-x64.tar.gz
tar -xvzf code-server-$version-linux-x64.tar.gz
cd code-server-$version-linux-x64
chmod +x code-server
@ivankeller
ivankeller / dataframe_constructor.py
Last active May 5, 2023 13:35
function that output the string required for constructing a given Pandas dataframe (useful on tests)
def dataframe_constructor(df):
return "df = pd.DataFrame(%s)" % (str(df.to_dict()).replace("nan"," float('nan')").replace('array', 'np.array'))
@fedme
fedme / Run Visual Studio Code for Linux from WSL.md
Last active November 8, 2023 09:33
Run Visual Studio Code for Linux from WSL on Windows 10

Run Visual Studio Code for Linux from WSL

Thanks a lot to mredbishop and others for their insturctions posted here. This is just a recap of what they figured out.

This process was tested on WSL Ubuntu 18.04.

Install VcXsrv on Windows

  1. Dowload the VcXsrv installer from https://sourceforge.net/projects/vcxsrv/
  2. Install the software on Windows

Add VS Code repositories

@sysboss
sysboss / query_athena.py
Created May 21, 2018 15:41
SQL Query Amazon Athena using Python
#!/usr/bin/env python3
#
# Query AWS Athena using SQL
# Copyright (c) Alexey Baikov <sysboss[at]mail.ru>
#
# This snippet is a basic example to query Athen and load the results
# to a variable.
#
# Requirements:
# > pip3 install boto3 botocore retrying
@schledererj
schledererj / fetchall_athena.py
Created February 19, 2018 19:09
Using boto3 and paginators to query an AWS Athena table and return the results as a list of tuples as specified by .fetchall in PEP 249
# Does NOT implement the PEP 249 spec, but the return type is suggested by the .fetchall function as specified here: https://www.python.org/dev/peps/pep-0249/#fetchall
import time
import boto3
# query_string: a SQL-like query that Athena will execute
# client: an Athena client created with boto3
def fetchall_athena(query_string, client):
query_id = client.start_query_execution(
QueryString=query_string,
@dboyd13
dboyd13 / aws-developer-associate-study-notes.txt
Last active February 20, 2022 06:19
aws-developer-associate-study-notes
___ _____ ___ _ _ __ _ _ ___ _ _ _ _
/_\ \ / / __| ___ / __|___ _ _| |_(_)/ _(_)___ __| | | \ _____ _____| |___ _ __ ___ _ _ /_\ ______ ___ __(_)__ _| |_ ___
/ _ \ \/\/ /\__ \ |___| | (__/ -_) '_| _| | _| / -_) _` | | |) / -_) V / -_) / _ \ '_ \/ -_) '_| / _ \ (_-<_-</ _ \/ _| / _` | _/ -_)
/_/ \_\_/\_/ |___/ \___\___|_| \__|_|_| |_\___\__,_| |___/\___|\_/\___|_\___/ .__/\___|_| /_/ \_\/__/__/\___/\__|_\__,_|\__\___|
|_|
Notes taken in Jan-2018, from acloud.guru and AWS FAQs.
There is a lot of overlap in knowledge areas between Solution Architect Associate, and the Certified Developer Associate.
Hence this doc only covers the deltas for the CDA exam.
# N-CryptoAsset Portfolios: Identifying Highly Correlated
# Cryptocurrencies using PCA
#
# (c) 2017 QuantAtRisk.com, by Pawel Lachowicz
import numpy as np
import pandas as pd
from scipy import stats
from matplotlib import pyplot as plt
@yassineAlouini
yassineAlouini / compare_dfs.py
Created July 4, 2017 13:50
Compare two Pandas DataFrames
import pandas as pd
def compare_two_dfs(input_df_1, input_df_2):
df_1, df_2 = input_df_1.copy(), input_df_2.copy()
ne_stacked = (df_1 != df_2).stack()
changed = ne_stacked[ne_stacked]
changed.index.names = ['id', 'col']
difference_locations = np.where(df_1 != df_2)
changed_from = df_1.values[difference_locations]