Skip to content

Instantly share code, notes, and snippets.

View faitno's full-sized avatar

Alexey Ch faitno

View GitHub Profile
@bwente
bwente / SummaryAI.php
Created March 30, 2023 12:20
SummaryAI Plugin for MODX (uses OpenAi API)
<?php
$model = $modx->getOption('model', $scriptProperties);
$prompt = $modx->getOption('prompt', $scriptProperties);
$api_url = $modx->getOption('api_url', $scriptProperties);
$api_key = $modx->getOption('api_key', $scriptProperties);
switch($modx->event->name) {
case 'OnDocFormSave':
// Check if the resource has a summary
if (!$resource->get('introtext')) {
@tippexs
tippexs / README.md
Created March 31, 2021 15:33 — forked from lcrilly/README.md
Adding cookie security with NGINX and NGINX Plus

Cookie Security with NGINX and NGINX Plus

This is a complete demo of 2 different cookie security techniques:

  1. Cookie jar - NGINX Plus stores new cookies in the key-value store and issues the client an opaque reference to access them
  2. Signed cookies - NGINX creates signatures for all new cookies and validates that presented cookies match the signature

Requires NGINX Plus with JavaScript module (njs 0.5.1+)

@kolyanok
kolyanok / Установка bol-van zapret на OpenWrt.md
Created April 21, 2020 03:04
Установка bol-van/zapret на OpenWrt

1. Установите OpenWrt на ваш роутер.

Для каждой модели роутера процесс установки различается. Ищите инструкции для своей модели в Google.

2. Подключитесь к роутеру по SSH

Чтобы подключиться по SSH, на роутере должен быть установлен пароль. Его можно установить в веб-интерфейсе. Для Windows используйте программу PuTTY, в macOS/Linux достаточно открыть системное приложение Терминал и ввести там следующую команду:

ssh root@IP-адрес_роутера

IP адрес роутера в стандартной конфигурации — 192.168.1.1

@yurenchen000
yurenchen000 / opkg_install_pkg_ver.md
Last active February 20, 2023 20:05
opkg install specify package version
@jornane
jornane / about:config.txt
Last active November 19, 2024 06:32
Recommended Firefox about:config settings
# Recommended Firefox about:config settings
# Privacy
# https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections
extensions.blocklist.enabled;false
browser.safebrowsing.downloads.remote.enabled;false
browser.safebrowsing.malware.enabled;false
browser.safebrowsing.passwords.enabled;false
browser.safebrowsing.phishing.enabled;false
network.prefetch-next;false
@sul4bh
sul4bh / csvStringParse.php
Last active April 1, 2021 07:08
Parse a multiline csv string in php
<?php
$csvString = "ID,Condition,Condition,Condition,Condition,AdSize,Content:Text,Content:Text,Content:Text,Content:ImageUrl,Content:LandingPageUrl,Archive,Default
ID,Locations:Region,Device Properties:Device,Weather:Condition,Dmp:Liveramp,AdSize,title1,description1,price1,imageUrl1,landingPageUrl1,Archive,Default
ROW_001,\"Wa, Ca, Tn\",Mobile,Snow,12345,300x250,Hello Washingtonian,My Custom Description,10,http://domain/Snow.jpg,https://www.example.com,TRUE,
ROW_002,Wa,Mobile,Snow,12345,300x250,Hello Washingtonian,My Custom Description,10,http://domain/New_Snow.jpg,https://www.example.com,,
ROW_003,Wa,Mobile,,,300x250,Hello Washingtonian,My Custom Description,10,http://domain/clear.jpg,https://www.example.com,,
ROW_004,,,,,300x250,Hello,My Custom Description,20,http://domain/clear.jpg,https://www.example.com,,TRUE";
function csvToArray($csvString, $delimiter = ',', $lineBreak = "\n") {
@joaomlneto
joaomlneto / mac-client.sh
Last active July 13, 2023 06:29
Fast NFS volume on macOS
#!/usr/bin/env bash
# mount /home/joaomlneto @ linux-vm
mkdir -p /Users/joaomlneto/nfs/linux-vm
mount -t nfs -o nolocks,locallocks,rw,soft,intr,rsize=8192,wsize=8192,timeo=900,retrans=3,proto=tcp \
linux-vm:/home/joaomlneto \
/Users/joaomlneto/nfs/linux-vm
@rpanachi
rpanachi / how-to-fix-macos-mojave-battery-draining-issue.md
Last active April 20, 2023 13:31
How to Fix macOS Mojave Battery Draining Issue
@BKirev
BKirev / restart_mobile_connection.bat
Created November 16, 2018 21:43
Batch script for Huawei E3372H reboot
@echo off
set AUTH_URL="http://192.168.8.1/api/webserver/SesTokInfo"
curl %AUTH_URL% > temp.txt
set /p $RESPONSE = < temp.txt
for /f "tokens=2 delims=^<^>" %%a in (temp.txt) do (