Move the Script to a Permanent Location: Save your script (e.g., airtag_tracker.py) in a directory like /home/pi/.
chmod +x /home/user/bl/blscan.py
import math | |
def day_of_year(year, month, day): | |
""" | |
Calculate the day of year from month and day. | |
Accounts for leap years. | |
""" | |
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
if month > 2 and ((year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)): | |
month_days[1] = 29 |
""" | |
Install: | |
pip install aiohttp | |
pip install --upgrade attrs | |
Run: | |
python3 ollama_remote.py | |
""" | |
import json |
import os | |
import re | |
import sys | |
# Define the path to your Go project | |
project_path = '.' | |
# Regex patterns | |
struct_pattern = re.compile(r'type\s+(\w+)\s+struct') | |
field_pattern = re.compile(r'\s+(\w+)\s+(\w+)') # Match fields in a struct with their types |
import os | |
import re | |
import csv | |
# Define the path to your PHP project | |
project_path = '.' | |
# Regex pattern to match class methods and comments | |
class_pattern = re.compile(r'class\s+(\w+)') | |
method_pattern = re.compile(r'function\s+(\w+)\(') |
var a = function(s) { | |
var r = parseInt(s.replace(".", ""), 2); | |
console.log(s, " ->", r); | |
return r; | |
}; | |
var b = function(s) { | |
var r = (s >>> 0).toString(2); | |
console.log(s, " ->", r); | |
return r; |
# Format a stack trace and the exception information as a string | |
# | |
# Example: | |
#def a(): | |
# b() | |
# | |
# | |
#def b(): | |
# c() | |
# |
/* | |
Serve is a very simple static file server in go | |
Usage: | |
-p="8100": port to serve on | |
-d=".": the directory of static files to host | |
-f="": the static file to host | |
Navigating to http://localhost:8100 will display the index.html or directory listing file or file content. | |
*/ | |
package main |
~$ sudo apt install cgroup-tools | |
~$ sudo cgcreate -a $USER:$USER -t $USER:$USER -g memory,cpu:myscript | |
~$ sudo cgset -r memory.limit_in_bytes=$((4*1024*1024*1024)) myscript | |
# prevent process from swapping | |
~$ sudo cgset -r memory.swappiness=0 myscript | |
~$ cgexec -g memory,cpu:myscript python app.py -d .... |
curl -w " time_namelookup: %{time_namelookup} | |
time_connect: %{time_connect} | |
time_appconnect: %{time_appconnect} | |
time_pretransfer: %{time_pretransfer} | |
time_redirect: %{time_redirect} | |
time_starttransfer: %{time_starttransfer} | |
---------- | |
time_total: %{time_total}\n" -o /dev/null -s https://google.com |