While trying to open my user's crontab on Ubuntu, the system barked back:
$ crontab -l
crontabs/myuser/: fopen: Permission deniedThis is due to improper permissions on crontab executable.
| # I want to sync the local clock but don't have access to any NTP server. | |
| # Website https://time.is tells me the time difference of my system clock and I can manually adjust the local clock. | |
| # But then I recall that a HTTP response often contains a date header with current time in GMT timezone. | |
| # I'll use it to set the system clock with the precision of 1 or 2 seconds. | |
| # When I need more accurate time, I can use `datetime` (or `utc_datetime`) from `http://worldtimeapi.org/api/ip.txt` | |
| # time from worldtimeapi.org has millisecond precision, you can use it to compare with your system time: | |
| date -uIns && time curl -s http://worldtimeapi.org/api/ip.txt | sed -n 's/^utc_datetime://p' | |
| date -Ins && time curl -s http://worldtimeapi.org/api/ip.txt | sed -n 's/^datetime://p' |
| #!/bin/sh | |
| # Convert rtsp stream to hls and write to file | |
| ffmpeg -i "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0" -c copy -hls_time 2 -hls_wrap 10 "/var/www/html/streaming.m3u8" |
| title | subtitle | author | date | source |
|---|---|---|---|---|
Docker Compose Cheatsheet |
Quick reference for Docker Compose commands and config files |
Jon LaBelle |
April 7, 2019 |
| import asyncio | |
| import json | |
| import logging | |
| import websockets | |
| import aioredis | |
| logging.basicConfig(level=logging.INFO) | |
| # STATE = {'value': 0} | |
| USERS = set() |
| version: '3.1' | |
| services: | |
| db: | |
| image: mariadb | |
| restart: always | |
| command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci --init-connect='SET NAMES UTF8;' --innodb-flush-log-at-trx-commit=0 | |
| ports: | |
| - 3306:3306 |
| FROM golang:1.9 | |
| WORKDIR /go/src/github.com/purplebooth/example | |
| COPY . . | |
| RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go | |
| FROM scratch | |
| COPY --from=0 /go/src/github.com/purplebooth/example/main /main | |
| CMD ["/main"] |
| RUN apt update | |
| RUN apt upgrade -y | |
| RUN apt install -y apt-utils | |
| RUN a2enmod rewrite | |
| RUN apt install -y libmcrypt-dev | |
| RUN docker-php-ext-install mcrypt | |
| RUN apt install -y libicu-dev | |
| RUN docker-php-ext-install -j$(nproc) intl | |
| RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev | |
| RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ |
| import time | |
| import socket | |
| import threading | |
| import logging | |
| from ws4py.client import WebSocketBaseClient | |
| from ws4py.streaming import Stream | |
| logger = logging.getLogger(__name__) |
| # AES helper class for pycrypto | |
| # Copyright (c) Dennis Lee | |
| # Date 22 Mar 2017 | |
| # Description: | |
| # Python helper class to perform AES encryption, decryption with CBC Mode & PKCS7 Padding | |
| # References: | |
| # https://www.dlitz.net/software/pycrypto/api/2.6/ | |
| # http://japrogbits.blogspot.my/2011/02/using-encrypted-data-between-python-and.html |