Skip to content

Instantly share code, notes, and snippets.

View Mecanik's full-sized avatar
🎯
Focusing

Norbert Boros Mecanik

🎯
Focusing
View GitHub Profile
@Mecanik
Mecanik / qtoolbarext.hpp
Created July 16, 2022 05:28 — forked from mistic100/qtoolbarext.hpp
[Qt/C++] Custom QToolBar allowing to add a button/menu with text and icon
#ifndef QTOOLBAREXT_H
#define QTOOLBAREXT_H
#include <QToolBar>
#include <QMenu>
#include <QToolButton>
/**
* @brief Custom QToolBar allowing to add a button/menu with text and icon
@Mecanik
Mecanik / Windows - Block all traffic except certain IP's.md
Last active April 4, 2024 08:52
Windows - Block all traffic except certain IP's

Windows - Block all traffic except certain IP's

These methods have been aquired from several sources around the internet. Having them in one place should help you choose the right method in achieving this goal.

Method 1 (netsh)

The "deny" gets priority over the "allow" , so we cannot deny all IP address. We need to deny all IP address expect special IP address.

If the special IP address is 192.0.2.55, then you can try the below command:

@Mecanik
Mecanik / best-regex-for-youtube-vimeo-twitch-daily-motion.md
Last active January 3, 2022 07:00
BEST Regex for YouTube, Vimeo, Twitch, Daily Motion

BEST Regex for YouTube, Vimeo, Twitch, Daily Motion

I have been searching for regexes online to ensure that I allow only 2 type of URL's on my form (YouTube/Vimeo). However, everything I found was utter crap for my requirement.

Don't get me wrong, but in my opinion they are written so poorly and cannot cover "everything"... for example, "The correct Vimeo video id regex.": https://github.com/regexhq/vimeo-regex - it's nonsense. It cannot even cover player.vimeo.com not to mention anything else. Still, it is well indexed in Google and people find it on top results.

Before you use this regex, think about your requirements. This might not work for you in case you need/want to match the FULL URL (please, think about it... do you really need to match the FULL URL??).

So without further adue, here is what I think (and you should do):

@Mecanik
Mecanik / Build-CURL-with-Visual-Studio-2019-and-OpenSSL-3.0-Windows.md
Last active October 26, 2021 06:55
Build CURL with Visual Studio 2019 and OpenSSL 3.0 (Windows)

Build CURL with Visual Studio 2019 and OpenSSL 3.0 (Windows)

How to build libcurl is a very popular search term, and frankly there is so much banana "tutorials" that I`m sick of it.

CURL is already configured on windows to search for openssl folder in the following order:

  • curl folder
  • openssl folder

However this means you would need to build openssl yourself and match what CURL is looking for. If you look into Additional Include directories inside the visual studio project you will see:

@Mecanik
Mecanik / Utils.ts
Last active March 26, 2024 16:10
Send or Delete bulk data to Cloudflare Workers KV (TypeScript)
export default class Utils {
/**
* Delete items in bulk from Cloudflare KV Storage
* This assumes you have defined your ENV_ variables using wrangler secrets
* @param {namespace} The namespace binding you defined for your script
*/
static async deleteInBulk(namespace): Promise<Boolean> {
const delete_endpoint =
"https://api.cloudflare.com/client/v4/accounts/" +
EN_ACC_ID +
@Mecanik
Mecanik / gist:d2314fbc860b9c68eac4b101127b738e
Created November 4, 2019 11:58
Install and configure PHP 7.3 ev/event PECL extension on Ubuntu Linux 18.04.3
# For phpize
apt install php7.3-dev
# Install extensions
pecl install ev
pecl install event
# Create configurations
sudo echo 'extension=ev.so' > /etc/php/7.3/mods-available/ev.ini
sudo echo 'extension=event.so' > /etc/php/7.3/mods-available/event.ini
@Mecanik
Mecanik / PHP EV,EVENT, LIBEVENT - Ubuntu 17.10.txt
Created October 1, 2018 16:21
Install PHP EV, EVENT, LIBEVENT on Ubuntu 17.10 for PHP 7.1 (FPM, CLI)
Please use with caution, if you do not understand what these extensions are for, then document yourself first.
PHP LIBEVENT
WARNING: CAUSES SEGEMENTATION FAULT ON PHP 7.0 !
------------------------------------------
cd /usr/src/
git clone https://github.com/expressif/pecl-event-libevent.git
cd pecl-event-libevent
phpize
./configure