Skip to content

Instantly share code, notes, and snippets.

@synctam
synctam / ambi_env_send crontab
Created May 19, 2023 07:39
crontab: Ambientサーバーへのアップロード用
AMBI_CHANNEL_ID=<AmbientのチャンネルID>
AMBI_READ_KEY=<Ambientの読み込みAPIキー>
AMBI_WRITE_KEY=<Ambientの書き込みAPIキー>
AMBI_INTERVAL=<アップロードのインターバル(秒)>
ADGUARD_WAIT_TIME=<AdGurdサービス起動までの待機時間(秒)>
@reboot /usr/bin/python3 /home/adpi/ambi_env_send.py >> /tmp/log 2>&1
@synctam
synctam / ambi_env_send.py
Last active May 19, 2023 07:48
Raspberry Pi のCPU温度、CPU利用率、メモリー利用率を取得し、Ambientにアップロードする。
#!/usr/bin/python3
# Copyright (c) 2023 synctam@gmail.com
# Released under the MIT license
import os
import datetime
import psutil
import subprocess
import time
import logging
from datetime import datetime
@synctam
synctam / squid.conf
Created May 13, 2023 09:21
squid.conf のサンプル
acl localnet src 192.168.0.0/24
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
void setup() {
Serial.begin(115200);
}
void loop() {
static int count = 0;
count++;
Serial.printf("count = %d\n", count);
delay(100);
}
■ Vector2D 版の Normalized 関数
AGKには、ベクトルの正規化関数がないみたいなので、Vector2D版のNormalized関数作りました。
これを利用すると、縦・横・斜めの移動速度を一定にすることができます。
//
// Vector2d型
//
Type Vector2d
x as float
y as float
■関数名
ファイル名_関数名
■変数名
変数名はハンガリアン記法。
変数名には型を示すプレフィックスを付ける。
■型プレフィックス
・文字列変数:ch
例:chTitle
AppGameKit
Basicの基本の基
Basic言語では、大文字小文字は区別されない。
Print( 1 )
pRiNt( 1 )
どちらも 1 が表示される。
変数の大文字小文字は区別されない。
@synctam
synctam / MainPage.xaml.cs
Created August 25, 2020 15:01
Windows 10 OCR のテストプログラム。 This program is licensed under the GNU General Public License v3.0.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics;
@synctam
synctam / PsStitcher.cs
Last active August 14, 2020 15:32
EmguCVを使った背景除去とパノラマ合成のサンプル。 This program is licensed under the GNU General Public License.
namespace LibCoreStitcher
{
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Emgu.CV;
using Emgu.CV.Stitching;
using Emgu.CV.Structure;
using Emgu.CV.Util;
@synctam
synctam / GcaTextDetector.cs
Last active August 13, 2020 12:56
OpenCVで輪郭検出を行いテキスト領域を抽出するサンプル。 This program is released under the MIT license.
namespace LibTextDetector.TextDetector
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Emgu.CV;