Skip to content

Instantly share code, notes, and snippets.

@frankmeeuwsen
frankmeeuwsen / gist:43b5825a21fe17cf57045a8775f5cf64
Created February 18, 2024 09:46
Karabiner - F19 (Capslock) to Control in Emacs
{
"description": "F19 (Capslock) to Control in Emacs",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^org\\.gnu\\.Emacs$"
],
"type": "frontmost_application_if"
@frankmeeuwsen
frankmeeuwsen / gist:0d0e6c7d0fb18f33b5b85f8f1851888b
Created January 21, 2024 10:24
Dataview to get a list of files that are updated in the last 7 days
```dataview
TABLE file.name, file.ctime AS "Created"
WHERE file.ctime >= date(<% tp.date.now("YYYY-MM-DD", -7) %>) and file.ctime < date(<% tp.date.now("YYYY-MM-DD") %>)
sort file.ctime
```
@frankmeeuwsen
frankmeeuwsen / dataview
Created January 21, 2024 10:17
Dataview to get the output under a specific heading in your notes
```dataview
TABLE L.text AS "Articlelist"
FROM #weeknotes
FLATTEN file.lists as L
WHERE meta(L.section).subpath = "Articles"
SORT file.ctime DESC
LIMIT 25
```
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;
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 November 13, 2021 08:30
Get URL based on date and time
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)
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;
}
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 February 6, 2021 21:52
Timelapse for the Raspberry Pi with PiCam
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'
@frankmeeuwsen
frankmeeuwsen / time-lapse.py
Created February 6, 2021 21:46
time-lapse on the pi
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)