Skip to content

Instantly share code, notes, and snippets.

View everyx's full-sized avatar

Gavin Luo everyx

View GitHub Profile
@areknawo
areknawo / LazyHydrate.vue
Created August 13, 2021 11:18
Vue 3 lazy hydration component
<script lang="ts">
import { defineComponent, onMounted, PropType, ref, watch } from "vue";
type VoidFunction = () => void;
const isBrowser = () => {
return typeof window === "object";
};
export default defineComponent({
props: {
@troyfontaine
troyfontaine / beg_redirect.map
Last active March 23, 2023 10:19
HAProxy Redirecting based on an HTTP Query or a Map with a fallback redirect based on host header
# This file contains only partial paths to match on
# This file should reside in the same directory as the haproxy.cfg simply due to the way it is configured in the sample snippet-but they can go anywhere in the /etc/haproxy directory
/my-partial- https://subdomain3.mydomain.com/my-new-full-path
@lilydjwg
lilydjwg / btrfs-autosnapshot
Last active April 30, 2024 14:19
btrfs-autosnapshot
#!/usr/bin/python3
import os
import datetime
import subprocess
import logging
import tempfile
import contextlib
import ctypes
from pathlib import Path
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 4, 2024 06:34
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@sirkonst
sirkonst / docker-prune.service
Created November 22, 2018 12:25
Remove unused docker resources with systemd (service and timer)
[Unit]
Description=Remove unused docker resources
Documentation=https://docs.docker.com/v17.09/engine/admin/pruning/
After=docker.service
[Service]
Type=oneshot
ExecStart=/usr/bin/docker system prune -f --filter "until=744h"
ExecStart=/usr/bin/docker volume prune -f
@karolyi
karolyi / backup-mariadb.sh
Last active April 19, 2023 12:14
Fast backup/restore mysql databases
#!/usr/bin/env bash
mariabackup --stream=xbstream --backup --user root|pigz >mariadb-backup.gz
@yougg
yougg / proxy.md
Last active April 7, 2024 04:02
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active May 1, 2024 22:04
crack activate Office on mac with license file
@cryzed
cryzed / fix-infinality.md
Last active April 30, 2024 22:01
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@artturik
artturik / translate.html
Created April 4, 2016 09:09
Forced Google Translate (also can be used as April Fools Day joke)
<!--
This code will translate page contents automatically (without user input)
Settings located at line 9, current script will translate english to estonian
-->
<style>#google_translate_element,.skiptranslate{display:none;}body{top:0!important;}</style>
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'et', autoDisplay: false}, 'google_translate_element');
var a = document.querySelector("#google_translate_element select");