Skip to content

Instantly share code, notes, and snippets.

View teer823's full-sized avatar

Riteru teer823

View GitHub Profile
@teer823
teer823 / index.py
Last active April 3, 2024 09:42
Copy OBS object from daily to weekly or monthly folder
# -*- coding:utf-8 -*-
import json
import os
from urllib.parse import unquote
from datetime import datetime, timezone, timedelta
from obs import ObsClient, Object, DeleteObjectsRequest
def delete_object(obsClient, bucket_name, object_key):
print('deleting source in daily folder')
print('bucket = ', bucket_name)
@teer823
teer823 / index.html
Created March 28, 2022 07:18
Simple HTML with Vanilla Javascript show hostname
<html>
<head>
<title>Test</title>
</head>
<body>
<span> Hostname : </span><span id="hostname">Hostname</span>
</body>
<script>
item = document.getElementById('hostname');
item.innerText = window.location.hostname
@teer823
teer823 / woocommerce-webhook-order-update.js
Last active September 10, 2021 15:17
WooCommerce Webhook Template - For Lambda
const crypto = require('crypto');
function validateRequest (event) {
// GET Secret from Environment Variable
const { WC_SECRET } = process.env;
// Get Header with Hash to validate from header (event.header)
const wc_hmac_hash = event.headers ?
event.headers['X-WC-Webhook-Signature'] || event.headers['x-wc-webhook-signature']
: "";
@teer823
teer823 / woocommerce-order-update-event-sample-labmda.json
Created September 10, 2021 08:47
WooCommerce Webhook Event Order updated to 'completed' - For Lambda Test Event with secret "woocommerce"
{
"headers": {
"X-WC-Webhook-Signature": "errtu1XQr0dm48Yz3ufiVvCgrcu2kin+H7WYQQ8Y0fE="
},
"body": "{\"status\":\"completed\",\"billing\":{\"first_name\":\"Jamy\",\"last_name\":\"\",\"company\":\"\",\"address_1\":\"\",\"address_2\":\"\",\"city\":\"\",\"state\":\"\",\"postcode\":\"\",\"country\":\"\",\"email\":\"jamy@example.com\",\"phone\":\"0888889999\"},\"customer_note\":\"\",\"line_items\":[{\"id\":90,\"name\":\"่Item-1 Sample Produc\",\"product_id\":23,\"variation_id\":0,\"quantity\":1,\"tax_class\":\"\",\"subtotal\":\"200.00\",\"subtotal_tax\":\"0.00\",\"total\":\"200.00\",\"total_tax\":\"0.00\",\"taxes\":[],\"meta_data\":[],\"sku\":\"\",\"price\":200,\"parent_name\":null}]}"
}
@teer823
teer823 / woocommerce-webhook
Created September 7, 2021 14:24
Webhook data from Woocommerce Order
{
id: 1,
parent_id: 0,
status: 'completed',
currency: 'USD',
version: '5.6.0',
prices_include_tax: false,
date_created: '2021-08-25T14:58:07',
date_modified: '2021-08-25T15:00:13',
discount_total: '0.00',
@teer823
teer823 / update-window-timezone.config
Created June 12, 2020 00:38
EBExtension for Update Windows Config
###################################################################################################
#### This configuration file runs a PowerShell script that modifies the Windows timezone
####
#### Original Author: @kylegalbraith
#### https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/configuration-files/community-provided/instance-configuration/enable-windowsupdate-dotnet.config
#### Modifier: @teer823
###################################################################################################
files:
"c:/temp/configureTimezone.ps1":