Skip to content

Instantly share code, notes, and snippets.

Avatar

Frank Meeuwsen frankmeeuwsen

View GitHub Profile
View MarkdownDummerToWordPress.js
Markdown to WordPress
if(op.attributes.exists("type") && op.attributes.getOne("type")=="outline"){
var wp_post = opml.parse(op.getCursorOpml());
var title = wp_post.opml.head.title;
var text = "";
var imagepart="";
for (i=0;i<wp_post.opml.body.subs[0].subs.length;i++){
if(wp_post.opml.body.subs[0].subs[i].image !==undefined){
var imagepart="![]("+string.multipleReplaceAll(wp_post.opml.body.subs[0].subs[i].image,{" ":"%20"})+")";
text=text+imagepart;
View getHour.js
GetHour
var d = op.attributes.getOne("created");
dialog.alert(d);
dialog.alert (string.formatDate (d, "%Y/%m/%d/%H%M%S.html"));
@frankmeeuwsen
frankmeeuwsen / getURL.js
Created Nov 13, 2021
Get URL based on date and time
View getURL.js
GetURL
var d = op.attributes.getOne("created");
dialog.alert (string.formatDate (d, "%Y/%m/%d/%H%M%S.html") + ".");
var makeURL = "http://oldschool.scripting.com/frankmeeuwsen/"+string.formatDate (d, "%Y/%m/%d/%H%M%S.html");
webBrowser.openUrl (makeURL)
console.log (makeURL)
View sendToWordPress.js
if(op.attributes.exists("type") && op.attributes.getOne("type")=="outline"){
var wp_post = opml.parse(op.getCursorOpml());
var title = wp_post.opml.head.title;
var text = "";
var imagepart="";
for (i=0;i<wp_post.opml.body.subs[0].subs.length;i++){
if(wp_post.opml.body.subs[0].subs[i].image !==undefined){
var imagepart="<p><img src='"+wp_post.opml.body.subs[0].subs[i].image+"'></p>";
text=text+imagepart;
}
View imagebrowserinDrummer.js
s3images=JSON.parse(http.readUrl("https://s3link/to/your/logfile.json",true));
var allimages="";
console.log(s3images);
for (i=0;i<s3images["actions"].length;i++){
console.log(s3images["actions"][i]["url"]);
if(s3images["actions"][i]["url"] !== undefined && s3images["actions"][i]["url"].substring(0,8) === 'https://'){
var link=s3images['actions'][i]['url'];
var html="<img class='s3images' src='"+link+"' onclick='prompt(\"copy\",\""+link+"\");' >";
allimages=allimages+html;
};
@frankmeeuwsen
frankmeeuwsen / time-lapse.py
Created Feb 6, 2021
Timelapse for the Raspberry Pi with PiCam
View time-lapse.py
from time import sleep
import picamera
from fractions import Fraction
WAIT_TIME = 60
with picamera.PiCamera() as camera:
camera.framerate = Fraction(1, 6)
camera.shutter_speed = 6000000
camera.iso = 800
camera.exposure_mode = 'night'
View time-lapse.py
from time import sleep
import picamera
import picamera
from time import sleep
from fractions import Fraction
WAIT_TIME = 60
with picamera.PiCamera() as camera:
camera.framerate = Fraction(1, 6)
View linkedin-unfollow-everyone.js
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
@frankmeeuwsen
frankmeeuwsen / dtd_rssclub.php
Created Oct 6, 2019
How to get a specific text at a specific category in your WordPress feed
View dtd_rssclub.php
function dtd_rssclub($content) {
global $wp_query;
$postid = $wp_query->post->ID;
if(is_feed() && has_category('RSS-Club', $postid) ) {
$content = '<div>Dit is een geheim bericht voor iedereen. <a href="/rss-club">Lees alles over de RSS Club</a></div><br /><br />'.$content;
}
else {
$content = $content;
}
return $content;
View feedfile.js
const reader = require ("davereader");
const utils = require ("daveutils");
const fs = require ("fs");
const readerDataFolder = "reader_data/";
const myOutputFolder = "myOutputFolder/";
var config = {
flHttpEnabled: false,
flWebSocketEnabled: false,