Skip to content

Instantly share code, notes, and snippets.

View dansayo's full-sized avatar

Dan S. dansayo

View GitHub Profile
@dansayo
dansayo / Invoking various AWS Lambdas via CLI.md
Last active December 15, 2022 22:06
invoking AWS Lambda via AWS CLI for Cloud Alerts errors

AD0 - Account expires

aws lambda invoke --function-name p21-28-prod-ad0 --log-type Tail --region=ap-southeast-1 --profile misprod response.json

After execution, inspect the response.json outfile for success or failure execution.

AD1 - OneCG fields

aws lambda invoke --function-name p21-28-prod-ad1 --log-type Tail --region=ap-southeast-1 --profile misprod response.json

Country holidays - GSheet

@dansayo
dansayo / howto.md
Last active December 3, 2020 21:57
API Gateway set up in Zappa

A Simpler Way to setup the API key in Zappa

Steps

  1. Prior to zappa deploy stage-name, specify these 2 attributes in the zappa_settings.json
    "api_key_required": true,
    "api_key": "some existing API KEY id to use",
@dansayo
dansayo / code.bas
Created November 8, 2019 07:58
Smartsheet formulas to get unique values
Use case on say 6 columns having email addresses, and you want to get only the unique values.
Copy-paste the formulas in column pairs [iterate, scrubbedapp]
iterate2 column formula:
=SUBSTITUTE([iterate1]2, "#" + [ScrubbedApp1]2, "")
ScrubbedApp2 column formula:
=IF(NOT(ISBLANK([iterate2]1)),
MID([iterate2]1, 2,
@dansayo
dansayo / readme.md
Last active October 30, 2019 19:34
Installing pyenv on MX Linux

Installing pyenv - on MX Linux 19

  1. Basic installation

Note: update the bashrc not bash_profile

  1. Other packages needed
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
@dansayo
dansayo / gdrive_service.py
Last active October 17, 2019 00:52
Setting up a subscriber to changes in a Google folder
# python 3.7.4
import os
import json
import datetime # for the expiration property: a date string to epoch millisec
import uuid # for the id property
from apiclient import discovery
from google.oauth2 import service_account
@dansayo
dansayo / gdrive_service.py
Created October 16, 2019 22:32
Setting up a subscriber to changes in a Google folder
# python 3.7.4
import json
import datetime # for the expiration property: a date string to epoch millisec
import uuid # for the id property
from apiclient import discovery
from google.oauth2 import service_account
try:
@dansayo
dansayo / Python Setup.md
Last active October 4, 2022 19:57
Setting up a new Python project folder, version, and virtual environment

Update:

overriding pyenv python versions, if you want to use a python version located on a different folder, i.e. /usr/local/bin/python3

on a new project, then:

mkdir <new_project>
cd <new_project>
<on new_project> mkdir venv
<on new_project> /usr/local/bin/python3 -m venv venv
@dansayo
dansayo / chapter2-1.js
Last active October 14, 2018 12:45
Javascript exercises answered from http://eloquentjavascript.net/index.html
// prints out a right triangle made out of hash tags
let output = "";
for (x = 1; x < 8; x = x + 1) {
output += "#";
console.log(output);
}
@dansayo
dansayo / export.py
Created April 17, 2018 22:17
Smartsheet export rows to another Smartsheet
import smartsheet
import os
import logging
import sys
import datetime
# Smartsheet API 2.0 reference (Python)
# https://smartsheet-platform.github.io/api-docs/index.html?python#api-reference
def get_cell_by_column_name(row, column_ame):