Skip to content

Instantly share code, notes, and snippets.

View ricardo-dlc's full-sized avatar
:shipit:
Working

Ricardo de la Cruz ricardo-dlc

:shipit:
Working
  • Cancún, México
  • 04:23 (UTC -05:00)
View GitHub Profile
@kamauwashington
kamauwashington / aws-cdk-with-dotenv-and-typescript.md
Last active June 21, 2025 03:00
Using AWS CDK with dotenv and TypeScript (--require module implementation)

Using AWS CDK with dotenv and TypeScript

Note, I prefer the node --require option of loading .env variables over importing or requiring in application code.

TLDR;

  • install dotenv as a development dependency
  • in the cdk.json in the root of the project directory add the following in bold :
    • { "app": "npx ts-node -r dotenv/config --prefer-ts-exts bin/<stack-name>.ts" }

When developing via AWS CDK it is easy to set environment variables on resources as they are being defined to be stored in AWS. However, in some repositories there is a need to set environment variables for the CDK Stack to use.

@mrizwan47
mrizwan47 / pandas_df_to_csv_in_chunks.py
Created January 26, 2023 11:30
Save Pandas dataframe to csv in chunks
import pandas as pd
df = pd.read_csv('large_file.csv')
n = 49000 # Max number of rows you want each chunk to have
chunks = [df[i:i+n].copy() for i in range(0,df.shape[0],n)]
k = 1
for chunk in chunks:
chunk.to_csv('data/chunk_{}.csv'.format(k), index=False)