Skip to content

Instantly share code, notes, and snippets.

View absyah's full-sized avatar

Ardian Bahtiarsyah absyah

  • Semarang, Indonesia
View GitHub Profile
@absyah
absyah / body.py
Last active November 21, 2024 07:38
PnP Event Emitter
import copy
payload = [
{
"destination": "destination1",
"events": [
{
"type": "delivery",
"delivery": {
"data": "001f277462529930889fab80ecffdc088390"
@absyah
absyah / body.json
Last active November 11, 2024 07:44
[
{
"destination": "destination1",
"events": [
{
"type": "delivery",
"delivery": {
"data": "001f277462529930889fab80ecffdc088390phoneNumber"
},
"webhookEventId": "",
@absyah
absyah / Iteration approach
Created November 7, 2024 14:20
Backoff mechanism in Python
import time
from botocore.exceptions import ClientError
from typing import Callable, List, Any, Dict
# backoff intervals for retry
BACKOFF_INTERVALS = [30, 60, 180] # in seconds: 30s, 1min, 3min
# retryable DynamoDB error codes
RETRIABLE_DYNAMODB_ERRORS = [
'InternalServerError',
curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
"to": "",
"messages":[
{
"type": "text",
"text": "Hello, world1"
}
@absyah
absyah / daily-payload.json
Last active February 7, 2024 13:48
Shift Generator Payloads
{
"required_members": 9,
"classes": [
{
"id": 1,
"name": "A",
"required_members": {
"morning": 2,
"naptime": 2,
"other": 2
@absyah
absyah / gist:b17cf5cb87db36195f3478eab5eb7de0
Created October 17, 2023 15:34
[DELETE ME] HLS debug
[log] >
instrument.js:109 [log] > stopLoad
instrument.js:109 [log] > loadSource:https://stream.mux.com/m2x0101omwAeb02XfOkLbpVD4rXgwv5wwrrzEfXLd5ZDlA.m3u8?max_resolution=1080p
instrument.js:109 [log] > [stream-controller]: Trigger BUFFER_RESET
instrument.js:109 [log] > attachMedia
instrument.js:109 [log] > [buffer-controller]: Media source opened
instrument.js:109 [log] > [subtitle-stream-controller]: STOPPED->IDLE
instrument.js:109 [Fast Refresh] rebuilding
instrument.js:109 [Fast Refresh] done in 228ms
instrument.js:109 [log] > [level-controller]: manifest loaded, 5 level(s) found, first bitrate: 2564100
{
"textPayload": "checkViews [{\"id\":\"0YCzsPvYG0gdOEe8xfGn\",\"ref\":{\"_firestore\":{\"projectId\":\"vidbase-ee21b\"},\"_path\":{\"segments\":[\"workspaces\",\"MWsnEB09rbWJ97fUUM7M\",\"embeds\",\"alrzekAMId1VXOL6rpRP\",\"views\",\"0YCzsPvYG0gdOEe8xfGn\"],\"projectId\":\"vidbase-ee21b\",\"databaseId\":\"(default)\"},\"_converter\":{}},\"uid\":\"d8UZhrc570Q7FDjUMeaw4m22ZJj2\",\"referrer\":\"https://lp.sakura.ad.jp/\",\"marketoLeadId\":\"37963412\",\"isMarketoLeadSyncToSalesforce\":false,\"contentId\":\"8FmJMCDR63oiZZLg6cXZ\",\"type\":\"embed\",\"embedId\":\"alrzekAMId1VXOL6rpRP\",\"munchkinAccountId\":\"941-NEO-212\",\"workspaceId\":\"MWsnEB09rbWJ97fUUM7M\",\"createdAt\":{\"_seconds\":1683694898,\"_nanoseconds\":385000000},\"viewSeconds\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],\"totalViewTime\":36,\"updatedAt\":{\"_seconds\":1683704013,\"_nanoseconds\":121000000},\"actionButtonShowCounts\":0,\"actionClickCounts\":0,\"formShowCounts\":0,\"formSubmittedCounts\":0},{\"id\
@absyah
absyah / summary.md
Created August 4, 2023 02:16 — forked from angelialau/summary.md
(Summary) The Art of Readable Code

A summary of The Art of Readable Code by Dustin Boswell and Trevor Foucher

  • Overall metric for readability: code should be written to minimise the time it would take someone else to fully understand it (able to modify the code and spot bugs) Ways to improve readability (ranked from easiest change to most time intensive)
  1. Naming of variables and functions:
    • Use specific, descriptive, succinct names that say the entity's value or purpose
    • Use concrete names instead of abstract names e.g. canListenOnPort > serverCanStart
    • Add important attributes e.g. units or state e.g. unsafeUrl, safeUrl > url
    • Can use shorter variable names for smaller scope
require: rubocop-rails
Style/StringLiterals:
Enabled: false
AllCops:
NewCops: enable
TargetRubyVersion: 3.0
Exclude:
- 'db/**/*'
@absyah
absyah / gist:2bbb7e253e72d211c4f736dd72eb2202
Created May 2, 2023 14:46
RVM install with openssl dir
rvm install x.x.x --with-openssl-dir=$HOME/.rvm/usr