Winter CMS
Ich hab gerade ein altes Python Script gefunden mit dem ich auf meinem Raspberry Pi via der CLI Webseiten URLS nach vorhandenen RSS feeds absuche. In einem simplen Array hau ich die Top Level Domains rein und als naechstes wird eine CSV Datei erzeugt mit allen gefundenen Feed URLS. Vielleicht setze ich das mal als online tool oder Electron app um. Koennte hilfreich sein.
import csv
from datetime import datetime
# Paste feed URLs here
feed_urls = [
"http://8-bit-retro-computing.blogspot.com/feeds/posts/default?alt=rss",
"http://ancientelectronics.wordpress.com/feed/",
"http://archeogaming.blogspot.com/feeds/posts/default",
"http://classic.technology/feed/",
"http://planetdestiny.com/feed/",
"http://qz.com/feed/",
"http://randoc.wordpress.com/feed/",
"http://retro-computers.eu/?feed=rss2",
"http://retro-computing.blogspot.com/feeds/posts/default?alt=rss",
"http://retro-roms.blogspot.com/feeds/posts/default?alt=rss",
"http://retroblast.com/rssfeed.php",
"http://rss.cnn.com/rss/cnn_allpolitics.rss",
"http://rss.cnn.com/rss/cnn_freevideo.rss",
"http://rss.cnn.com/rss/cnn_health.rss",
"http://rss.cnn.com/rss/cnn_latest.rss",
"http://rss.cnn.com/rss/cnn_showbiz.rss",
"http://rss.cnn.com/rss/cnn_tech.rss",
"http://rss.cnn.com/rss/cnn_topstories.rss",
"http://rss.cnn.com/rss/cnn_us.rss",
"http://rss.cnn.com/rss/cnn_world.rss",
"http://rss.cnn.com/rss/edition.rss",
"http://rss.cnn.com/rss/edition_world.rss",
"http://slashdot.org/Slashdot/slashdotMain",
"https://dusted.codes/feed/rss",
"https://engadget.com/rss.xml",
"https://eurogamer.net/feed",
"https://factcheck.org/feed/rss/",
"https://feedbin.com/starred/630a51376f6236f1db65212704980f4f.xml",
"https://feedpress.me/CoolTools",
"https://feedpress.me/the"]
timestamp = datetime.utcnow().isoformat() + "Z"
rows = []
for url in feed_urls:
# Derive a slug from the URL
slug = url.split("//")[-1].split("/")[0].replace(".", "-")
title = slug.replace("-", " ").title()
website = url.split("/feed")[0] if "/feed" in url else url.rsplit("/", 1)[0]
version = "atom" if "atom" in url else "rss"
rows.append([
timestamp, timestamp, title, slug, "en", "N/A", website, url, "true", version
])
with open("feeds.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f, quoting=csv.QUOTE_ALL)
writer.writerow(["timestamp1","timestamp2","feed_title","feed_slug","locale","description","website","feed_url","valid","version"])
writer.writerows(rows)
print("feeds.csv generated with", len(rows), "rows.")
Ich habe ein altes note-it gefunden bei dem ich die Inkscape CLI genutzt habe um Adobe Illustrator oder EPS files schneller oder via batch umzukonvertieren. Hier meine script dazu...
// BATCH AI2SVG
for file in *.ai; do inkscape "$file" --export-filename "${file%ai}svg";done
// BATCH EPS2SVG
for file in *.eps; do inkscape "$file" --export-filename "${file%eps}svg";done
// BATCH EXPORT ALS PLAIN SVG
for file in *.ai; do
inkscape "$file" --export-type=svg --export-plain-svg --export-filename "${file%ai}svg"
done
// INDIVIDUAL AI2SVG
inkscape my-file.ai --export-filename output.svg
// LOOP THROUGH WITH SCOUR OPTIMIZE SVG FILE
for file in *.ai; do
base="${file%.ai}"
inkscape "$file" --export-type=svg --export-plain-svg --export-filename "${base}_rawsvg"
scour -i "${base}_raw.svg" -o "${base}.svg" --enable-id-stripping --shorten-ids --set-precicion=3
done
Ich hab saemtliche Fotos von Whatsapp gemeinsam mit den Camera Fotos in einen Folder geschoben. Erst via XN-View geschaut ob die files via EXIF Infos in das richtige Datum umbennen kann, danach bei jenen wo es nicht klappte (Camera Zoom App und Co.) musste ich nach der Syntax YYYY-MM-DD die Datein umbennnen.
for f in *.jpg ; do
mv -v `$f` `${f::4}-${f:4:2}-${f:6:2}-${f:8}`
done
for f in *.jpeg ; do
mv -v `$f` `${f::4}-${f:4:2}-${f:6:2}-${f:8}`
done
I used this small script on a page showing a countdown to a date with the oldschool flipclock animation. As it was a multilanguage website i also added an array with several time definitions depending on the language the user has chosen. For all of this the flipdown JS library by PButcher is used.
<script>
document.addEventListener('DOMContentLoaded', () => {
switch('{{ appLanguage }}') {
case "es":
theheadings= ["Días", "horas", "minutos", "segundos"];
break;
case "en":
theheadings= ["Days", "Hours", "Minutes", "Seconds"];
break;
case "de":
theheadings= ["Tage", "Stunden", "Minuten", "Sekunden"];
break;
default:
theheadings= ["Días", "horas", "minutos", "segundos"];
}
theStartTime = parseInt( "{{ record.event_start | date('U')}}" );
console.log(theStartTime);
// Unix timestamp (in seconds) to count down to
//var twoDaysFromNow = (new Date().getTime() / 1000) + (86400 * 200) + 1;
var twoDaysFromNow = theStartTime;
var flipdown = new FlipDown(twoDaysFromNow,{
//headings: ["Nap", "Óra", "Perc", "Másodperc"]
headings: theheadings
}
).start()
.ifEnded(() => {
console.log('The countdown has ended!');
$('.flipDownContent').hide();
});
});
</script>```
Um heraus zu finden ob der Besucher einer Seite selbige mit seinem Mobiltelefon abruft, hab ich das folgende kleine Javascript entdeckt das mit dem windows.matchmedia Tag arbeitet.
<script>
$(document).ready(function(){
if(window.matchMedia("(max-width: 767px)").matches){
// The viewport is less than 768 pixels wide
alert("This is a mobile device.");
} else{
// The viewport is at least 768 pixels wide
alert("This is a tablet or desktop.");
}
});
</script>
Ich hab nicht nachgeforscht ob matchMedia neben der Seitenbreite noch weitere Daten wie Browser oder device abcheckt, aber fuer eine schnelle Umzetzung eines Check-Scripts find ich das nuetzlicher als eine ganze Library einzuladen.
Get the image mime info via PHP of an manual generated object by its ID in the array with images to show them.
<?php
$tid = $_GET['id'];
$map1 = {
1=>'2014/2014-06-28.jpg',
2=>'2014/2014-06-29.jpg',
3=>'2014/2014-06-30.jpg',
4=>'2014/hund.jpg',
5=>'2014/katze.jpg',
6=>'2014/maus.jpg'
}
$path = $map1[$tid];
$str = file_get_contents($path);
echo $str;
?>