Skip to content

Instantly share code, notes, and snippets.

@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;
@catwhocode
catwhocode / guzzle-message-formatter.txt
Created July 9, 2024 05:09
Guzzle Message Formatter Supported Variable Substitution
/**
* source:
* https://github.com/guzzle/guzzle/blob/7.5/src/MessageFormatter.php#L12
*
* Formats log messages using variable substitutions for requests, responses,
* and other transactional data.
*
* The following variable substitutions are supported:
*
* - {request}: Full HTTP request message
@catwhocode
catwhocode / htaccess-flags.txt
Created July 9, 2024 02:10
.htaccess Flag List
.htaccess flag list
C Chained with next rule
CO Cookie (set specified cookie
E var:value (set Environment variable var to value)
F Forbidden - sends a 403 header to the user
G Gone - no longer exists
H Handler (set handler)
L Last - stop processing rules
@catwhocode
catwhocode / php8.1-install.sh
Created July 9, 2024 02:09
My PHP Installation Configuration Template
./configure OPENSSL_CFLAGS=-I/opt/openssl/include/ OPENSSL_LIBS="-L/opt/openssl/lib64/ -lssl -lcrypto" \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
--with-config-file-path=/etc/php \
--sysconfdir=/etc/php.d \
--enable-mysqlnd \
--with-pdo-mysql \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql=/usr/bin/pg_config \
--enable-bcmath \
--enable-fpm \