ini es_input.cfg
es_input.cfg
<?xml version="1.0"?>
<inputList>
<inputConfig type="joystick" deviceName="GPIO Controller 1" deviceGUID="15000000010000000100000000010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="x" type="button" id="2" value="1" />
<input name="y" type="button" id="3" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="right" type="axis" id="0" value="1" />
<input name="up" type="axis" id="1" value="-1" />
</inputConfig>
<inputConfig type="joystick" deviceName="GPIO Controller 2" deviceGUID="15000000010000000200000000010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="x" type="button" id="2" value="1" />
<input name="y" type="button" id="3" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="right" type="axis" id="0" value="1" />
<input name="up" type="axis" id="1" value="-1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Broadcom Bluetooth Wireless Joystick " deviceGUID="0500000042726f6164636f6d20426c00">
<input name="a" type="button" id="2" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="8" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="6" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="0" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Bluetooth Wireless Controller " deviceGUID="05000000202800000900000000010000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="10" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="7" value="1" />
<input name="pageup" type="button" id="6" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="10" value="1" />
<input name="start" type="button" id="11" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="4" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="NES30 NES30 Joystick" deviceGUID="030000003512000012ab000010010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="2" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="0" value="1" />
<input name="y" type="button" id="3" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="szmy-power Ltd. Joypad " deviceGUID="05000000103800000900000000010000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="13" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="8" value="1" />
<input name="l3" type="button" id="13" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="7" value="1" />
<input name="pageup" type="button" id="6" value="1" />
<input name="r2" type="button" id="9" value="1" />
<input name="r3" type="button" id="14" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="10" value="1" />
<input name="start" type="button" id="11" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="4" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="8Bitdo FC30 Pro 8Bitdo FC30 Pro" deviceGUID="03000000021000000090000011010000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="13" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="8" value="1" />
<input name="l3" type="button" id="13" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="7" value="1" />
<input name="pageup" type="button" id="6" value="1" />
<input name="r2" type="button" id="9" value="1" />
<input name="r3" type="button" id="14" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="10" value="1" />
<input name="start" type="button" id="11" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="4" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="8Bitdo JoyStick 8Bitdo Joy " deviceGUID="03000000008000000210000011010000">
<input name="a" type="button" id="2" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="8" value="1" />
<input name="l2" type="button" id="6" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="0" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Xbox Gamepad (userspace driver)" deviceGUID="0000000058626f782047616d65706100">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="10" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="6" value="1" />
<input name="l3" type="button" id="11" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="r3" type="button" id="12" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="2" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Xbox 360 Wireless Receiver (XBOX)" deviceGUID="030000005e0400009102000007010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="down" type="button" id="14" value="1" />
<input name="hotkey" type="button" id="8" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="3" value="-1" />
<input name="joystick2up" type="axis" id="4" value="-1" />
<input name="l2" type="axis" id="2" value="1" />
<input name="l3" type="button" id="9" value="1" />
<input name="left" type="button" id="11" value="1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="axis" id="5" value="1" />
<input name="r3" type="button" id="10" value="1" />
<input name="right" type="button" id="12" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="up" type="button" id="13" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="2" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="PLAYSTATION(R)3 Controller (00:48:E8:D1:63:25)" deviceGUID="060000004c0500006802000000010000">
<input name="a" type="button" id="13" value="1" />
<input name="b" type="button" id="14" value="1" />
<input name="down" type="button" id="6" value="1" />
<input name="hotkey" type="button" id="16" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="8" value="1" />
<input name="l3" type="button" id="1" value="1" />
<input name="left" type="button" id="7" value="1" />
<input name="pagedown" type="button" id="11" value="1" />
<input name="pageup" type="button" id="10" value="1" />
<input name="r2" type="button" id="9" value="1" />
<input name="r3" type="button" id="2" value="1" />
<input name="right" type="button" id="5" value="1" />
<input name="select" type="button" id="0" value="1" />
<input name="start" type="button" id="3" value="1" />
<input name="up" type="button" id="4" value="1" />
<input name="x" type="button" id="12" value="1" />
<input name="y" type="button" id="15" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="DragonRise Inc. Generic USB Joystick " deviceGUID="03000000790000000600000010010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="2" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="8" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="3" value="-1" />
<input name="joystick2up" type="axis" id="4" value="-1" />
<input name="l2" type="button" id="6" value="1" />
<input name="l3" type="button" id="10" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="r3" type="button" id="11" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="0" value="1" />
<input name="y" type="button" id="3" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Mega World" deviceGUID="03000000b50700000399000000010000">
<input name="a" type="button" id="4" value="1" />
<input name="b" type="button" id="2" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="10" value="1" />
<input name="l2" type="button" id="7" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="8" value="1" />
<input name="pageup" type="button" id="6" value="1" />
<input name="r2" type="button" id="9" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="11" value="1" />
<input name="start" type="button" id="1" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="5" value="1" />
<input name="y" type="button" id="3" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Microsoft X-Box 360 pad" deviceGUID="030000005e0400008e02000014010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="8" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="3" value="-1" />
<input name="joystick2up" type="axis" id="4" value="-1" />
<input name="l2" type="axis" id="2" value="1" />
<input name="l3" type="button" id="9" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="axis" id="5" value="1" />
<input name="r3" type="button" id="10" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="2" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Xbox Gamepad (userspace driver)" deviceGUID="0000000058626f782047616d65706100">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="10" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="3" value="-1" />
<input name="l2" type="button" id="6" value="1" />
<input name="l3" type="button" id="11" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="r3" type="button" id="12" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="2" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Sony Computer Entertainment Wireless Controller" deviceGUID="030000004c050000c405000011010000">
<input name="a" type="button" id="2" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="hat" id="0" value="4" />
<input name="hotkey" type="button" id="12" value="1" />
<input name="joystick1left" type="axis" id="0" value="-1" />
<input name="joystick1up" type="axis" id="1" value="-1" />
<input name="joystick2left" type="axis" id="2" value="-1" />
<input name="joystick2up" type="axis" id="5" value="-1" />
<input name="l2" type="button" id="6" value="1" />
<input name="l3" type="button" id="10" value="1" />
<input name="left" type="hat" id="0" value="8" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="r2" type="button" id="7" value="1" />
<input name="r3" type="button" id="11" value="1" />
<input name="right" type="hat" id="0" value="2" />
<input name="select" type="button" id="8" value="1" />
<input name="start" type="button" id="9" value="1" />
<input name="up" type="hat" id="0" value="1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="0" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="Virtual gamepad" deviceGUID="03000000030000000300000002000000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="2" value="1" />
<input name="y" type="button" id="3" value="1" />
</inputConfig>
<inputConfig type="keyboard" deviceName="Keyboard" deviceGUID="-1">
<input name="a" type="key" id="103" value="1" />
<input name="b" type="key" id="106" value="1" />
<input name="down" type="key" id="100" value="1" />
<input name="hotkey" type="key" id="110" value="1" />
<input name="left" type="key" id="101" value="1" />
<input name="pagedown" type="key" id="109" value="1" />
<input name="pageup" type="key" id="107" value="1" />
<input name="right" type="key" id="102" value="1" />
<input name="select" type="key" id="110" value="1" />
<input name="start" type="key" id="111" value="1" />
<input name="up" type="key" id="99" value="1" />
<input name="x" type="key" id="104" value="1" />
<input name="y" type="key" id="105" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="USB,2-axis 8-button gamepad " deviceGUID="03000000830500006020000010010000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="2" value="1" />
<input name="y" type="button" id="3" value="1" />
</inputConfig>
<inputConfig type="joystick" deviceName="szmy-power Ltd. Joypad " deviceGUID="05000000102800000900000000010000">
<input name="a" type="button" id="0" value="1" />
<input name="b" type="button" id="1" value="1" />
<input name="down" type="axis" id="1" value="1" />
<input name="hotkey" type="button" id="10" value="1" />
<input name="left" type="axis" id="0" value="-1" />
<input name="pagedown" type="button" id="7" value="1" />
<input name="pageup" type="button" id="6" value="1" />
<input name="right" type="axis" id="0" value="1" />
<input name="select" type="button" id="10" value="1" />
<input name="start" type="button" id="11" value="1" />
<input name="up" type="axis" id="1" value="-1" />
<input name="x" type="button" id="3" value="1" />
<input name="y" type="button" id="4" value="1" />
</inputConfig>
</inputList>
ini nginx的:配置
域名重定向,Log,php,
1dailian.conf
server {
listen 80;
listen [::]:80;
server_name dev.1dailian.com;
index index.php index.html index.htm default.html default.htm default.php;
root /data/workbench/www/1dailian/public;
client_max_body_size 20M;
# rewrite root domain to ssl url
rewrite ^/$ https://dev.1dailian.com/ permanent;
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
access_log /data/workbench/logs/dailian_access.log;
error_log /data/workbench/logs/dailian_error.log;
# font, json support react fetch
location ~* \.(eot|ttf|woff|woff2|json)$ {
add_header Access-Control-Allow-Origin *;
}
}
ini uwsgi
app.py
import time
#N = 0
#
#def application(env, start_response):
# #1/0
# #time.sleep(6)
# start_response('200 OK', [('Content-Type','text/html')])
# global N
# N += 1
# return [b"Hello World ", str(N).encode()]
#
import tornado.web
import tornado.wsgi
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world!\n")
class ErrorHandler(tornado.web.RequestHandler):
def get(self):
1/0
app = tornado.web.Application([
(r"/", MainHandler),
(r"/e", ErrorHandler),
])
application = tornado.wsgi.WSGIAdapter(app)
reload.sh
uwsgi --reload uwsgi.pid
spy.py
#!/usr/bin/env python3
import tornadospy
application = tornadospy.make_wsgi_app()
uwsgi.ini
[uwsgi]
daemonize = uwsgi.log
socket = uwsgi.sock
pidfile = uwsgi.pid
stats = stats.sock
optimize = 2
processes = 4
#touch-reload = reload
max-requests = 1000
#buffer-size = 32768
#master
auto-procname
disable-logging
vacuum
close-on-exec
close-on-exec2
manage-script-name
#enable-threads
wsgi-file = app.py
mount = /_spy=spy.py
ini dotfile
dotfile
tmux.conf
# change prefix key
set -g prefix C-a
unbind C-b
# C-bのキーバインドを解除する
unbind C-b
# キーストロークのディレイを減らす
set -sg escape-time 1
# ウィンドウのインデックスを1から始める
set -g base-index 1
# ペインのインデックスを1から始める
setw -g pane-base-index 1
# 設定ファイルをリロードする
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# C-a*2でtmux内のプログラムにC-aを送る
bind C-a send-prefix
# | でペインを縦に分割する
bind | split-window -h
# - でペインを横に分割する
bind - split-window -v
# Vimのキーバインドでペインを移動する
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Vimのキーバインドでペインをリサイズする
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
## マウス操作を有効にする
#setw -g mouse on
# 256色端末を使用する
set -g default-terminal "screen-256color"
# ステータスバーの色を設定する
set -g status-fg white
set -g status-bg black
# ウィンドウリストの色を設定する
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
# アクティブなウィンドウを目立たせる
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
# ペインボーダーの色を設定する
set -g pane-border-fg green
set -g pane-border-bg black
# アクティブなペインを目立たせる
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow
# コマンドラインの色を設定する
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# ステータスバーを設定する
## 左パネルを設定する
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
## 右パネルを設定する
set -g status-right "#[fg=cyan][%Y-%m-%d(%a) %H:%M]"
## リフレッシュの間隔を設定する(デフォルト 15秒)
set -g status-interval 60
## ウィンドウリストの位置を中心寄せにする
set -g status-justify centre
## ヴィジュアルノーティフィケーションを有効にする
setw -g monitor-activity on
set -g visual-activity on
## ステータスバーを上部に表示する
set -g status-position top
# コピーモードを設定する
## viのキーバインドを使用する
setw -g mode-keys vi
## クリップボード共有を有効にする
#set-option -g default-command "reattach-to-user-namespace -l zsh"
set-option -g default-command ""
### コピーモードの操作をvi風に設定する
#bind-key -T copy-mode-vi v send-keys -X begin-selection
#bind-key -T copy-mode-vi y send-keys copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
#unbind -T copy-mode-vi Enter
#bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
ini nginx的域名配置参考
nginx的域名配置参考
nginx-vhost.conf
server
{
listen 80;
#listen [::]:80;
server_name mianfeibang.cn www.mianfeibang.cn;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/mianfeibang.cn;
include wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/mianfeibang.cn.log;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name mianfeibang.cn www.mianfeibang.cn;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/mianfeibang.cn;
ssl on;
ssl_certificate /etc/letsencrypt/live/mianfeibang.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mianfeibang.cn/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/mianfeibang.cn.log;
}
ini HAproxy Snippets
redirect_http_to_https.cfg
redirect scheme https code 301 if !{ ssl_fc }
ini Beanstalkd队列工作者
Beanstalkd队列工作者
BeanstalkdWorker.php
<?php
declare(strict_types=1);
namespace My\Queue;
use Pheanstalk\Pheanstalk;
use Exception;
class BeanstalkdWorker
{
protected $queueClient;
protected $queueNames;
protected $handler;
protected $options = [];
private $startTime;
private function __construct(
Pheanstalk $queueClient,
array $queueNames,
callable $handler,
array $options
) {
$this->queueClient = $queueClient;
$this->queueNames = $queueNames;
$this->handler = $handler;
$this->options = array_merge($this->getDefaultOptions(), $options);
}
public static function create(
Pheanstalk $queueClient,
$queueNames,
callable $handler,
array $options
) : self {
return new self(
$queueClient,
$queueNames,
$handler,
$logger,
$options
);
}
private function getDefaultOptions() : array
{
return [
'sleep' => 5,
'timeout' => 60,
'memory' => 128,
'on_error' => function ($job, Exception $error) {
$this->queueClient->bury($error->getJob());
}
];
}
public function run()
{
$this->init();
while (true) {
$this->runNextJob();
if ($this->shouldRestart()) {
$this->stop();
}
}
}
final protected function init()
{
$this->startTime = time();
$this->watchQueues();
}
protected function watchQueues()
{
foreach ($this->queueNames as $queueName) {
$this->queueClient->watch($queueName);
}
}
protected function runNextJob()
{
$job = $this->queueClient->reserve(0);
if (!$job) {
$this->sleep();
return;
}
try {
$this->processJob($job);
} catch (Exception $ex) {
$this->handleJobException($job, $ex);
}
}
protected function processJob($job)
{
$handler = $this->handler;
$handler($job);
$this->queueClient->delete($job);
}
protected function handleJobException($job, $exception)
{
$errorHandler = $this->options['on_error'];
$errorHandler($job, $exception);
}
protected function shouldRestart() : bool
{
if (
$this->timeoutReached($this->options['timeout'])
|| $this->memoryExceeded($this->options['memory'])
) {
return true;
}
return false;
}
protected function timeoutReached(int $timeout) : bool
{
return (time() - $this->startTime >= $timeout);
}
protected function memoryExceeded($memoryLimit) : bool
{
return (memory_get_usage() / 1024 / 1024) >= $memoryLimit;
}
protected function stop()
{
die;
}
protected function sleep()
{
sleep($this->options['sleep']);
}
}
notifications_worker.php
<?php
declare(strict_types=1);
use My\BeanstalkdWorker;
use Pheanstalk\Pheanstalk;
use Pheanstalk\Job;
$worker = BeanstalkdWorker::create(
new Pheanstalk('127.0.0.1'),
[
'notifications',
],
function (Job $job) {
$notification = json_decode($job->getData(), true);
mail($notification['to'], $notification['subject'], $notification['message']);
},
[
'timeout' => 120,
'memory' => 256,
]
);
$worker->run();
worker.conf
[program:notificationsWorker]
command=/usr/bin/php /home/ubuntu/app/bin/notifications_worker.php
process_name=%(program_name)s.%(process_num)s
numprocs=5
directory=/tmp
stdout_logfile=/var/log/supervisor/%(program_name)s.%(process_num)s.stdout.log
autostart=true
autorestart=true
user=ubuntu
exitcodes=0
stopsignal=KILL
ini haproxy.cfg
haproxy.cfg
global
ca-base /etc/ssl/certs
log 127.0.0.1 local0
daemon
maxconn 256
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
option forwardfor
option http-server-close
frontend packages
bind *:80
default_backend my-backend
# /cloudpassage
acl p_cloudpassage path_beg /cloudpassage/
use_backend cloudpassage if p_cloudpassage
backend cloudpassage
server cloudpassage production.packages.cloudpassage.com:443 ssl ca-file ca-bundle.crt verifyhost production.packages.cloudpassage.com
# /cloudpassage/cphalo-LATEST-win64.exe ===> https://packages.cloudpassage.com/windows/cphalo-4.2.2-win64.exe
acl p_cpwin path_beg /cloudpassage/cphalo-LATEST-win
http-request set-path %[path,regsub(/cloudpassage/cphalo-LATEST,/windows/cphalo-4.2.2)] if p_cpwin
# /cloudpassage/cloudpassage.packages.key ===> https://packages.cloudpassage.com/cloudpassage.packages.key
acl p_cpkey path /cloudpassage/cloudpassage.packages.key
# NOTE(kgriffs): We should avoid proxying repo requests unless for some reason the customer
# refuses to open a route to packages.cloudpassage.com:443 in their firewall. That way, we
# aren't on the critical path each time someone does a yum update.
#
# /cloudpassage/debian/* ===> https://packages.cloudpassage.com/debian/*
# /cloudpassage/redhat/* ===> https://packages.cloudpassage.com/redhat/*
acl p_cprepo path_reg /cloudpassage/(debian|redhat)/
http-request set-path %[path,regsub(/cloudpassage/,/)] if p_cpkey or p_cprepo
backend my-backend
balance roundrobin
server app01 127.0.0.1:8080 check
server app02 127.0.0.1:8080 check
ini 自定义TMUX - curl -L https://goo.gl/xDv6Hv -o $ HOME / .tmux.conf
自定义TMUX - curl -L https://goo.gl/xDv6Hv -o $ HOME / .tmux.conf
.tmux.conf
# split panes using | and -, make sure they open in the same path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
ini 提供Raspberry Pi SD卡
提供Raspberry Pi SD卡
README.md
## You'll need
* Raspberry Pi 3, 3+ or 2 (only)
* A Linux PC, laptop or Raspberry with SD card reader/slot
* A number of Raspberry Pis configured with Ethernet
You must have an SSH key, if you don't know what this is then type in `ssh-keygen` and follow the instructions.
## Provision each Raspberry Pi:
1. Clone the gist and run `chmod +x make-rpi.sh`
2. Download the [Raspbian Lite](https://www.raspberrypi.org/downloads/raspbian/) image and place it in the folder
3. Populate your public SSH keys in `template-authorized_keys` on the Linux host. I.e. `cp ~/.ssh/id_rsa.pub template-authorized_keys`
4. Insert an SD card into your SD card reader
5. Edit `make-rpi.sh` and update `export DEV=` to the device you see on `lsblk` for your SD card reader
6. Edit `template-dhcpcd.conf` if your IP range isn't `192.168.0.0/24`
7. Run `sudo ./make-rpi node-1 101` to get `node-1.local` and `192.168.0.101` and so on.
Notes:
* For security log-in by password is disabled. If you want to log in via password then comment out the lines in `make-rpi.sh`
## Create a cluster
On each Raspberry Pi run
```
curl -sLS https://get.docker.com | sudo sh
sudo usermod -aG docker pi
```
Then on one Raspberry Pi (master) run:
```
sudo apt update && sudo apt install -qy git
docker swarm init --advertise-addr=eth0
```
One each of the others run the `docker swarm join` command that you were issued.
## Deploy a distributed system
[OpenFaaS](https://www.openfaas.com/) provides a way for you to build functions and run them across the capacity of your cluster including metrics, monitoring and auto-scaling with support for many programming languages.
On the master node:
```
git clone https://github.com/openfaas/faas
cd faas
./deploy_stack.armhf.sh
```
Now open up the OpenFaaS UI with: http://master-ip:8080/ and click "Deploy Function" to deploy a function from the built-in function store, or follow a tutorial at [https://www.openfaas.com](www.openfaas.com).
For help etc contact me via Twitter @alexellisuk or Join @openfaas Slack #arm-and-pi channel.
See also:
* [Serverless Kubernetes home-lab with your Raspberry Pis](https://blog.alexellis.io/serverless-kubernetes-on-raspberry-pi/)
* [Your Serverless Raspberry Pi cluster with Docker Swarm](https://blog.alexellis.io/your-serverless-raspberry-pi-cluster/) (original article)
make-rpi.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [ -z $1 ]; then
echo "Usage: ./make-rpi.sh <hostname> <ip-suffix>"
echo " ./make-rpi.sh node-1 101"
echo " ./make-rpi.sh node-2 102"
exit 1
fi
export DEV=sde
export IMAGE=2018-06-27-raspbian-stretch-lite.img
if [ -z "$SKIP_FLASH" ];
then
echo "Writing Raspbian Lite image to SD card"
time dd if=$IMAGE of=/dev/$DEV bs=1M
fi
sync
echo "Mounting SD card from /dev/$DEV"
mount /dev/${DEV}1 /mnt/rpi/boot
mount /dev/${DEV}2 /mnt/rpi/root
# Add our SSH key
mkdir -p /mnt/rpi/root/home/pi/.ssh/
cat template-authorized_keys > /mnt/rpi/root/home/pi/.ssh/authorized_keys
# Enable ssh
touch /mnt/rpi/boot/ssh
# Disable password login
sed -ie s/#PasswordAuthentication\ yes/PasswordAuthentication\ no/g /mnt/rpi/root/etc/ssh/sshd_config
echo "Setting hostname: $1"
sed -ie s/raspberrypi/$1/g /mnt/rpi/root/etc/hostname
sed -ie s/raspberrypi/$1/g /mnt/rpi/root/etc/hosts
# Reduce GPU memory to minimum
echo "gpu_mem=16" >> /mnt/rpi/boot/config.txt
# Set static IP
cp /mnt/rpi/root/etc/dhcpcd.conf /mnt/rpi/root/etc/dhcpcd.conf.orig
sed s/100/$2/g template-dhcpcd.conf > /mnt/rpi/root/etc/dhcpcd.conf
echo "Unmounting SD Card"
umount /mnt/rpi/boot
umount /mnt/rpi/root
sync
template-dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
interface eth0
static ip_address=192.168.0.100/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8