Skip to content

Instantly share code, notes, and snippets.

View huzemin's full-sized avatar
🐱
CAONIMA

胡泽民 huzemin

🐱
CAONIMA
  • HuiZhou University
  • HuiZhou ,China
View GitHub Profile
@huzemin
huzemin / ipInNetwork.php
Created January 19, 2020 07:15
判断IP是否属于某个网段
<?php
function ipInNetwork($ip, $network) {
if(!filter_var($ip, FILTER_VALIDATE_IP)) {
throw new \Exception($ip . '不是有效IP地址');
}
if(!preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d+/', $network)) {
throw new \Exception($network . '不是有效网段设置,如:192.168.0.1/24');
}
@huzemin
huzemin / host.txt
Created January 17, 2020 09:09
github 域名污染导致部分数据无法请求成功解决方案
192.30.253.112 github.com
192.30.253.119 gist.github.com
185.199.110.153 assets-cdn.github.com
185.199.109.154 github.githubassets.com
151.101.228.133 raw.githubusercontent.com
151.101.228.133 gist.githubusercontent.com
151.101.228.133 cloud.githubusercontent.com
151.101.228.133 camo.githubusercontent.com
151.101.108.133 avatars0.githubusercontent.com
151.101.228.133 avatars1.githubusercontent.com
@huzemin
huzemin / laravel-encrypt.js
Created December 3, 2019 06:47
laravel Encrypt convert to CryptoJS in Javascript
import CryptoJS from "crypto-js";
const LaravelEncrypt = function (key) {
this.key = key;
}
LaravelEncrypt.prototype.decrypt = function (encryptStr) {
encryptStr = CryptoJS.enc.Base64.parse(encryptStr);
let encryptData = encryptStr.toString(CryptoJS.enc.Utf8);
encryptData = JSON.parse(encryptData);
@huzemin
huzemin / For Mac 4.2.6 unlimited trial.md
Created October 23, 2019 02:11 — forked from rise-worlds/For Mac 4.2.6 unlimited trial.md
Beyond Compare 4 license for Windows, Mac, Linux

for 4.2.4 or higher,4.2.5,4.2.6 ,it's works , this is the way which makes Always in evaluation mode 。

  1. go to the dir : /Applications/Beyond Compare.app/Contents/MacOS
  2. change the name BCompare to BCompare.bak
  3. touch a file name BCompare , and chmod a+u BCompare
  4. insert BCompare the content :
#!/bin/bash
rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat"
"`dirname "$0"`"/BCompare.bak $@
@huzemin
huzemin / bug.md
Last active March 6, 2019 05:38
iview 3.3.0 FormItem验证无效问题

使用 iview 3.3.0 [仅移除计算属性cache属性]出现问题。

使用计算属性作为表单的v-model时, 进行表单验证时仅验证第一次有效,之后就一直保存第一次的结果。 应该是fieldValue的值没有得到更新。改为 @ChuanfengZhang 的做法(使用方法)就可以正常进行表单验证。

iview/iview#5313

@huzemin
huzemin / upgrade.sh
Created March 2, 2019 11:28 — forked from artemsky/upgrade.sh
PHP 7.2 Cloud9
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
sudo apt-get install libapache2-mod-php7.2 -y
sudo a2dismod php5
sudo a2enmod php7.2
sudo service apache2 restart
@huzemin
huzemin / cloud9-update-php7.sh
Created March 2, 2019 09:50
Cloud9更新PHP版本
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.1-curl php7.1-cli php7.1-dev php7.1-gd php7.1-intl php7.1-mcrypt php7.1-json php7.1-mysql php7.1-opcache php7.1-bcmath php7.1-mbstring php7.1-soap php7.1-xml php7.1-zip -y
sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak
sudo apt-get remove libapache2-mod-php5 -y
sudo apt-get install libapache2-mod-php7.1 -y
sudo cp /etc/apache2/envvars.bak /etc/apache2/envvars
@huzemin
huzemin / sublimetext.txt
Created September 23, 2018 07:41
Sublime Text Licence Key Build 3176
----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
76E84F0B CD69BFC7 59F2DFEF E267328F
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4
969624E7 DC9CD4D5 717FB40C 1B9738CF
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8

解决 Git 在 windows 下中文乱码的问题

原因

中文乱码的根源在于 windows 基于一些历史原因无法全面支持 utf-8 编码格式,并且也无法通过有效手段令其全面支持。

解决方案

  1. 安装