Skip to content

Instantly share code, notes, and snippets.

@queses
queses / docker-alpine-vznat.template.yaml
Last active December 31, 2023 15:25
LimaVM template: Docker + Alpine + vzNAT
# Install:
# brew install lima
#
# Install Docker CLI if it's not installed:
# brew install docker docker-compose docker-buildx docker-credential-helper
# ln -sfn /opt/homebrew/opt/docker-buildx/bin/docker-buildx ~/.docker/cli-plugins/docker-buildx
# ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
#
# Create the VM:
# limactl create --name=myvm docker-alpine-vznat.template.yaml
@queses
queses / not_found.go
Created March 19, 2023 16:38
Go 404 Handler
// CatchNotFound is used to apply specific handler for code 404; it receives two handlers:
// if the requested path is not handled by the first, the second is called
func CatchNotFound(foundHandler, notFoundHandler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
writer := &notFoundWriter{ResponseWriter: w}
foundHandler.ServeHTTP(writer, r)
if writer.isNotFound {
notFoundHandler.ServeHTTP(w, r)
}
@queses
queses / MyWslConfigsXfce.md
Created August 12, 2021 12:41
My WSL configs

/home/ratt/.config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xml

<?xml version="1.0" encoding="UTF-8"?>

<channel name="keyboard-layout" version="1.0">
  <property name="Default" type="empty">
    <property name="XkbDisable" type="bool" value="false"/>
    <property name="XkbLayout" type="string" value="us,ru"/>
    <property name="XkbVariant" type="string" value=","/>
    <property name="XkbOptions" type="empty">
@queses
queses / index.js
Created May 13, 2020 08:23
PlusAgent Remarketing Image With Agent
const htmlToImage = require('node-html-to-image')
const sharp = require('sharp')
const axios = require('axios')
const path = require('path')
const fs = require('fs')
const { promisify } = require('util')
const readFile = promisify(fs.readFile)
async function main() {
@queses
queses / meistertask-calculate-hours.js
Created May 5, 2020 11:14
Calculate worker hours in MeisterTask's CSV export file
const fs = require('fs')
const printHelp = () => {
console.log(
'Console tool to extract and sum worker hours from MeisterTask\'s CSV export file\n' +
'Usage: node meistertask-calculate-hours.js FILEPATH [WORKER NAME] [DATE FROM] [DATE TO]\n' +
'Example: node meistertask-calculate-hours.js /home/user/meister.csv Maxim 2020.04.01 2020.04.30'
)
}
@queses
queses / etc | systemd | system | enable-turbo-boost.service
Last active March 27, 2024 16:49
Linux No TurboBoost Fix. Doesn't work with enabled SecureBoot
[Unit]
Description=Enable Turbo Boost on Intel CPUs
[Service]
ExecStart=/bin/sh -c "/usr/sbin/modprobe msr && /root/turbo-boost.sh enable"
RemainAfterExit=yes
[Install]
WantedBy=sysinit.target
@queses
queses / README.md
Last active April 20, 2020 17:41
Стилизация Ubuntu 18.04 и выше под MacOS X

Источник: https://github.com/Jonchun/ubuntu2macOS

  1. Подготовка:
    • Установить Gnome Tweaks и Gnome Shell Extensions: sudo apt-get install -y gnome-tweaks gnome-shell-extensions
    • Активировать расширение User Themes в Gnome Tweaks
    • Опционально: установить расширение Dash To Dock: sudo apt-get install -y gnome-shell-extension-dashtodock и активировать его в Gnome Tweaks
  2. Установить шрифт San Francisco
    • Для установки нужно скачать репозиторий в виде архива и скопировать содержимое ./SFPro/OpenType в /usr/share/themes или ~/.local/share/themes
  3. Установить тему McOS-CTLina (GitHub; см. каталог McOS-CTLina-Gnome-1.3 или выше) и выбрать её как тему оформления окон в Gnome Tweaks
@queses
queses / dynamic.java
Last active March 22, 2018 14:45
Сниппеты Java
/**
* Работа с Generic и Class
* - универсальные классы, методы;
* - вызов неизвестных компилятору методов;
* - динамическая установка значений полей;
* В примере - объект Query, реализующий объектный "поиск" по "базе данных" (нет)
* Диаграмма классов возможной реаализации: https://user-images.githubusercontent.com/14962059/37777435-5f173254-2e09-11e8-87be-3ce42840db9f.png
**/
package qss;
@queses
queses / # Скрипты удаленного выполнения.md
Last active January 26, 2018 19:57
Скрипты для удаленного выполнения в оболочках (Bash, PowerShell и др.)

Скрипты удаленного выполнения

В гистах могут содержаться скрипты для удаленного выполнения в оболочках, таких как Bash и PowerShell.

Пример выполнения в PowerShell:

iex (new-object net.webclient).downloadstring('https://gist.github.com/queses/6546858/raw/script.ps1')

Пример выполнения в SH:

sh -c "$(curl -fsSL https://gist.github.com/queses/6546858/raw/script.sh)"
@queses
queses / phone-num.vue
Created May 27, 2017 00:11
An easy solution to solve phone number issue vith VueSSR
<template>
<a :href="`tel: ${this.fPhone}`">{{ fPhone }}</a>
</template>
<script>
export default {
props: {
phone: {
type: [String],
required: true