Skip to content

Instantly share code, notes, and snippets.

View floriankapaun's full-sized avatar
👋

floriankapaun

👋
View GitHub Profile
@floriankapaun
floriankapaun / README.md
Created December 12, 2023 12:39
Switch CTRL-L with ALT-L Key on Windows

Open up your Command Line, cd to the directory you want to create the file in and run the following commands:

set fileName="switch_keys.reg"

echo Windows Registry Editor Version 5.00 > %fileName%
echo[ >> %fileName%
echo [C:\SYSTEM\CurrentControlSet\Control\Keyboard Layout] >> %fileName%
echo "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,38,00,1d,00,1d,00,38,00,00,00,00,00 >> %fileName%
@floriankapaun
floriankapaun / README.md
Created May 26, 2023 06:10
Archive Git Branch
# Create a tag for the branch that you want to archive.
# This allows to restore the branch later.
git tag archive/<branchname> <branchname>

# Push the newly created tag.
git push --tags

# Delete the branch
git branch -D 
@floriankapaun
floriankapaun / XlsxResponse.php
Last active October 26, 2022 13:04 — forked from ZhukV/ExcelFileResponse.php
.xlsx file response to download Excel file generated by PHPSpreadsheet (Symfony HttpFoundation)
<?php
declare(strict_types=1);
namespace App\HttpFoundation;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Symfony\Component\HttpFoundation\Response;
/**

Send Twilio webhook events to multiple destinations using Twilio Functions

Unfortunately, there is currently no way to configure multiple webhook endpoints with Twilio's Console.

As a workaround, we can use Twilio Functions (Pricing) to forward webhook events to multiple destinations.

Setup

Based on Twilio Docs: Receive an inbound SMS

@floriankapaun
floriankapaun / FetchEmailDetailsCommand.php
Last active September 6, 2021 09:24
Create, send and read E-Mails from Gmail API with Symfony (PHP)
<?php
namespace App\Command;
use App\Service\MailboxAdministrationService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@floriankapaun
floriankapaun / calculate_colorfulness.js
Created December 24, 2020 08:55
Calculate "colorfulness" of image in JavaScript
/**
* Returns the colorfulness (0-1) of an image.
*
* Example implementation: https://codepen.io/flo__/pen/GRjMaWJ
*
* 'img' is a 1d array containing rgba values for each pixel as retrieved by ctx.getImageData()
*/
const calculateColorfulness = (img) => {
const R_OFFSET = 0;
const G_OFFSET = 1;