Skip to content

Instantly share code, notes, and snippets.

View marinsagovac's full-sized avatar

Marin Sagovac marinsagovac

View GitHub Profile
{"text": "Here is my response ok","links":["link1"]}
@marinsagovac
marinsagovac / gist:df99321f23f255ef524973b5cc82388c
Created November 11, 2023 13:03 — forked from menht/gist:2698877
Install and Uninstall Android applications with PackageInstaller

In android source code can get

<activity android:name=".PackageInstallerActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:scheme="content" />
        <data android:scheme="file" />
@marinsagovac
marinsagovac / psl.php
Created May 6, 2021 06:01
psl fork in PHP from JS
<?php
// https://github.com/lupomontero/psl/blob/master/index.js
class Domain
{
protected ?string $input = null;
protected $tld = null;
protected $sld = null;
protected $domain = null;
npm install react-i18next i18next --save
npm install i18next-http-backend i18next-browser-languagedetector --save
Create i18nextConf.js in a root:
```
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
@marinsagovac
marinsagovac / React Redux forms validators
Created August 12, 2019 11:31
React Redux forms validators
const required = value => (value || typeof value === 'number' ? undefined : 'Required');
const maxLength = max => value =>
value && value.length > max ? `Must be ${max} characters or less` : undefined;
const maxLength15 = maxLength(15);
export const minLength = min => value =>
value && value.length < min ? `Must be ${min} characters or more` : undefined;
export const minLength2 = minLength(2);
const number = value =>
value && isNaN(Number(value)) ? 'Must be a number' : undefined;
const minValue = min => value =>
@marinsagovac
marinsagovac / Kayako Curl test
Created July 6, 2018 10:53
Kayako Curl test
$url = ''; // Change this
$apiKey = ''; // Change this
$secretKey = ''; // Change this
$salt = mt_rand();
$signature = base64_encode(hash_hmac('sha256', $salt, $secretKey, true));
$url = sprintf('%sindex.php?/News/NewsItem/ListAll/1&apikey=%s&salt=%s&signature=%s',
$url,
$apiKey,
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install redis-server
sudo apt-get install php-redis
# Cache
sudo nano /etc/redis/redis.conf
# add
maxmemory 128mb
maxmemory-policy allkeys-lru
@marinsagovac
marinsagovac / Git Revert Branch
Created April 26, 2018 11:29
Git Revert Branch
git branch -D smsme-431/Update_docs_in_swagger
git fetch origin smsme-431/Update_docs_in_swagger
git reset --hard FETCH_HEAD
git clean -df
@marinsagovac
marinsagovac / CouchDB
Created April 20, 2018 09:19
CouchDB
CouchDB
=======
sudo add-apt-repository ppa:jderose/couchdb-1.7.0
sudo apt-get update
sudo apt-get remove couchdb couchdb-bin couchdb-common -yf
sudo apt-get install couchdb -y
sudo ufw allow 5984
sudo ufw allow 6984
@marinsagovac
marinsagovac / ActiveMQ Docs + Symfony
Created March 28, 2018 14:52
ActiveMQ Docs + Symfony
ActiveMQ
********
# Github: https://github.com/stomp-php/stomp-php
composer require grimkirill/stomp
# Apache ActiveMNQ