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 / 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.
@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 / HandlePutFormData.php
Created May 17, 2024 07:14 — forked from Stunext/HandlePutFormData.php
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
@catwhocode
catwhocode / guzzle_req_res_middleware.php
Created May 7, 2024 10:08 — forked from appkr/guzzle_req_res_middleware.php
Guzzle RequestResponseLog Middleware Example
<?php
namespace App\Providers;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\Promise\PromiseInterface;
use Illuminate\Contracts\Foundation\Application;
@catwhocode
catwhocode / curl.php
Created March 15, 2024 00:43 — forked from surferxo3/curl.php
Script to demonstrate how to extract Header and Body from the Curl response in PHP.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// SETTINGS
ini_set('max_execution_time', 0);
@catwhocode
catwhocode / create-subdomain.php
Created September 23, 2023 01:28 — forked from iMaz1n/create-subdomain.php
Use API/Curl to create a new subdomain in both CloudFlare and cPanel
<?php
/**
* Create Subdomains
*
* Note: This script was designed to be called silently by a bash script for project creation.
* Add to bash script: php "$HOME/scripts/php/create-subdomains.php" "$new_account_subdomain"
*
* Requires "jamesryanbell/cloudflare": "^1.11" for the CloudFlare PHP library
* Recommends "kint-php/kint": "^3.2" for improved temporary PHP debugging