Scipt to convert
import os
from glob import glob
import subprocess
MP4_PATH = '~/Desktop/notebooks/mp4/*.m4a' # path to all mp4 files| from Crypto.Cipher import AES | |
| from Crypto.Util import Padding | |
| from hashlib import md5 | |
| from base64 import b64encode, b64decode | |
| import sys | |
| passphrase = sys.argv[1] | |
| content = sys.argv[2] | |
| print(passphrase, content) |
| #/etc/systemd/system/test.service | |
| [Unit] | |
| Description=Test Systemd Service | |
| [Service] | |
| ExecStartPre=/usr/bin/echo -e "\033[0;33m Pre start \033[0m" | |
| ExecStart=/usr/bin/sleep 10 | |
| ExecStartPost=/usr/bin/echo -e "\033[0;33m Post start \033[0m" |
| # download font file มาก่อน | |
| !wget https://awards.opdc.go.th/awards_opdc/assets/fonts/THSarabunNew/THSarabunNew.ttf | |
| # import and install | |
| import matplotlib.pyplot as plt | |
| import matplotlib.font_manager as fm | |
| font_list = fm.createFontList(['THSarabunNew.ttf']) | |
| fm.fontManager.ttflist.extend(font_list) | |
| # set font | |
| plt.rcParams['font.family'] = 'TH Sarabun New' | |
| plt.rcParams['xtick.labelsize'] = 20.0 |
| ## | |
| ## How to install mcrypt in php7.2 / php7.3 | |
| ## Linux / MacOS / OSX | |
| ## | |
| ## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/ | |
| # |
| import cv2 | |
| import io | |
| import socket | |
| import struct | |
| import time | |
| import pickle | |
| import zlib | |
| client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| client_socket.connect(('192.168.1.124', 8485)) |
| from channels.auth import AuthMiddlewareStack | |
| from rest_framework.authtoken.models import Token | |
| from django.contrib.auth.models import AnonymousUser | |
| from django.db import close_old_connections | |
| class TokenAuthMiddleware: | |
| """ | |
| Token authorization middleware for Django Channels 2 | |
| """ |
Adapted from caddy systemd Service Unit
The provided file should work with systemd version 219 or later. It might work with earlier versions.
The easiest way to check your systemd version is to run systemctl --version.
We will assume the following:
| # The official MySQL (https://hub.docker.com/_/mysql/) supports only one MYSQL_DATABASE environment variable. | |
| # By modifying the entrypoint and passing shell script, you can create multiple dbs without having to make a mysql image just for this purpose. | |
| version: '3' | |
| services: | |
| # Some other service connecting to mysql | |
| db: | |
| image: mysql:5.6 |