Skip to content

Instantly share code, notes, and snippets.

View WEBzaytsev's full-sized avatar

WEBZaytsev WEBzaytsev

View GitHub Profile
import { transports, format, createLogger } from 'winston';
import { errorLogger } from 'express-winston';
const myFormat = format.printf(({ timestamp, level, message }) => {
return `${timestamp} [${level}]: ${message}`;
});
export const winstonErrorLogger = errorLogger({
transports: [
new transports.Console()
@WEBzaytsev
WEBzaytsev / init.sh
Last active September 30, 2024 18:25
Скрипт который установит git и docker. Добавит алиасы для удобного управления
#!/bin/bash
# # Функция для установки Git
# install_git() {
# echo "Обновление списка пакетов..."
# sudo apt-get update
# echo "Установка Git..."
# sudo apt-get install -y git
# echo "Git успешно установлен."
# }
import random
import json
import os
import sys
# Файл для хранения ранее использованных портов
PORTS_FILE = 'used_ports.json'
MIN_PORT = 10024
MAX_PORT = 60000
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Тетрис с бонусами</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
alias d='docker compose up -d'
alias ds='docker compose stop'
alias dd='docker compose down'
alias du='docker compose up'
alias dbu='docker compose up -d --build'
alias dr='docker compose stop && docker compose up -d --force-recreate'
alias dl='docker compose logs -f'
alias dc='docker compose'
alias de='docker exec -it'
alias dp='docker system prune'
@WEBzaytsev
WEBzaytsev / user.yaml
Created May 11, 2023 19:11
Config for automatic installation of Ubuntu, with root user only
#cloud-config
autoinstall:
version: 1
source:
id: ubuntu-server-minimal
search_drivers: false
user-data:
package_update: false
package_upgrade: false
timezone: Europe/Moscow
@WEBzaytsev
WEBzaytsev / permalink.php
Last active May 11, 2023 20:11
A plugin to change the structure of wordpress links. Makes links appear in the domain/blog/%blog_post% structure. The standard way it works is domain/%blog_post%.
#!/bin/bash
# This is for Ubuntu 22.04
# set -euo pipefail
########################
### SCRIPT VARIABLES ###
########################
### Be non-root user w/ sudo privileges.
<?php
/**
* Setup development environment by manipulating plugin activation
* Replace the dev URLs and plugin paths accordingly
*/
function mysite_development_environment_setup() {
// define the development sites
$dev_envs = array(
'http://localhost:8888',
@WEBzaytsev
WEBzaytsev / functions.php
Created February 4, 2023 17:56 — forked from hmowais/functions.php
Speed Optimization WordPress (Manually)
<?php
//defer css
function add_rel_preload($html, $handle, $href, $media) {
if (is_admin())
return $html;
$html = <<<EOT
<link defer="defer" rel='stylesheet' href='$href' media="print" onload="this.media='all'" id='$handle' crossorigin="anonymous"/>