Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hankchanocd's full-sized avatar
😈
Mobilize the world with AI

Hank Chan hankchanocd

😈
Mobilize the world with AI
View GitHub Profile
@hankchanocd
hankchanocd / cloudwatch-sns-lambda-slack-alert.py
Last active December 9, 2020 14:22
EC2 State Alerts through SNS/Lambda to Slack
'''
Follow these steps to configure the webhook in Slack:
1. Navigate to https://<your-team-domain>.slack.com/services/new
2. Search for and select "Incoming WebHooks".
3. Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration".
4. Copy the webhook URL from the setup instructions and use it in the next section.
@hankchanocd
hankchanocd / netlify-function-sends-slack-notifications.js
Last active April 8, 2024 19:22
Netlify Function Sends Slack Notifications
/*
Since late 2020, Netlify has put up a pay wall on its built-in Slack notifications for CI/CD.
This gist shows you a workaround using the still-free Netlify's deploy webhook that triggers a Netlify Function calling Slack Incoming Webhook.
Steps:
1. Deploy this Netlify Function
2. Have the corresponding link pasted into Netlify's deploy webhook, i.e. https://example.com/.netlify/functions/<your-function>
3. In next deploy, Netlify will trigger the deploy webhook, which in turn calls your Slack Incoming Webhook
*/
@hankchanocd
hankchanocd / aws_cloudfront_deploy.yml
Last active December 9, 2020 14:22
GH Actions to Deploy Jekyll Site to S3
name: Deploy Jekyll Site to S3
on: [push]
jobs:
run:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@hankchanocd
hankchanocd / index.js
Created March 26, 2020 06:44
Remove HTML Extension using Lambda@edge on S3
'use strict';
/* Public domain project by Cloud Under (https://cloudunder.io).
* Repository: https://github.com/CloudUnder/lambda-edge-nice-urls
*/
const config = {
suffix: '.html',
appendToDirs: 'index.html',
removeTrailingSlash: false,
Verifying my Blockstack ID is secured with the address 1D51kV6mLCuq9BdX6tvrJGGFLr4Pt7EdFR https://explorer.blockstack.org/address/1D51kV6mLCuq9BdX6tvrJGGFLr4Pt7EdFR
@hankchanocd
hankchanocd / alternative-footer.tpl
Last active July 20, 2018 05:24
Alternative Footer to replace the original footer ads on Weebly
@hankchanocd
hankchanocd / read-write-file.js
Created March 23, 2018 14:10
Read Write to file with javascript
/// write to file
var txtFile = "c:/test.txt";
var file = new File(txtFile);
var str = "My string of text";
file.open("w"); // open file with write access
file.writeln("First line of text");
file.writeln("Second line of text " + str);
file.write(str);
file.close();
<br><br>
<div align="center"> &copy; 2017 Weebly in 3 Min<br>
<a href="http://weeblyin3min.weebly.com" style="color: white;"> 首頁 &nbsp</a> |
<a href="http://weeblyin3min.weebly.com/about.html" style="color: white;">&nbsp 關於我們 &nbsp</a> |
<a href="http://weeblyin3min.weebly.com/hank-chans-blog" style="color: white;">&nbsp 攻略 &nbsp</a> |
<a href="http://weeblyin3min.weebly.com/slides.html" style="color: white;">&nbsp Slides &nbsp</a> |
</div>
/* 以下是已經被遮蓋掉的 Weebly original footer */
<div id="footer" style="display:none">{footer} </div>
@hankchanocd
hankchanocd / gist:c7cb185715aac113bcb9286af8c497a3
Last active June 21, 2017 20:23
#Weebly Footer Alternative
<div id="footer" style="display:none">{footer}</div>
style="visibility:hidden"
<div id="footer" style="visibility:hidden">{footer}</div>