Skip to content

Instantly share code, notes, and snippets.

View alvesvaren's full-sized avatar

Alve Svarén alvesvaren

View GitHub Profile
@alvesvaren
alvesvaren / text_wrap.cpp
Created January 29, 2024 13:36
Text wrapping for the esphome display api
#include <vector>
#include <string>
#include <sstream>
#include "esphome/components/display/display_buffer.h"
#include "text_wrap.h"
using namespace esphome;
using namespace esphome::display;
void wrap_text(DisplayBuffer* it, int x, int y, const char* text, Font* font, TextAlign align, float line_height) {
@alvesvaren
alvesvaren / ahtx0.h
Created May 21, 2023 17:01
ESPHome AHT20 Temperature and humidity custom component config using Adafruits AHTX0 library
// Put this in the ESPHome folder in your home assistant configuration
#include "esphome.h"
#include <Wire.h>
#include "Adafruit_AHTX0.h"
#define TAG "ahtx0"
class AHTX0Sensor : public PollingComponent {
@alvesvaren
alvesvaren / Schoolsoft-betygssak.user.js
Last active May 22, 2022 13:26
Räkna ut jämförelsetal för uppskattade betyg i schoolsoft
// ==UserScript==
// @name Betygsak
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Räknar ut faktiskt jämförelsetal efter uppskattade betyg i pågående kurser
// @author Alve Svarén
// @match https://sms.schoolsoft.se/nti/jsp/student/right_student_course.jsp?menu=course
// @icon https://www.google.com/s2/favicons?domain=schoolsoft.se
// @grant none
// ==/UserScript==
@alvesvaren
alvesvaren / README.md
Last active April 19, 2022 06:50
Python 3 script to convert Dashlane csv-export to Bitwarden importable csv

Dashlane web export to bitwarden vault

I have only tested it on linux but it should work on windows+macos too.

To use:

  1. Make sure python 3 is installed
  2. Export the data from dashlane by visiting the web app, then pressing "My account" > "Settings" > "Export Data"
  3. Unzip the .zip-file downloaded from dashlane
  4. Download this script and put it in the same folder as the unzipped dashlane files
  5. Open a terminal in the folder where the csv-file is located
@alvesvaren
alvesvaren / auto-cert.sh
Last active November 5, 2021 17:28
install wings
#!/bin/bash
apt-get update && apt-get install -y certbot
certbot certonly --standalone --email $EMAIL -nd $DOMAIN
@alvesvaren
alvesvaren / updatefans.sh
Last active November 4, 2023 18:20 — forked from fragtion/fanspeeds.sh
Dell R710 (and possibly other) temperature-based fan speeds script
#!/bin/bash
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed too high send the raw IPMI command to enable dynamic fan control.
#
# Also get CPU temps from lm-sensors and adjust fan speeds according to defined
# speed % which should be set according to your needs (each CPU model will vary)
#
# Requires:
# ipmitool – apt install ipmitool
@alvesvaren
alvesvaren / library.c
Created November 28, 2020 18:53
Run C code from python
#include <stdio.h>
void say(char* message)
{
printf(message);
printf("\n");
}
int sum(int num1, int num2) {
return num1 + num2;
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
" ##############..... ##############
" ##############......##############
" ##########..........##########
" ##########........##########
" ##########.......##########
" ##########.....##########..
" ##########....##########.....
" ..##########..##########.........
" ....##########.#########.............
" ..################JJJ............
" VIM CONFIG
set nu
execute pathogen#infect()
colorscheme dracula
" sudo write