접기
자세한 내용
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "brcm,bcm2835"; | |
fragment@0 { | |
target = <&spi0>; | |
__overlay__ { | |
#address-cells = <1>; | |
#size-cells = <0>; |
from pathlib import Path | |
def is_jpg(): | |
img = Path("output-2023-12-15/30661_10000000c840e868_2023-12-15_16-01-46.wav").read_bytes() | |
print("jpg" if img[0] == 0xff and img[1] == 0xd8 and img[2] == 0xff else "no jpg") | |
return True if img[0] == 0xff and img[1] == 0xd8 and img[2] == 0xff else False |
import yaml | |
from pathlib import Path | |
def get_rpi_type() -> str: | |
rev = int(yaml.safe_load(Path("/proc/cpuinfo").read_text().replace("\t", "")).get("Revision"), base=16) | |
rpi_type = (rev & 0x00000FF0)>>4 if rev & 0x800000 else [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 6, 2, 3, 6, 2][rev & 0x1f] | |
rpi_model = {0: 'A', 1: 'B', 2: 'A+', 3: 'B+', 4: '2B', 6: 'CM1', 8: '3B', 9: 'Zero', 0xa: 'CM3', 0xc: 'ZeroW', 0xd: '3B+', 0xe: '3A+', 0x10: 'CM3+', 0x11: '4B', 0x12: 'Zero2W', 0x13: '400', 0x14: 'CM4', 0x15: 'CM4S', 0x17: '5',} | |
return rpi_model.get(rpi_type, "") |
from pathlib import Path | |
import smbus | |
bus_number = 10 | |
def have_csicamera() -> bool: | |
# csi 카메라는 i2c 를 사용하므로 연결되어 있다면 /dev/i2c-10 이 존재 | |
return Path(f"/dev/i2c-{bus_number}").exists() |
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html | |
# First of all you need to have a clean clone of the source repository so we didn't screw the things up. | |
git clone git://server.com/my-repo1.git | |
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command | |
git filter-branch --subdirectory-filter your_dir -- -- all | |
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command. |
import time | |
import asyncssh | |
import asyncio | |
params = range(10) | |
async def run(): | |
async with asyncssh.connect("localhost", 8090, username="tester", password="t35t3r", known_hosts=None) as conn: | |
for param in params: | |
await conn.create_process(f"nohup very_very_long_run.sh {param} &") |
ssh pi@pi_ip_address "sudo sed -i 's/"\""au/au/' /etc/vim/vimrc" |
python3 -c 'from pathlib import Path; import yaml; print(yaml.safe_load(Path("/proc/cpuinfo").read_text().replace("\t", " ")).get("Serial"))' |
echo $(curl -s 'https://ident.me') |
자세한 내용