Skip to content

Instantly share code, notes, and snippets.

@mirkhamidov
mirkhamidov / enumMethods.groovy
Last active Feb 20, 2022
PhpStorm. LiveTemlate. Generate comments for ENUM
View enumMethods.groovy
File inputFile = new File(_1);LineNumberReader reader = inputFile.newReader();
def outputLine = '';
while ((line = reader.readLine()) != null) {
def cleanLine = line.trim();
def m = cleanLine =~ /private const\\\s(.*)\\\s=/;
if (m.size() > 0) {
outputLine = outputLine + ' * @method static ' + _2 + ' ' + m[0][1] + '''()\n''';
};
};
return outputLine + '';
@mirkhamidov
mirkhamidov / fn.getTopLevelDomain.sql
Created Apr 15, 2021
Parse Top Level Domain from URL
View fn.getTopLevelDomain.sql
DROP FUNCTION IF EXISTS getTopLevelDomain;
DELIMITER ##
CREATE FUNCTION getTopLevelDomain (strURL varchar(1000), level tinyint)
RETURNS varchar(1000)
BEGIN
IF ISNULL(level) THEN
SET level = 2;
END IF;
IF POSITION('http://' IN strURL) > 0 OR POSITION('https://' IN strURL) > 0
THEN
@mirkhamidov
mirkhamidov / README-setup-tunnel-as-systemd-service.md
Created May 22, 2018 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@mirkhamidov
mirkhamidov / loading.svg
Last active May 10, 2018
SVG snake loadign
View loading.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.