Skip to content

Instantly share code, notes, and snippets.

@yusureabc
yusureabc / XmlToArr
Created December 30, 2019 08:16
php XML Array 互转
function ArrToXml($arr)
{
if(!is_array($arr) || count($arr) == 0) return '';
$xml = "<xml>";
foreach ($arr as $key=>$val)
{
if (is_numeric($val)){
$xml.="<".$key.">".$val."</".$key.">";
}else{
if ($remote_addr !~ ^(100.110.15.16|100.110.15.17|100.110.15.18|127.0.0.1)) {
return 403;
}
@yusureabc
yusureabc / CommandLine.java
Created July 31, 2018 14:23
打印所有的 java 命令行参数
/* $ javac CommandLine.java
$ java CommandLine this is a command line 200 -100 */
public class CommandLine
{
public static void main(String[] args)
{
int len = args.length;
for ( int i = 0; i < len; i++ )
{
@yusureabc
yusureabc / DiffDemo.java
Created July 31, 2018 02:25
测试java代码运行时间
import java.util.*;
public class DiffDemo
{
public static void main(String[] args)
{
try
{
long start = System.currentTimeMillis();
@yusureabc
yusureabc / cmd.reg
Created July 27, 2018 05:59
win10下右键菜单添加“打开cmd”
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\cmd_here]
@="在此处打开命令行"
"Icon"="cmd.exe"
@yusureabc
yusureabc / webhook.php
Created July 16, 2018 06:22
Git WebHook 自动更新代码
<?php
/* Git WebHook 自动更新代码 */
/* 成功条件:1. php 的运行用户(一般是www-data)需要 sudo 免密码 2. git 需要记住密码 */
define( 'PASSWORD', '123456' );
$requestBody = file_get_contents( "php://input" );
$content = json_decode( $requestBody, true );
/* 验证密码 */
@yusureabc
yusureabc / urlsafeB64.php
Last active August 7, 2023 09:36
URL-safe Base64
<?php
/**
* Decode a string with URL-safe Base64.
*
* @param string $input A Base64 encoded string
*
* @return string A decoded string
*/
function urlsafeB64Decode($input)
@yusureabc
yusureabc / mobile.html
Created May 24, 2018 01:22
适配手机页面 meta
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"/>
@yusureabc
yusureabc / sources.list
Last active February 12, 2021 09:24
ubuntu 16.04换阿里云源
cd /etc/apt/
cp sources.list sources.list.bak
# 替换以下文件 #
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
@yusureabc
yusureabc / reverse_proxy.conf
Created April 17, 2018 12:32
nginx设置反向代理后,页面上的js css文件无法加载
location ~ .*\.(js|css|png|jpg)$ {
proxy_pass http://47.93.35.223:8081;
}