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
| # -*- coding: utf-8 -*- | |
| # Verity sprite file | |
| import argparse | |
| import struct | |
| import os | |
| parser = argparse.ArgumentParser(description='Check sprite file.') | |
| parser.add_argument('-f', required=True, help='sprite file', dest='spr') |
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
| def cal(usage, homes, table): | |
| charge = 0 | |
| for i, j in table: | |
| assert 0 < i | |
| assert 0 < j | |
| if 0 >= usage: | |
| break |
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
| HOUSE_TAX_TABLE = ((60, 1), (90, 1.5), (150, 2.5), (float('inf'), 4.0)) | |
| RESOURCE_TAX_TABLE = ((6, 0.4), (7, 0.5), (13, 0.6), (13, 0.8), (25, 1.0), (float('inf'), 1.2)) | |
| LAND_AREA = 324.7 | |
| LAND_UNIT_PRICE = 788000 | |
| BUILDING_AREA = 490.86 | |
| BUSINESS_AREA = 173.91 | |
| BUSINESS_UNIT_PRICE = 764000 |
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
| def cal(usage, homes, table): | |
| charge = 0 | |
| for i, j in table: | |
| assert 0 < i | |
| assert 0 < j | |
| if 0 >= usage: | |
| break |
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
| import argparse | |
| import pycurl | |
| connected = False | |
| ap = argparse.ArgumentParser(description="Monitor event notifications from Dahua IP camera.") | |
| ap.add_argument("-i", required=True, help="User ID", dest="id") | |
| ap.add_argument("-p", required=True, help="User Password", dest="pw") | |
| ap.add_argument("-a", required=True, help="Address for a camera", dest="addr") | |
| ap.add_argument("-n", default=80, required=False, help="Port number for a camera", dest="port") |
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
| # My ffmpeg command makes time-based file names. | |
| # RaspberryPi does not have RTC. | |
| # So time should be synchronized to prevent files from being messed up. | |
| /usr/bin/timedatectl status | /usr/bin/grep "synchronized: yes" >/dev/null 2>&1 | |
| if [ 0 -ne $? ] | |
| then | |
| return 1 | |
| fi | |
| /usr/bin/ffmpeg -rtsp_transport tcp -stimeout 3000000 \ |
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
| [Unit] | |
| Description=Record camera | |
| [Service] | |
| Type=simple | |
| ExecStart=/bin/sh /home/heisvoid/bin/cam/record_cam.sh | |
| Restart=always | |
| RestartSec=10 |
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
| [Unit] | |
| Description=Record camera on boot | |
| [Timer] | |
| OnBootSec=10sec | |
| [Install] | |
| WantedBy=timers.target |
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
| i=0 | |
| for f in `/usr/bin/ls -1 -r /mnt/disk0/cam0/rec/*.mp4 2>/dev/null` | |
| do | |
| # Skip the latest file | |
| if [ 0 -eq $i ] | |
| then | |
| i=1 | |
| continue |
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
| [Unit] | |
| Description=Move camera records | |
| [Service] | |
| Type=simple | |
| ExecStart=/bin/sh /home/heisvoid/bin/cam/move_cam_records.sh |