Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Semper meliorem facio

Johan Bové johanbove

💭
Semper meliorem facio
View GitHub Profile
@johanbove
johanbove / ipfs-helloworld.cmd
Created Jul 12, 2021
IPFS command-line quick start on Windows cmd
View ipfs-helloworld.cmd
$ for /f %n in ('whoami') do set name=%n
$ for /f %f in ('echo "I <3 IPFS -%name%" ^| ipfs add -q') do set hash=%f
$ ipfs cat %hash%
@johanbove
johanbove / twtxt.html
Last active Jun 25, 2021
A one file Twtxt txt to HTML parser using markdown
View twtxt.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="none" />
<title>Twttxt</title>
<style>
body {
@johanbove
johanbove / web-monetization-snippet.html
Last active Jun 14, 2021
Web Monetization snippet
View web-monetization-snippet.html
<div class="row">
<div class="col-md-12">
<!-- Testing Web Monetization -->
<div id="web-monetization" style="text-align:center;margin:2em;">This site is web monetization enabled. <a href="https://webmonetization.org/" rel="noopener noreferrer" style="text-decoration:underline">Learn more about Web Monetization</a>.</p></div>
<script>
const adCode = '<p>My site is <a href="https://webmonetization.org/" rel="noopener noreferrer">web monetization</a> enabled. Please consider supporting me through <a href="https://coil.com" rel="noopener noreferrer" style="text-decoration:underline">Coil.com</a>.</p>'
function showAds () {
document.getElementById('web-monetization').innerHTML = adCode
}
@johanbove
johanbove / solokey-bash.log
Last active Mar 21, 2021
How to upgrade a SoloKey firmware
View solokey-bash.log
// See https://github.com/conorpp/solo-dicekeys/releases/tag/5.0.0
$ solo version
0.0.27
$ python3 --version
Python 3.9.0
$ solo ls
:: Solos
208B31985653: Solo 4.1.1
~ $ pip3 install --upgrade solo-python
Requirement already satisfied: solo-python in /usr/local/lib/python3.9/site-packages (0.0.27)
@johanbove
johanbove / coilMetaTagRemover
Last active Feb 9, 2021
You have a coil.com web monitization tag in the head of your site and you don't want to send yourself money, use this TamperMonkey script
View coilMetaTagRemover
// ==UserScript==
// @name coilMetaTagRemover
// @namespace http://johanbove.info/
// @version 2.0
// @description Removes my own Coil meta tag
// @author Johan Bové
// @include /johanbove.info
// @run-at document-body
// ==/UserScript==
View ie11-feature-detection.js
// @see https://stackoverflow.com/questions/17907445/how-to-detect-ie11
if (!('MSInputMethodContext' in window)) {
console.log('This is not IE11');
} else {
console.log('This is IE11!');
}
@johanbove
johanbove / weather.py
Last active Feb 6, 2020
Weather Python
View weather.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib, json, datetime
url = "https://johanbove.info/weather.php?key="
response = urllib.urlopen(url)
data = json.loads(response.read())
# Expects this json object:
# `{u'temp': 16.5, u'rain': {u'intensity': 0.1166, u'probability': 0.11}, u'humidity': 0.89, u'pressure': 1010.76, u'location': {u'lat': 51.23, u'lon': 6.78}, u'wind': {u'speedKPH': 4.89, u'windSpeed': 4.89, u'windGust': 4.89, u'dir': u'SSW', u'windBearing': 203}, u'desc': u'Overcast'}`
@johanbove
johanbove / taskwarrior_publish.sh
Created Dec 4, 2019
Publish TaskWarrior to JSON
View taskwarrior_publish.sh
function task_export () {
task +ACTIVE project:Plans export > ~/task-active.json
task +READY project:Plans export > ~/task-ready.json
task end.after:today-qtr project:Plans export > ~/task-completed.json
theDate=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "{ \"updated\": \"${theDate}\" }" > ~/task-meta.json
scp -i $sshkey ~/task-active.json ~/task-ready.json ~/task-completed.json ~/task-meta.json $remote_login:$remote_private_html/
}
@johanbove
johanbove / el-debug.vue
Last active Jun 13, 2019
el-debug component
View el-debug.vue
<template>
<el-debug />
</template>
<script>
export default {
components: {
'el-debug': {
template: `<pre style="font-size: 12px;max-height: 200px;overflow:auto;">
mode: {{ $parent.mode }}
@johanbove
johanbove / .htaccess
Created May 23, 2019
Content-security-policy for my Known site including Twitter domains
View .htaccess
# Content-Security-Policy (CSP)
<IfModule mod_headers.c>
Header set Content-Security-Policy: "default-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self' https://www.brid.gy https://indieauth.com/ https://monocle.p3k.io/ https://aperture.p3k.io https://syndication.twitter.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://publish.twitter.com https://platform.twitter.com https://cdn.syndication.twimg.com; object-src 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://platform.twitter.com; img-src https:; media-src *; worker-src 'self' https; font-src *; connect-src 'self' https://publish.twitter.com; frame-src 'self' https://platform.twitter.com https://syndication.twitter.com/; script-src-elem 'self' https://cdn.syndication.twimg.com"
Header set X-Content-Security-Policy: "default-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self' https://www.brid.gy https://indieauth.com/ https://monocle.p3k.io/ https://aperture.p3k.io https