Skip to content

Instantly share code, notes, and snippets.

@popstas
popstas / gptb.sh
Last active September 8, 2023 12:20
gptb
#!/bin/bash
# install:
# 1. save it to /usr/local/bin/gptb
# 2. make it executable: chmod +x /usr/local/bin/gptb
# 3. add environment OPENAI_API_KEY=sk-...
#
# usage: POSTFIX="on ubuntu" gptb what you need for from bash
set -eu
PREFIX="${PREFIX:-how to}"

Кеширование страницы на nginx на минуту

В nginx.conf:

proxy_cache_path /var/cache/nginx keys_zone=cache_pages:16m max_size=10g;

Создать /etc/nginx/snippets/proxy_cache_force.conf:

Пояснения для редакций

Все рубрикаторы стали тегами

Все поля, которые определяют тематику материала, теперь стали тегами. Теги при этом разделились на несколько типов.

Общий принцип разметки тегами: ставим в отдельные поля всё, для чего есть поля: рубрики, сюжеты, персоны, колумнисты, регионы, форматы.

Все поля тегов стали необязательными и с мультивыбором.

// ==UserScript==
// @name Planfix task list
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Send task list from planner to remote server
// @author popstas
// @match https://popstas.planfix.ru/?action=planner
// @match https://popstas.planfix.ru/planner/6138
// @match https://popstas.planfix.ru/planner
// @match https://popstas.planfix.ru/*
@popstas
popstas / gist:850a49f1ccab0fd609cea413e35b9ad3
Created April 19, 2021 08:03
userscript-yandex-metrika-screenshot.js
// ==UserScript==
// @name Yandex Metrika Screenshot
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Screenshot mode
// @author popstas
// @match https://metrika.yandex.ru/*
// @grant GM_addStyle
// ==/UserScript==
@popstas
popstas / winmove-desktop-4positions
Created January 16, 2021 16:37
Move window by `Ctrl+Alt+Shift+h/j/k/i/o/l/n`
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
LeftX := 0
LeftY := 0
RightX := 2560
RightY := -920
ResetWindowSize() {
WinGet activeWin, ID, A
posX := 0
@popstas
popstas / planfix-dark.css
Last active January 2, 2024 11:23
Тёмная тема для Планфикса
/*
стиль используется для личного ПФ
раскрашен нормально только планировщик
https://gist.github.com/popstas/6de4dee93916da01d92d188127c57911
*/
:root {
--bg: #121212;
--bg-hover:#333;
--card-bg: #1E1E1E;
@popstas
popstas / dashboard.json
Created January 4, 2021 16:02
site-audit-seo Grafana dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@popstas
popstas / planfix-task-list.php
Created April 23, 2020 14:04
Расширение отправляет задачи из 2 списков в планировщике Планфикса в json файл
<?php
$filename = 'planfix-tasks.json';
if($_POST['tasks']) {
file_put_contents($filename, $_POST['tasks']);
return;
}
$lists = json_decode(file_get_contents($filename));
foreach($lists as $listName => $data) {
'''Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
from __future__ import print_function
import os
# os.environ['CUDA_VISIBLE_DEVICES']='-1'