Skip to content

Instantly share code, notes, and snippets.

@eghojansu
eghojansu / show.js
Created April 16, 2024 06:25
Function to confirm that given sequence no jump
// sap packplan delete purposes
let show = (size, min, max) => [[...Array(size)].map((_, i) => min + i).pop()].map(val => `${(val == max ? 'true' : 'false')} - ${val}`)
@eghojansu
eghojansu / arr.php
Created January 5, 2024 07:00
PHP Helpers
function arr($value, string $delimiter = null) {
return new class($value, $delimiter) implements IteratorAggregate {
/** @var iterable */
private $iterates;
/** @var array */
private $items;
/** @var iterable */
@eghojansu
eghojansu / anydesk-enable-remote-access.md
Created April 30, 2023 05:39 — forked from imami/anydesk-enable-remote-access.md
AnyDesk - How Enable Remote Access from ubuntu/debian terminal

###AnyDesk - How Enable Remote Access from ubuntu/debian terminal.

Note:

Here are the commands might be usefull in this purpose:

  • anydesk --get-status : To get current status of anydesk, which might be offlien,online or nothing.
  • anydesk --get-id : To get the ID that your system can be accessed by.
  • anydesk --service : To start anydesk service if not already running (for Linux).
  • anydesk --restart-service : To restart anydesk service
  • anydesk --stop-service : To stop anydesk service
@eghojansu
eghojansu / basic-auth-page.php
Created January 18, 2022 09:53
PHP Basic Auth Page
<?php
// require PHP8
$users = array(
'admin' => password_hash('admin123', PASSWORD_BCRYPT),
);
$username = $_SERVER['PHP_AUTH_USER'] ?? null;
$password = $_SERVER['PHP_AUTH_PW'] ?? null;
$hash = $users[$username] ?? null;
@eghojansu
eghojansu / FileServer.php
Created October 26, 2021 09:22
Symfony static file server
<?php
namespace App\Service;
use App\Utils;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@eghojansu
eghojansu / Fungsi Bilangan.vb
Created April 27, 2021 09:52
Crystal Report Custom [Basic Language] [No Recursive] Function, Terbilang Bahasa Indonesia
Function Bilangan (numb as Number) as String
Select Case numb
Case 0
Bilangan = "nol"
Case 1
Bilangan = "satu"
Case 2
Bilangan = "dua"
Case 3
Bilangan = "tiga"
@eghojansu
eghojansu / cleaner.bat
Created February 25, 2021 07:42
Directory Cleaner with Schedule to Delete after defined lifespan
@ECHO OFF
REM Cleaner.php runner
SET PHP_EXE="C:\XAMPP73\php\php.exe"
SET CLEANER=%~dp0cleaner.php
%PHP_EXE% %CLEANER% %*
@eghojansu
eghojansu / sample.sql
Last active September 14, 2017 10:32
Snippet for post Hierarki data dalam satu tabel
-- v2, mengubah nama tabel dan kolom ke bahasa inggris
-- dan re-struktur nama variabel di prosedur
-- dan menambahkan kolom depth (kedalaman), agar lebih mudah melihat kedalaman element tsb
-- tanpa harus melakukan group terhadap parent-nya, karena grouping membuat query sangat lama
-- untuk data yang lebih jumlahnya ribuan
-- Query#1
-- buat tabel kategori (hanya sample)
DROP TABLE IF EXISTS category;
@eghojansu
eghojansu / .gitignore
Created September 12, 2017 10:04
PHP Storm & Symfony gitignore
/.web-server-pid
/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
@eghojansu
eghojansu / buildme.sh
Last active November 13, 2017 13:27
Deploy shell snippet (Created for symfony) --- customize if needed
#!/bin/bash
# Zipping Git Directory
# Usage:
# __THIS_FILE__ [ project_name ] [ version ]
#
# project_name -- default to directory name
# version -- default to latest version
#
# Timer from (http://www.linuxjournal.com/content/use-date-command-measure-elapsed-time)
#