Skip to content

Instantly share code, notes, and snippets.

View schlunsen's full-sized avatar
🏠
Working from home

Rasmus Schlünsen schlunsen

🏠
Working from home
  • Barcelona - Spain
View GitHub Profile
@2200913
2200913 / APDS9930.cpp
Last active May 1, 2023 13:46
TAMAGOTCHI - Embedded Systems Project 2200913 2222947 IPLEIRIA
/**
* @file APDS-9930.cpp
* @brief Library for the SparkFun APDS-9930 breakout board
* @author Shawn Hymel (SparkFun Electronics)
*
* @copyright This code is public domain but you buy me a beer if you use
* this and we meet someday (Beerware license).
*
* This library interfaces the Avago APDS-9930 to Arduino over I2C. The library
* relies on the Arduino Wire (I2C) library. to use the library, instantiate an
@caniko
caniko / README.md
Last active May 10, 2024 18:57
My way of integrating poetry to docker container

Poetry docker integration

I landed on using archlinux as my base image. I use chaoti-aur to install the latest poetry from git, I can choose the exact Python version I want thanks to pyenv (made it conveniant by adding this as an env var, PYTHON_VERSION).

You can install your poetry package after copying it to your WORKDIR by poetry install --no-dev. Flush the poetry cache by poetry cache clear --all; no neat way to do this yet #887.

Advantages of archlinux + poetry in containarized production

  • Installing poetry through pacman installs the poetry as root. Poetry installer is rootless by default, which is not production-friendly; it is now! Don't forget to switch to a user wihtout write-access to root! Otherwise, you won't benefit from this safety feature.
  • Separation of Python used for production code, and poetry code. Poetry will run on the latest stable version of Python, while production code will run on whatever version it was designed for.
  • Less maintanance of `dockerf
@dedsm
dedsm / timescale--db--backend--base.py
Last active April 24, 2024 14:15
WeRiot Django Timescale integration
import logging
from django.contrib.gis.db.backends.postgis.base import \
DatabaseWrapper as PostgisDBWrapper
from django.db import ProgrammingError
from .schema import TimescaleSchemaEditor
logger = logging.getLogger(__name__)
@eolant
eolant / Confirm.vue
Last active March 23, 2024 08:48
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>
@joakimsk
joakimsk / overpass_find_boundaries_for_lebanon_lvl4.js
Created January 29, 2018 13:44
Overpass Turbo query to find boundaries on admin level 4 from OSM data
/* overpass-turbo: Find all boundaries for Lebanon on admin_level 4 */
{{geocodeArea:"LB"}}->.a;
(
relation["boundary"="administrative"]["admin_level"="4"](area.a);
);
/*added by auto repair*/
(._;>;);
/*end of auto repair*/
out;
@cgmartin
cgmartin / vera_auth_test.sh
Last active March 22, 2023 19:43
Vera Auth Sessions Example
#!/bin/bash
set -e
command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq but it's not installed (see: https://stedolan.github.io/jq/). Aborting."; exit 1; }
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed (see: https://curl.haxx.se/). Aborting."; exit 1; }
# Auth API Notes: http://forum.micasaverde.com/index.php/topic,24942.45.html
# New Server domains listing: http://forum.micasaverde.com/index.php/topic,25859.0.html
# Example implementations:
# https://github.com/rickbassham/vera/blob/master/vera_test.py
# https://github.com/amg0/ALTUI/blob/master/Remote/VeraloginAction.php
<script src="https://npmcdn.com/vue@next/dist/vue.js"></script>
<script src="https://npmcdn.com/vuex@next"></script>
<div id="app">
{{ count }}
<button @click="increment"> + </button>
<button @click="decrement"> - </button>
</div>
<script>
@victorneo
victorneo / Streaming Replication
Created December 16, 2013 04:22
Streaming replication for PG 9.1
Taken from http://www.rassoc.com/gregr/weblog/2013/02/16/zero-to-postgresql-streaming-replication-in-10-mins/
# Create replicator user
sudo -u postgres psql -c "CREATE USER replicator REPLICATION LOGIN ENCRYPTED PASSWORD 'thepassword';"
# postgresql.conf
listen_address = # make sure we're listening as appropriate
wal_level = hot_standby
@bgerm
bgerm / barman_setup.md
Created June 19, 2013 14:49
Likely outdated instructions on how to do PostgreSQL 9.1 logical and physical backups on Ubuntu. No guarantees for production use. This was for experimenting with barman and postgres backups.

PostgreSQL Barman Backups

Install PostgreSQL and the Barman dependencies

On the Barman server

sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 python-dev python-pip vim
sudo pip install argh psycopg2 python-dateutil==1.5

Setup the Barman user