Skip to content

Instantly share code, notes, and snippets.

@amoe
amoe / preventsleep.c
Created March 15, 2024 13:27
Prevent sleep on Mac
#import <IOKit/pwr_mgt/IOPMLib.h>
// build with:
// clang -framework IOKit -framework Foundation preventsleep.c -o preventsleep
int main(int argc, char** argv) {
// kIOPMAssertionTypeNoDisplaySleep prevents display sleep,
// kIOPMAssertionTypeNoIdleSleep prevents idle sleep
// reasonForActivity is a descriptive string used by the system whenever it needs
@amoe
amoe / figshare_categories.out
Created June 13, 2023 07:06
Figshare categories (2023-06-13)
23818 Agricultural biotechnology diagnostics (incl. biosensors)
23821 Agricultural marine biotechnology
23824 Agricultural molecular engineering of nucleic acids and proteins
23827 Genetically modified animals
23830 Genetically modified field crops and pasture
23833 Genetically modified horticulture plants
23836 Genetically modified trees
23839 Livestock cloning
23842 Non-genetically modified uses of biotechnology
23845 Transgenesis
@amoe
amoe / linode-support.diff
Created September 2, 2021 07:13
Linode support for ddclient (updated for Debian bullseye package 3.9.1-7)
--- a/ddclient
+++ b/ddclient
@@ -764,6 +764,16 @@
$variables{'service-common-defaults'},
),
},
+ 'linode' => {
+ 'updateable' => undef,
+ 'update' => \&nic_linode_update,
+ 'examples' => \&nic_linode_examples,
@amoe
amoe / fmpdump2.log
Created February 8, 2021 08:56
fmpdump with partial results
== 7732 -> [ BLOCK 7733 ] -> 7734 ==
[ Len: 4076 ]
-- PUSH 0x20 [ 0x04 ] --
-- PUSH 0x20 [ 0x05 ] --
-- PUSH 0x20 [ 0x43 ] --
-- PUSH 0x20 [ 0x0A ] --
[4].[5].[67].[10].
-- field (0x1E): "[fZ>Yc" => "ZYXÉPZZZ[" --
-- field (0x1E): "[f[Û[¾" => "ZYXÏâZZZ[" --
-- field (0x1E): "[f^U[²" => "ZYXÏçZZZ[" --
@amoe
amoe / block7732.dump
Created February 5, 2021 16:16
Block dumps from fmp file
01e34000: 0000 0000 0000 1e32 0000 1e35 0000 03fd .......2...5....
01e34010: 0e92 50d3 2004 2005 2043 200a 3806 0054 ..P. . . C .8..T
01e34020: 0025 009e 1e06 01ea 006c 0245 0900 0302 .%.......l.E....
01e34030: 923b 0000 0001 1e06 01ec 006c 0286 0900 .;.........l....
01e34040: 0302 924b 0000 0001 1e06 01ec 0207 028c ...K............
01e34050: 0900 0302 9251 0000 0001 1e06 01ed 006c .....Q.........l
01e34060: 022f 0900 0302 9237 0000 0001 1e06 01f6 ./.....7........
01e34070: 006c 0272 0900 0302 9247 0000 0001 1e06 .l.r.....G......
01e34080: 0204 006c 0261 0900 0302 92ae 0000 0001 ...l.a..........
01e34090: 1e06 0204 008c 0262 0900 0302 92af 0000 .......b........
== 7732 -> [ BLOCK 7733 ] -> 7734 ==
[ Len: 4076 ]
-- PUSH 0x20 [ 0x04 ] --
-- PUSH 0x20 [ 0x05 ] --
-- PUSH 0x20 [ 0x43 ] --
-- PUSH 0x20 [ 0x0A ] --
[4].[5].[67].[10].
-- field (0x1E): "[fZ>Yc" => "ZYXÉPZZZ[" --
-- field (0x1E): "[f[Û[¾" => "ZYXÏâZZZ[" --
-- field (0x1E): "[f^U[²" => "ZYXÏçZZZ[" --
@amoe
amoe / linode-support.diff
Created July 4, 2020 10:03
linode support patch for ddclient current to debian buster 3.8.3-1.1
--- a/ddclient
+++ b/ddclient
@@ -646,6 +646,16 @@
$variables{'service-common-defaults'},
),
},
+ 'linode' => {
+ 'updateable' => undef,
+ 'update' => \&nic_linode_update,
+ 'examples' => \&nic_linode_examples,
@amoe
amoe / omeka-s-uv-iiif-pdf-ssl.patch
Created June 15, 2020 08:00
Omeka-S IIIF Server module patch to force SSL on PDF URLs in Universal Viewer
diff -ruN IiifServer-3.5.16.orig/IiifServer/src/View/Helper/IiifManifest.php IiifServer-3.5.16/IiifServer/src/View/Helper/IiifManifest.php
--- IiifServer-3.5.16.orig/IiifServer/src/View/Helper/IiifManifest.php 2020-05-25 11:35:28.000000000 +0100
+++ IiifServer-3.5.16/IiifServer/src/View/Helper/IiifManifest.php 2020-06-15 08:47:35.503831538 +0100
@@ -320,7 +320,7 @@
case 'application/pdf':
$render = [];
- $render['@id'] = $media->originalUrl();
+ $render['@id'] = $this->view->iiifForceBaseUrlIfRequired($media->originalUrl());
$render['format'] = $mediaType;
Downloading template "new-template" to create project "morse" in morse/ ...
The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/amoe/.stack/config.yaml, like this:
templates:
params:
author-email: value
author-name: value
category: value
copyright: value
@amoe
amoe / post.py
Last active November 7, 2020 03:54
Omeka-S post item with attached media using API
import requests
import json
import pprint
# Translated from https://forum.omeka.org/t/example-api-usage-using-curl/8083,
# the work of user 'kgoetz'. Thanks.
# Begin quote:
# > The API permits anonymous access to public resources (i.e., reading non-private
# > data). To perform actions or view data that only logged-in users can access,