Skip to content

Instantly share code, notes, and snippets.

View kura1420's full-sized avatar
🎯
Focusing

Abdul Syakur kura1420

🎯
Focusing
View GitHub Profile
@kura1420
kura1420 / Recursive.sql
Created August 21, 2018 18:28
MariaDB Recursive
SELECT member_id
FROM
(SELECT * FROM member ORDER BY member_parent, member_id ASC) as a,
(SELECT @pv := 2) initialisation
WHERE find_in_set(member_parent, @pv) > 0 AND @pv := CONCAT(@pv, ',', member_id)
@kura1420
kura1420 / JqueryXHR.js
Last active August 28, 2024 04:17
File Upload With Javascript XHR
$(document).ready(function () {
const data = new FormData();
data.append("image", image.files.length ? image.files[0] : "");
data.append('_token', document.querySelector('meta[name="csrf-token"]').getAttribute('content'));
$.ajax({
type: "POST",
url: HOST_MODULE,
data,
dataType: "json",
@kura1420
kura1420 / SendPeriodEmail.php
Last active January 29, 2019 03:00
Controller with Codeigniter to send period email
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Send extends CI_Controller {
public function __construct()
{
parent::__construct();
// set library
@kura1420
kura1420 / MariaDB Dump.sh
Last active May 30, 2025 02:09
Script Dump Database Mysql with Shell
mysqldump -u username_database -p 'password_database' your_database | bzip2 -c > ~/directory/filename-$(date +%Y-%m-%d-%H.%M.%S).sql.bz2
@kura1420
kura1420 / CoordinateRule.php
Last active June 9, 2025 03:34
Laravel Rule Coordinate
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class CoordinateRule implements ValidationRule
{
/**
@kura1420
kura1420 / monitor_asterisk.sh
Created May 30, 2025 02:06
Monitoring Asterisk
#!/bin/bash
IP_SERVER="192.168.1.1"
TELEGRAM_BOT_TOKEN="123:abc"
TELEGRAM_CHAT_ID="-100"
TELEGRAM_TOPIC_ID="1419"
DOWN_PEERS=$(/usr/sbin/asterisk -rx "sip show peers" | grep -E "UNREACHABLE|UNKNOWN")
if [[ -n "$DOWN_PEERS" ]]; then
@kura1420
kura1420 / XenditService.php
Created June 9, 2025 03:08
Service Xendit hit API
<?php
namespace App\Services;
use App\Helpers\Formatter;
use App\Models\XenditPaymentlink;
use App\Models\XenditQrcode;
use App\Models\XenditRetail;
use App\Models\XenditVirtualaccount;
use Illuminate\Support\Facades\Http;
@kura1420
kura1420 / CustomerController.php
Created June 9, 2025 03:26
Laravel Datatables
<?php
class CustomerController extends Controller
{
//
public function index(Request $request)
{
$request->validate([
'period' => 'required|string|date_format:Y-m',
'status' => 'nullable|numeric',
@kura1420
kura1420 / WebhookController.php
Created June 9, 2025 03:29
Laravel Webhook Xendit
<?php
class WebhookController extends Controller
{
/**
* Paymentlink: https://developers.xendit.co/api-reference/#invoice-callback
* Virtual Account: https://developers.xendit.co/api-reference/#virtual-account-callback
* Retail: https://developers.xendit.co/api-reference/#fixed-payment-code-callback
* QRCode: https://developers.xendit.co/api-reference/id/#callback-pembayaran-qr
*/
@kura1420
kura1420 / Chunk.php
Created June 28, 2025 02:45
Laravel migrate data from same table but outher connection
<?php
namespace App\Console\Commands;
use App\Models\ActivityLog;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
class MigrateDataCommand extends Command