This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5288 Python: Экранирование строк от спецсимволов регулярных выражений: | |
Бывает так что из конфига или от пользователя нужно собрать строку, которая потом идёт в регулярное выражение. | |
Для того чтобы эффективно и быстро заэскейпить все спецссимволы регулярок в этой сроке используется re.escape(контент) - она возвращает заэкранированный контент. | |
т.е. реально можно использовать вот так: | |
re.search(re.escape(resource['mask'])+'.*'+re.escape(resource['format']),object.filename) | |
5289: Python: Отправка файла по SMB | |
def send_file(filename): | |
from smb.SMBConnection import SMBConnection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync | |
xrandr --addmode VGA-1 "2560x1440_60.00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For example "brick" application: | |
egan@wk149 ~> brick & disown | |
disown is a unix tool for that so rtfm about it, it cool. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's possible with Alias directive which is used like this | |
Alias /google_485135.html /usr/egan/google_485135.html | |
You can get 403 when serving of the file is working | |
to solve it you need to configure access to file on Apache level. | |
Alias /google_485135.html /usr/egan/google_485135.html | |
<Directory /usr/egan> | |
Require all granted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TABLE_NAME, | |
ENGINE | |
FROM information_schema.TABLES | |
WHERE TABLE_SCHEMA = 'YOUR DB NAME'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqlcheck -h 127.0.0.1 -u root -p -r YOUR_DB_NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will temporairly create /var/novk/ssl/.well-known/xxxxxx confirmation file and trigger | |
# external check of it's availiblty and contents from letsencrypt's authority servers. | |
# This directory simply should be served by some http server when container launches | |
# This container isn't designed to be persistent and it will exit and removed once command will finish. | |
# You may simply add it into your crontab | |
docker run -it --rm --name certbot \ | |
-v /var/novk/ssl:/var/novk/ssl \ | |
-v /etc/letsencrypt:/etc/letsencrypt \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filter Delegated log at /usr/share/delegated/log/53120 | |
[Init] | |
maxlines = 50 | |
[Definition] | |
datepattern = %%m/%%d %%H:%%M:%%S | |
failregex = .*?E-P: No permission: <HOST>.*?\(SocksV4 is not acceptable\) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Dockerfile for delegated | |
# | |
FROM debian | |
MAINTAINER kev <[email protected]> | |
ENV DG_VERSION 9_9_13 | |
ENV DG_FILE linux2.6-dg${DG_VERSION}.tar.gz | |
ENV DG_DIR dg${DG_VERSION} | |
ENV DG_URL http://delegate.hpcc.jp/anonftp/DeleGate/bin/linux/latest/${DG_FILE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set OVPN_DATA "ovpn-data-dir" | |
docker volume create --name $OVPN_DATA | |
docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm kylemanna/openvpn ovpn_genconfig -u udp://xl.novk.ga | |
docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm -it kylemanna/openvpn ovpn_initpki | |
docker run -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn | |
docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm -it kylemanna/openvpn easyrsa build-client-full root nopass | |
docker run -v $OVPN_DATA:/etc/openvpn --log-driver=none --rm kylemanna/openvpn ovpn_getclient root > root.ovpn |