UserScripts
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
| #!/usr/bin/env python3 | |
| # | |
| # warpmail.py | |
| # | |
| # Downloads last month's charging log from WARP3 as PDF via http API and sends it via email. | |
| # | |
| # Crontab example: | |
| # 0 5 1 * * /home/me/warpmail.py >/dev/null 2>&1 | |
| # | |
| # Configuration is done in /etc/smtpclient.ini or ~/.smtpclient.ini as follows: |
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
| /* primary key autoincrement syncing across tables */ | |
| /* fids table: holds all primary keys of synced tables */ | |
| DROP TABLE IF EXISTS fids; | |
| CREATE TABLE fids ( | |
| fid INTEGER PRIMARY KEY AUTOINCREMENT, | |
| rel TEXT NOT NULL | |
| ); | |
| /* fids table trigger: updates the autoincrement sequence number of synced tables */ |
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
| -- Shotwell photo.db SQLITE VIEW to query by tag_name | |
| -- | |
| -- Usage after creating the view: | |
| -- SELECT * from v_tagged_photos WHERE tag_name LIKE '%slo%'; | |
| -- | |
| -- (the view is as hellish as the db layout of Shotwell) | |
| -- | |
| -- thx @ https://gist.github.com/ChiChou/97a53caa2c0b49c1991e?permalink_comment_id=4721301#gistcomment-4721301 | |
| -- thx @ https://stackoverflow.com/questions/46483859/split-values-in-parts-with-sqlite |
a block with length 0.35m, width 0.25m, height 0.35m weighs 12kg. How deep does it sink in sea water?
To determine how deep the block sinks in sea water, we need to consider the buoyant force acting on the block and compare it to the weight of the block.
The buoyant force is equal to the weight of the water displaced by the block. In this case, the block is submerged in sea water, which has a density of approximately 1,025 kg/m³.
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
| """ | |
| Written by GPT3 from this English prompt (with one tweak to the prompt, to get | |
| the timestamp parameter to not error out, and PEP8 fixes): | |
| ---- | |
| 1. Open a sqlite database with a name like `2022-07-17 17.48.19.db` or | |
| `2021-04-11 08.44.16.db` | |
| 2. Inside is a table called `locations`, with headers [LOCTYPE INTEGER, | |
| TIMESTAMP BIGINT, LATITUDE REAL, LONGITUDE REAL,ALTITUDE REAL, ACCURACY |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <sys/ipc.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| void touch(char *file_name) { | |
| FILE *fp; | |
| if ((fp = fopen(file_name, "w")) == NULL) { |
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
| candump -t A can0 | sed -e 's/ (.* \(.*\)\.\(...\).*) *can. *\([0-9A-F]*\) *\[.*\] */\1.\2 R \3 /g' -e 's/[\r\n]*$/\r/' | nc -l -p 1457 2>&1 | sed -u -n -e 's/^\([^ ]*\) /\1#/g;s/ //g;s/\r//g;/^$/!p;' | while IFS="" read CMD ; do cansend can0 $CMD ; done | |
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
| /* | |
| NASAClipper_I2C_to_NMEA v0.5.2 | |
| Decode the NASA Clipper Data into a NMEA compatible serial string | |
| written by Peter Holtermann | |
| with additions from Victor Klein | |
NewerOlder