Skip to content

Instantly share code, notes, and snippets.

@atarp
atarp / kepler22.R
Last active May 17, 2022 21:21
New Version of Kepler
# years ago I found the original version on R-Bloggers:
# https://www.r-bloggers.com/2014/04/hazardous-and-benign-space-objects-getting-the-data/
# Now the number of NEA-Objekts in the MPC database has doubled an they provide the date
# in different formats
library(tidyverse)
neafile<-"nea.txt"
classes<-c(
"Atira",
"Aten",
"Apollo",
@atarp
atarp / ugee_connet.py
Last active February 12, 2022 16:12
How to connect UGEE M708 graphcs tablet to Dell Latitude D830 under Ubuntu 20.04 using multiple displays
'''
when I plug in the tablet and move the pen above it the mouse coursor immediately jumps to the wrong display
and stays there regardless of what I was trying
the original driver software from ugee doesn't work either, of course...
xsetwacom list devices shows no devices
first I installed the driver as described here:
https://github.com/DIGImend/digimend-kernel-drivers
reboot doesn't hurt
@atarp
atarp / start_file_transfer.sh
Created February 6, 2022 11:32
File Transfer to ancient Win95 Laptop via serial connection
#!/bin/bash
# On the W95 client start Hyperterminal and configure COM1: to 115200 Baud 8N1 no handshake
# from the menue choose 'receive files' and select ZMODEM and the desired destination folder
# on linux start
picocom -b 115200 -s "sz -vv" /dev/ttyS0
# press ctrl-A ctrl-S to open a file dialog ***file: and select the file to transmit
# to leave picocom type ctrl-A ctrl-S
## possible pitfalls:
## to avoid permission dinied error or starting picocom as root
## sudo usermod -a -G dialout username
@atarp
atarp / smart.sh
Last active January 15, 2022 12:43
Bash script to read data from PPC Smart Meter Gateway Customer Interface (SMGW) via the HAN interface
#!/bin/bash
curl -kis 'https://192.168.1.200/cgi-bin/hanservice.cgi' --digest -u 12345678:secret -o res.txt
cookies="session=$(cat res.txt|\
sed -e "s/[<,>,']//g" -e "s/=/\n/g"|\
grep -A 1 "session"|tail -n 1|cut -d ';' -f 1
token=$(cat res.txt|sed -e "s/[<,>,']//g" -e "s/=/\n/g"|\
grep -A 1 "tkn value"|tail -n 1|cut -d ' ' -f 1)
data="tkn=$token&action=meterform"
@atarp
atarp / smart.py
Last active September 5, 2024 09:21
Python script to read data from PPC Smart Meter Gateway Customer Interface (SMGW) via the HAN interface
#!/usr/bin/env python3
import requests, base64
from requests.auth import HTTPDigestAuth
from bs4 import BeautifulSoup
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
user= '12345678'
password = 'secret'
#define LED 0 //D2=pin 7 D1=pin6 D0=pin5
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH);
delay(1000);
# encrypt file to_encrypt with simple ecb mode
openssl enc -in to_encrypt -out encrypted -e -aes-256-ecb \
-K 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
# decrypt the file encrypted
openssl enc -in encrypted -out restored -d -aes-256-ecb \
-K 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
@atarp
atarp / yuca.plt
Last active June 20, 2021 09:29
testing yuca
set xdata time
set timefmt "%d.%m.%Y %H:%M"
set format x "%H:%M"
plot 'yuca.dat' u 1:3 w l, '' u 1:3 w p ps 2