Skip to content

Instantly share code, notes, and snippets.

View johanbove's full-sized avatar
💭
Semper meliorem facio

Johan Bové johanbove

💭
Semper meliorem facio
View GitHub Profile
@johanbove
johanbove / ie11-feature-detection.js
Created January 29, 2020 15:45
IE11 feature detection
// @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 February 6, 2020 13:19
Weather Python
#!/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 December 4, 2019 22:13
Publish TaskWarrior to JSON
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 June 13, 2019 12:06
el-debug component
<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 09:01
Content-security-policy for my Known site including Twitter domains
# 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
@johanbove
johanbove / style.site.css
Last active May 24, 2019 16:25
Known stylesheet
body {
background: #1a2835;
color: #d5d5d5;
font-family: asap, sans-serif;
}
p {
margin-bottom: 15px;
}
@johanbove
johanbove / holidays.de-DE.rc
Created May 13, 2019 08:56
Germany TaskWarrior holidays
###############################################################################
# International Holiday Data provided by Holidata.net
# http://holidata.net/de-DE/2015.json
# http://holidata.net/de-DE/2016.json
#
# Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@johanbove
johanbove / .taskrc
Created May 13, 2019 08:54
taskwarrior configuration
# [Created by task 2.5.1 2/8/2017 11:13:16]
# Taskwarrior program configuration file.
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
# 'man task-sync' or 'man taskrc'
# Here is an example of entries that use the default, override and blank values
# variable=foo -- By specifying a value, this overrides the default
# variable= -- By specifying no value, this means no default
# #variable=foo -- By commenting out the line, or deleting it, this uses the default
@johanbove
johanbove / on-exit_git.py
Created May 10, 2019 08:43 — forked from wbsch/on-exit_git.py
Proof of concept for a Taskwarrior on-exit hook that manages a git repository in ~/.task
#!/usr/bin/env python
#
# PoC: Manage a git repository in ~/.task that gets updated on changes.
# Only pending.data and completed.data are included by default.
# You can use "git add" to add whatever files you want to track in your
# task folder.
#
# Inspired by https://gist.github.com/Unode/9366218
#
# Works with any Taskwarrior version that supports hooks.
@johanbove
johanbove / latin-phrases.md
Last active March 21, 2019 22:15
Inspiring Latin Phrases

Whilst Latin is considered dead language in modern times, there was a period in history where it dominated the writings, art, scriptures and minds of some of the most powerful and intellectual individuals on the planet.

From Rome & beyond, Latin was used to educate and control the masses. These days, the closet you'll get to hearing Latin in person is via the current incarnations of the clergy and Vatican, both of whom love to quote & reference the annals of history.

With that in mind, here's 40 wise and enlightening Latin phrases, designed to inspire and give you food for thought. Centuries on, there's still some thought-provoking pearls of wisdom to be shared - and a few giggles as well.

  1. Amicitiae nostrae memoriam spero sempiternam fore - Cicero
    “I hope that the memory of our friendship will be everlasting.”

  2. Vestis virum reddit - Quintilianus