Skip to content

Instantly share code, notes, and snippets.

@4DA
4DA / caldav-sync.el
Created Sep 14, 2021
sync org files with caldav (one way)
View caldav-sync.el
#!/usr/bin/emacs --script
;; config
;; storing creds in authinfo
;; https://github.com/dengste/org-caldav#storing-authentication-information-in-authinfonetrc
;; MELPA and use-package stuff -------------------------------------------------
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
@4DA
4DA / sh
Last active Apr 30, 2021
Update IPFS pin
View sh
#!/bin/bash
DIR=$1
CIDFILE="$1_cid"
IPFSOPTS="--nocopy"
DNSLINK_UPDATE="~/scripts/dnslink.sh"
if [ -f $CIDFILE ]; then
CID=`cat $CIDFILE`
echo "Current CID=$CID"
else
@4DA
4DA / lora32_bat.cpp
Created Apr 10, 2021
Read battery voltage on TTGO Lora32
View lora32_bat.cpp
#include <Arduino.h>
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
const uint8_t blue = 23;
const uint8_t vbatPin = 35;
float VBAT; // battery voltage from ESP32 ADC read
void setup()
{
@4DA
4DA / goursat.js
Created Feb 16, 2021
Create triangualized Goursat surface using Mikola's isosurface lib
View goursat.js
fs = require('fs');
var isosurface = require("isosurface")
var mesh = isosurface.surfaceNets([100,100,100], function(x,y,z) {
return Math.pow(x,4) + Math.pow(y,4) + Math.pow(z,4) - 1.5 * (x*x + y*y + z*z) + 1;
} , [[-2,-2,-2], [2,2,2]])
output = "";
@4DA
4DA / cryfs-mount.el
Last active May 4, 2020
cryfs-mount
View cryfs-mount.el
(defun mount-cryfs (what where)
(setq pass (concat (read-passwd "cryfs pw: ") "\n"))
(setq process
(start-process-shell-command "cryfs" "*cryfs*"
(format "cryfs %s %s" what where)))
(process-send-string process pass)
(while (process-live-p process) (sit-for 0.1))
(eq (process-exit-status process) 0))
;; mount cryfs `cryfs-dir` to `mount-dir' and open `file'