Skip to content

Instantly share code, notes, and snippets.

View philippkeller's full-sized avatar

Philipp Keller philippkeller

View GitHub Profile
@philippkeller
philippkeller / rotate.jsx
Created March 12, 2023 17:37
Part of howto.philippkeller.com blog post
<svg onClick={handleRotateLeft} img-id={file} className='h-5' viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M303.36 363.733333l-60.373333-60.373333c-38.4 49.493333-62.08 106.666667-69.333334 165.973333h86.186667c6.186667-37.333333 20.693333-73.386667 43.52-105.6zM259.84 554.666667H173.653333c7.253333 59.306667 30.933333 116.48 69.333334 165.973333l60.373333-60.373333A254.08 254.08 0 0 1 259.84 554.666667z m43.093333 4 68.693333v-86.186666c-37.333333-6.186667-73.173333-20.906667-105.173333-43.733334l-61.226667 61.226667zM554.666667 173.653333V42.666667l-194.133334 194.133333L554.666667 426.666667v-166.826667c120.96 20.266667 213.333333 125.44 213.333333 252.16s-92.373333 231.893333-213.333333 252.16v86.186667c168.32-21.12 67 194.773333 554.666667 173.653333z" />
</svg>
<svg onClick={handleRotateRight} img-id={file} className='h-5 mx-4' viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M663.466667 236.8L469.333333 42.666667v130.986666
@philippkeller
philippkeller / SortableComponent.jsx
Created March 12, 2023 17:17
for howto.philippkeller.com blogpost
import React from 'react';
import {useSortable} from '@dnd-kit/sortable';
import {CSS} from '@dnd-kit/utilities';
export function SortableItem(props) {
const {
attributes,
listeners,
setNodeRef,
transform,
@philippkeller
philippkeller / LoadingAnimation.jsx
Created March 12, 2023 16:44
Used in howto.philippkeller.com blogpost
export default function LoadingAnimation({ className }) {
return (
<div role="status">
<svg aria-hidden="true" className={`mr-2 text-gray-200 animate-spin dark:text-gray-600 ${className}`} viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor" />
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
// to generate this, locate font_awesome_flutter.dart in console, and then:
// awk '
// /IconData/ && !skip { print }
// { skip = /Deprecated/ }
// ' font_awesome_flutter.dart | rg -o 'static const IconData ([^ ]+)' -r ' "$1": FontAwesomeIcons.$1,' | nocolor > /tmp/fa.txt
/// Icon data map for FontAwesome
import 'package:http/http.dart' as http;
import 'dart:convert';
const apiKey = 'my-secret-api-key';
class Weather {
final int temp;
final int condition;
final String city;
@philippkeller
philippkeller / README.md
Created April 4, 2020 09:19
set up raspberry headless

Prepare SD Card

  • flash raspbian lite on micro sd card using etcher
  • setup wireless and ssh, desribed here

setup raspberry

  • passwd # set new password
  • set authorized keys
  • sudo raspi-config: set password, timezone, locale, enable spi
@philippkeller
philippkeller / output.txt
Created February 23, 2020 17:33
pillow-simd error
pi@raspberrypi:~/sonos-lcd $ pip3 install -U --force-reinstall pillow-simd
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pillow-simd
Using cached https://files.pythonhosted.org/packages/a0/6a/30d21c886293cca3755b8e55de34137a5068b77eba1c0644d3632080516b/Pillow-SIMD-7.0.0.post3.tar.gz
Building wheels for collected packages: pillow-simd
Running setup.py bdist_wheel for pillow-simd ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-c7i2f9uv/pillow-simd/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\
n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-7fv32_j6 --python-tag cp37:
running bdist_wheel
running build
@philippkeller
philippkeller / ms-regionen.md
Last active May 14, 2020 15:03
How to upload MS-Regionen of Switzerland to Metabase
@philippkeller
philippkeller / flatten.py
Created October 18, 2018 10:03
flatten json using flatten_json
#!/usr/bin/env python3
import flatten_json
import sys
import json
if __name__ == '__main__':
if len(sys.argv) < 3:
print(f'usage: {sys.argv[0]} in.csv out.csv')
f_out = open(sys.argv[2], 'w')

Getting Started With Superset: Airbnb’s data exploration platform

These instructions are for Amazon Linux Version 2

Update Python and PIP versions on EC2 (Amazon AMI)

sudo yum update -y
sudo yum install python3 -y