Let's start by creating entry for server in docker-compose.yaml:
version: '2'
# version 2 of docker-compose is not "old" version, it's the actual version,
# see below for explanation:
# https://stackoverflow.com/a/53636006/961092
services:| #EXTM3U | |
| #EXTINF:-1 tvg-id="1" tvg-name="CCTV1" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV1.png" group-title="央视频道",CCTV-1高清 | |
| rtsp://123.147.113.84:554/04000001/01000000004000000000000000000231?AuthInfo=xxx&userid= | |
| #EXTINF:-1 tvg-id="2" tvg-name="CCTV2" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV2.png" group-title="央视频道",CCTV-2高清 | |
| rtsp://123.147.113.84:554/04000001/01000000004000000000000000000295?AuthInfo=xxx&userid= | |
| #EXTINF:-1 tvg-id="3" tvg-name="CCTV3" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV3.png" group-title="央视频道",CCTV-3高清 | |
| rtsp://123.147.113.84:554/04000001/01000000004000000000000000000302?AuthInfo=xxx&userid= | |
| #EXTINF:-1 tvg-id="4" tvg-name="CCTV4" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV4.png" group-title="央视频道",CCTV-4高清 | |
| rtsp://123.147.113.84:554/04000001/01000000004000000000000000000342?AuthInfo=xxx&userid= | |
| #EXTINF:-1 tvg-id="5" tvg-name="CCTV5" tvg-logo="http://epg.51zmt.top:8000/tb1/CCTV/CCTV5.png" group-title="央视频道",CCTV-5高清 |
| // WIN32/C++17: DX11 DXGI Screen capture sample | |
| // | |
| // References: | |
| // - https://github.com/microsoftarchive/msdn-code-gallery-microsoft/tree/master/Official%20Windows%20Platform%20Sample/DXGI%20desktop%20duplication%20sample | |
| // - https://github.com/microsoft/DirectXTex/blob/master/ScreenGrab/ScreenGrab11.cpp | |
| // - https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/desktop-dup-api | |
| // | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <atlbase.h> |
| """An example of a cache decorator.""" | |
| import json | |
| from functools import wraps | |
| from redis import StrictRedis | |
| redis = StrictRedis() | |
| def cached(func): |
Let's start by creating entry for server in docker-compose.yaml:
version: '2'
# version 2 of docker-compose is not "old" version, it's the actual version,
# see below for explanation:
# https://stackoverflow.com/a/53636006/961092
services:| - General | |
| [ ] The code works | |
| [ ] The code is easy to understand | |
| [ ] Follows coding conventions | |
| [ ] Names are simple and if possible short | |
| [ ] Names are spelt correctly | |
| [ ] Names contain units where applicable | |
| [ ] Enums are used instead of int constants where applicable | |
| [ ] There are no usages of 'magic numbers' | |
| [ ] All variables are in the smallest scope possible |
| # 生成 socks5 协议的连接命令16进制数据,用于 haproxy的 tcp-check send-binary | |
| # 参考: | |
| # - <https://zh.wikipedia.org/wiki/SOCKS#SOCKS5>, "SOCKS5请求格式" 部分 | |
| # - <http://cbonte.github.io/haproxy-dconv/configuration-1.7.html#4.2-tcp-check%20send-binary> | |
| socks5_connect_binary = lambda domain, port: "05010003"+"%02x" % len(domain)+"".join(["%02x" % ord(x) for x in domain])+"%04x" % int(port) |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| default_type text/html; | |
| access_log /dev/stdout; | |
| sendfile on; | |
| keepalive_timeout 65; |
Seeing how SteamIDs have changed recently, I thought I'd write a Gist to help others (including myself!) decypher how to convert these from one format to the other in Python. First, let's go over basics to convert a 64bit CommunityID into a SteamID:
steamid64ident = 76561197960265728
def commid_to_steamid(commid):
steamid = []
steamid.append('STEAM_0:')
steamidacct = int(commid) - steamid64ident
| [program:myapp] | |
| autostart = true | |
| user = myapp | |
| command = /srv/myapp/env/bin/uwsgi --ini /srv/myapp/run/uwsgi.ini | |
| directory=/srv/myapp | |
| priority = 1 | |
| redirect_stderr = true | |
| stdout_logfile = /srv/myapp/log/wsgi.log | |
| stopsignal = QUIT |
| # author: weizhifeng | |
| status=$(ps aux|grep haproxy | grep -v grep | grep -v bash | wc -l) | |
| if [ "${status}" = "0" ]; then | |
| /etc/init.d/haproxy start | |
| status2=$(ps aux|grep haproxy | grep -v grep | grep -v bash |wc -l) | |
| if [ "${status2}" = "0" ]; then | |
| /etc/init.d/keepalived stop |