Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# Make by x:@BoxMrChen and windsurf ai
import asyncio
import base64
import json
import io
import os
import sys
import pyaudio
@purezhi
purezhi / docker-registry-mirrors.md
Created March 14, 2024 16:43 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 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+

#!/bin/bash
# Credentials
## inspired by: https://github.com/guttertec/lftp-sync/blob/master/sync.sh
## inspired by: http://www.torrent-invites.com/showthread.php?t=132965&s=a5f6146c4e37fbcce4529ecd93c1989e
## inspired by: http://sourceserver.info/wiki/tutorial/root/abgleich_ftp
## lftp manpage: http://lftp.yar.ru/lftp-man.html
# Check if sync.cfg can be found and no parameters are missing
if [ ! sync.cfg ]; then echo "sync.cfg could not be found."; exit; fi
@purezhi
purezhi / filter_horror_movie_on_vqq_index.user.js
Last active August 22, 2018 14:42
过滤腾讯视频首页的恐怖片
// ==UserScript==
// @name 过滤腾讯视频首页的恐怖片
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author @purezhi
// @match https://v.qq.com/
// @grant none
// ==/UserScript==
@purezhi
purezhi / README.md
Created April 11, 2018 06:34 — forked from tmilos/README.md
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

@purezhi
purezhi / get-browser-language.php
Created July 26, 2017 10:08 — forked from LucaRosaldi/get-browser-language-code.php
PHP: Detect Browser Language
<?php
/**
* Get browser language, given an array of avalaible languages.
*
* @param [array] $availableLanguages Avalaible languages for the site
* @param [string] $default Default language for the site
* @return [string] Language code/prefix
*/
function get_browser_language( $available = [], $default = 'en' ) {
if ( isset( $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ] ) ) {
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
@purezhi
purezhi / gist:4712dce262cf2405203a37e9bbfaf80e
Last active August 22, 2020 05:26 — forked from magigo/gist:187897cc8ef1f65f54f5
MySQL: 为查询结果自动编号
-- 1、为查询结果自动编号:
select
(@rowNO := @rowNo+1) AS rowno,
user_name
from (
select
wu.screen_name as user_name
from base_wb_ids_pr_hobbies mt
left join base_wb_user wu
on mt.uid = wu.id
@purezhi
purezhi / gist:3c6f47a88b64b75c3fd5
Last active March 25, 2019 00:47 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat