Skip to content

Instantly share code, notes, and snippets.

View fazlurr's full-sized avatar

Fazlur Rahman fazlurr

View GitHub Profile
@fazlurr
fazlurr / setup.md
Created February 4, 2026 04:19 — forked from dabit3/setup.md
How to set up OpenClaw on Digital Ocean

OpenClaw on DigitalOcean

1. Create a Droplet

Ubuntu 24.04 LTS, nearest region

2. Select Premium AMD

2 GB RAM / 1 AMD CPU / 50 GB NVMe

3. SSH into server

@fazlurr
fazlurr / ghcr.md
Created June 12, 2025 13:35 — forked from yokawasa/ghcr.md
ghcr (GitHub Container Registry)

ghcr (GitHub Container Registry) quickstart

CLI

To push container images to ghcr, you need peronal access token (PAT) - see how to create PAT

  1. Get PAT (personal access token)

Personal Settings > Developer settings > Personal access tokens

import boto3
import json
import os
SOURCE_PROFILE = 'source-account'
DEST_PROFILE = 'dest-account'
REGION = 'us-east-1'
EXPORT_DIR = 'sqs_export'
os.makedirs(EXPORT_DIR, exist_ok=True)
grep '\[10/Jun/2025:01:' access.log.1 | grep -v 'POST /email/send'
grep '\[10/Jun/2025:03:' /var/log/nginx/access.log.1 | grep -v 'POST /email/send' | grep -v 'https://app.orderonline.id' > logs-09.txt
@fazlurr
fazlurr / kill-slow-ops.js
Created January 27, 2025 08:48
MongoDB - Kill Slow Operations
var killLongRunningOps = function (table = 'submission', maxSecsRunning = 5000, kill = false) {
var ns = 'orderonline_db.' + table;
if (table === '*') {
ns = /^orderonline_db\./;
}
var currOp = db.currentOp({"active" : true,"secs_running" : { "$gt" : maxSecsRunning },"ns" : ns});
var operations = currOp.inprog;
for (var i = 0; i < operations.length; i++) {
var operation = operations[i];
print(i + ". Operation: " + operation.opid);
@fazlurr
fazlurr / precommit.sh
Created January 9, 2025 16:08
Precommit Lint Staged File
#!/bin/bash
clear
fileList=$(git diff --diff-filter=d --cached --name-only | grep -E '\.(js|vue)$')
if [ ${#fileList} -lt 1 ]; then
echo -e "You have no staged .js or .vue files to test\n"
exit
fi
npx eslint ${fileList[*]} "$@"
if [ $? -ne 0 ]; then
echo -e "\nPlease fix the above linting issues before committing.\n"
@fazlurr
fazlurr / read-excel.php
Created September 30, 2022 07:23
Read Excel in PHP
<?php
use Shuchkin\SimpleXLSX;
...
$file = $request->file('file');
$file_path = $file->getRealPath();
if ( $xlsx = SimpleXLSX::parse($file_path) ) {
$rows = $xlsx->rows();
// Degrees to Radians
export const degsToRads = deg => (deg * Math.PI) / 180.0;
// Radians to Degrees
export const radsToDegs = rad => rad * 180 / Math.PI;
// Round like PHP Function
export const round = (num, dec) => {
var num_sign = num >= 0 ? 1 : -1;
return parseFloat((Math.round((num * Math.pow(10, dec)) + (num_sign * 0.0001)) / Math.pow(10, dec)).toFixed(dec));
@fazlurr
fazlurr / API Contract Example Spec.md
Created June 7, 2022 03:13 — forked from BeattieM/API Contract Example Spec.md
An example of an API contract between the server and front-end devices

#Users

  • User object
{
  id: integer
  username: string
  email: string
  created_at: datetime(iso 8601)
  updated_at: datetime(iso 8601)
}
@fazlurr
fazlurr / send-outbound-message.md
Created April 7, 2022 03:29
Documentation on how to send outbound message in Qiscus Multichannel via REST API

Send Outbound Message

Send individual message

Verb

POST https://multichannel.qiscus.com/api/v3/admin/broadcast/client