Skip to content

Instantly share code, notes, and snippets.

View Oranzh's full-sized avatar
🏠
Working from home

Lix Oranzh

🏠
Working from home
  • Xi'an China
  • 07:50 (UTC -12:00)
View GitHub Profile
@Oranzh
Oranzh / dnsmasq OS X.md
Created January 27, 2022 14:17 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@Oranzh
Oranzh / 1README.md
Created June 9, 2021 01:21 — forked from joseluisq/1README.md
Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

Lumen 5 HTTP Exception Handlers with JSON support.

Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.

image

Setup

Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php and app/Http/Middleware/Authenticate.php

@Oranzh
Oranzh / Install-Mcrypt.md
Created April 6, 2021 13:28 — forked from idleberg/Install-Mcrypt.md
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3
@Oranzh
Oranzh / failed_job database problem
Last active November 13, 2020 04:13
Lumen 队列失败数据表failed_job问题
Lumen version 8.x
通过 php artsian queue:failed_job命令生成migration文件,表的数据结构和8.x文档给的不一致,需要手动修改
@Oranzh
Oranzh / CORS TEST
Last active October 28, 2021 07:25
CORS 本地环境跨域测试方法
1.为什么要进行跨域测试?
因为一些(跨域)的请求会被同源策略禁止,比如Ajax请求
跨域资源共享(英语:Cross-origin resource sharing,缩写:CORS),用于让网页的受限资源能够被其他域名的页面访问的一种机制。
主要原因是我想测试Lumen的Cors中间件(https://github.com/palanik/lumen-cors)。
2.如何在本地环境进行测试?
谷歌浏览器(为什么是谷歌,因为我只用google浏览器)的开发者工具,打开console,输入以下JS代码
@Oranzh
Oranzh / ThrottleRequests.php
Created November 2, 2020 06:25
Lumen Throttle
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Cache\RateLimiter;
use Illuminate\Cache\RateLimiting\Unlimited;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Illuminate\Support\Arr;
use Illuminate\Support\InteractsWithTime;
@Oranzh
Oranzh / curl.md
Created January 21, 2019 03:36 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Oranzh
Oranzh / mysql_helpful_commands.md
Created January 10, 2019 02:43 — forked from joseluisq/mysql_helpful_commands.md
Some useful commands and scripts for MySQL.

MySQL helpful commands and scripts

Some useful commands and scripts for MySQL.

Import script file from console

mysql -h host -u username -p password --default_character_set utf8 database_name < mysql_script.sql

Or on MySQL shell type:

@Oranzh
Oranzh / openssl.ssh
Created April 26, 2018 03:15 — forked from mbejda/openssl.ssh
Installing OpenSSL 1.0.2 on Ubuntu 14
openssl version -a
sudo add-apt-repository ppa:0k53d-karl-f830m/openssl
sudo apt-get update
sudo apt-get install openssl
openssl version -a
@Oranzh
Oranzh / AES-256 encryption and decryption in PHP and C#.md
Created March 24, 2018 04:19
AES-256 encryption and decryption in PHP and C#

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';