Skip to content

Instantly share code, notes, and snippets.

View Rene-Roscher's full-sized avatar

René R. Rene-Roscher

View GitHub Profile
@Rene-Roscher
Rene-Roscher / README.md
Last active October 19, 2024 07:33
Flameshot custom uploader*

Download File and move it to /usr/local/bin/screen-capture

➜ ~ cat ~/.config/flameshot/flameshot.ini

[General]
autoCloseIdleDaemon=true
buttons=@Variant(\0\0\0\x7f\0\0\0\vQList<int>\0\0\0\0\b\0\0\0\0\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x12\0\0\0\b\0\0\0\v\0\0\0\r)
checkForUpdates=true
contrastOpacity=188
@Rene-Roscher
Rene-Roscher / snowflake.js
Created February 19, 2024 01:12
Snowflake IDs in Javascript (For 53bit)
// 53 bits unique id: 41 bits for time in milliseconds + 12 bits for sequence number
class Snowflake {
constructor(options) {
options = options || {};
this.seq = 0;
this.offset = options.offset || 0; // 2019-04-01T00:00:00Z
this.lastTime = 0;
}
generate() {
@Rene-Roscher
Rene-Roscher / ci-image-producer.sh
Last active July 13, 2025 18:01
Proxmox Cloud-Init / Image Pre-Configurator
#!/bin/bash
# Farbdefinitionen
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
WHITE='\033[1;37m'
NC='\033[0m' # Keine Farbe
@Rene-Roscher
Rene-Roscher / collect-translations.php
Created July 30, 2023 02:29
Extract and collect translation keys from various files in a Laravel project. The purpose of this script is to identify strings that are wrapped in translation functions or language helpers like this.__(), __() or trans() within JavaScript, PHP, and Vue files, and then save those keys into a JSON file for further processing or translation manage…
<?php
$vueDirectory = './resources/js';
$backendDirectory = './app';
$vendorDirectory = './vendor';
$pattern = '/(?<!\\\\)(?:this\.__|__|trans)\(\s*(["\'])((?:\\\\.|(?!\1).)*)\1/s';
$translations = [];
$jsonFile = 'translations.json';
function collectKeys($directory, $pattern, &$translations): void
@Rene-Roscher
Rene-Roscher / AppServiceProvider.php
Created July 30, 2023 02:19
Laravel Cloudflare-Proxy
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\URL;
class CollectionPaginator
{
public function __construct(
protected Collection $collection,
@Rene-Roscher
Rene-Roscher / livck-db-dump.sh
Created June 28, 2023 12:35
bash livck-db-dump.sh
#!/bin/bash
# Name of the database service defined in the docker-compose.yml
DB_SERVICE="database"
# Destination directory for the MySQL dump file
EXPORT_DIR="/opt/livck"
# Name of the database to export
DATABASE_NAME="livck-cp"
@Rene-Roscher
Rene-Roscher / livck-db-restore.sh
Created June 28, 2023 12:34
bash livck-db-restore.sh
#!/bin/bash
# Name of the database service defined in the docker-compose.yml
DB_SERVICE="database"
# Path to the SQL dump file for database restoration
DUMP_FILE="/opt/livck/db_dump.sql"
# Name of the database to import
DATABASE_NAME="livck-cp"
@Rene-Roscher
Rene-Roscher / map.php
Created June 12, 2023 00:34
Laravel / Lang Fetch (For a structured lang folder / json)
<?php
$dir = 'resources/lang';
$exportFileName = 'export-en';
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
$files = array();
foreach ($iterator as $file) {
if ($file->isFile() && in_array($file->getExtension(), ['json', 'php'])) {
if ($file->getFilename() !== $exportFileName . '.json') {
$files[] = $file->getPathname();
@Rene-Roscher
Rene-Roscher / Rsacc.php
Created May 29, 2023 00:38
Accounting Helper Class (connectivity sales & accounting)
<?php
namespace RServices\Helpers;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Ramsey\Uuid\Uuid;