Skip to content

Instantly share code, notes, and snippets.

@zarv1k
zarv1k / darkidea.icls
Last active October 1, 2020 12:11
Intellij IDEA dark theme based on Darcula
<scheme name="darkidea" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2020-10-01T15:07:38</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2020.2.2.0.0</property>
<property name="modified">2020-10-01T15:08:05</property>
<property name="originalScheme">darkidea</property>
</metaInfo>
<colors>
<option name="CARET_ROW_COLOR" value="252b2e" />
@zarv1k
zarv1k / fGoogleIpRange.script
Last active August 16, 2023 14:43
Mikrotik: google ip-range JSON to address-list
:global fGoogleIpRange
if (!any $fGoogleIpRange) do={ :global fGoogleIpRange do={
:local addressList $1
:local ipRangeUrl $2
:local exceptionsJsonUrl $3
# load JSON parser - https://github.com/Winand/mikrotik-json-parser
/system script run JParseFunctions
# read file into JSONIn
@zarv1k
zarv1k / abstract-unique-validator.ts
Last active April 12, 2024 07:14
Unique Validator Example for NestJS
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
import { Connection, EntitySchema, FindConditions, ObjectType } from 'typeorm';
interface UniqueValidationArguments<E> extends ValidationArguments {
constraints: [
ObjectType<E> | EntitySchema<E> | string,
((validationArguments: ValidationArguments) => FindConditions<E>) | keyof E,
];
}
@zarv1k
zarv1k / replace-table-prefix-suffix.sql
Created February 6, 2016 09:20
Change prefix/suffix in MySQL tables
SET group_concat_max_len = 3072; -- increase for DB with many tables
SET @db = 'db_name';
SET @old_prefix = 'prefix_';
SET @old_suffix = '_suffix';
SET @new_prefix = '';
SET @new_suffix = '';
@zarv1k
zarv1k / myhours.com - unlimited trial
Last active September 23, 2019 13:49
How to use myhours.com free with unlimited time trial
myhours.com
angular app: https://eva.myhours.com/app/assets/myHours.com.js
zarv1k user info:
curl -X GET -H 'Accept: application/json, text/plain, */*, application/json' -H 'Content-Type: application/json;charset=utf-8' -H 'Authorization: Bearer d6020ac6-d84f-4c05-bc43-5ae290c27e00' "https://eva.myhours.com/api/users/30542"
response:
{"id":30542,"email":"zarv1k@gmail.com","password":null,"oldPassword":null,"name":"Dmitry Zarva","rate":0.0,"deleted":false,"admin":true,"accountOwner":true,"account":{"id":27707,"dateFormat":null,"timeFormat":null,"delimiters":0,"currency":null,"currencyPlacement":0,"subscriptionPlan":"","showCostRate":false,"subscriptionPlanDueDate":null,"countryCode":null,"company":null,"vatNumber":""},"createdDate":"2015-12-14T21:03:51.2698774+01:00","showNonTracked":false,"showAlternateTrackView":false,"showSubtotalActivity":false}