Skip to content

Instantly share code, notes, and snippets.

View catwhocode's full-sized avatar

Cat who code catwhocode

View GitHub Profile
<?php
namespace Dappa\AuthTests;
use Illuminate\Support\ServiceProvider;
/**
* Auth test service provider
*/
class AuthTestsServiceProvider extends ServiceProvider
@catwhocode
catwhocode / debounce_decorator.py
Created February 18, 2025 04:26
Debounce Decorator
import functools
from threading import Timer
# source:
# https://stackoverflow.com/questions/61476962/python-decorator-for-debouncing-including-function-arguments
def debounce(timeout: float):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
@catwhocode
catwhocode / WindowsService.py
Last active February 11, 2025 07:43 — forked from dishantrathi/README.md
Creating a Windows Service with Python
import servicemanager
import socket
import sys
import win32event
import win32service
import win32serviceutil
class TestService(win32serviceutil.ServiceFramework):
_svc_name_ = "TestService" #Service Name (exe)
_svc_display_name_ = "Test Service" #Service Name which will display in the Winfows Services Window
@catwhocode
catwhocode / Onedrive as a Windows Service.txt
Created February 6, 2025 13:17 — forked from f-steff/Onedrive as a Windows Service.txt
How to set up OneDrive.exe as a Windows Service, allowing synchronization without a user is logged in.
OneDrive.exe as a Windows Service
=================================
Flemming Steffensen, 2017, 2021
For our automatic build setup, we needed to fetch some files off a Sharepoint Library.
Sharepoint allows (if configured so) Lists and Libraries to be synchronized to a local folder by using the OneDrive application.
However, the OneDrive application is started when a user logs in, and in an automated build setup, this never happens.
The solusion were to disable the normal auto-start feature of OneDrive, and then install it as a service, and making sure the
service start as the computer starts.
# Install package first:
# pip install PyMuPDF Pillow
import fitz
import io
from PIL import Image
file = "source.pdf"
pdf_file = fitz.open(file)
// source:
// https://github.com/verssache/qris-dinamis/blob/main/qris.php
// 00020101021126570011ID.DANA.WWW011893600915302259148102090225914810303UMI51440014ID.CO.QRIS.WWW0215ID10200176114730303UMI5204581253033605802ID5922Warung Sayur Bu Sugeng6010Kab. Demak610559567630458C7
echo "[+] QRIS Statis to Dinamis Converter - By: GidhanB.A\n";
echo "[+] Input Data QRIS: ";
$qris = trim(fgets(STDIN));
echo "[+] Input Nominal: ";
$qty = trim(fgets(STDIN));
@catwhocode
catwhocode / codeiginter-server-config.md
Created October 7, 2024 02:13 — forked from yidas/codeiginter-server-config.md
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

Note

  • If your users come from many timezones, consider keep using UTC, leave the timezone configuration on the user side. Use this package for timezone conversion.
  • If you're using Laravel 11, you can use .env instead.

Open File App\Providers\AppServiceProvider

Change method boot

use Carbon\Carbon;
@catwhocode
catwhocode / verify_hmac.php
Created July 29, 2024 03:13 — forked from turret-io/verify_hmac.php
Verify HMAC in PHP
<?php
define("SHARED_SECRET", "sup3rs3cr3t!!");
if(!function_exists('hash_equals')) {
function hash_equals($str1, $str2) {
// Run constant-time comparison for PHP < 5.6 which doesn't support hmac_equals
$str1_len = strlen($str1);
$str2_len = strlen($str2);
@catwhocode
catwhocode / BriController.php
Last active October 28, 2024 02:11
Laravel - BRI API
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Carbon;
use GuzzleHttp\Psr7;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;