Skip to content

Instantly share code, notes, and snippets.


Marco Pfeiffer Nemo64

View GitHub Profile
Nemo64 / SmoothAdc.h
Last active Apr 8, 2021
A class to take multiple samples of the ESP32 ADC
View SmoothAdc.h
#pragma once
#include <driver/adc.h>
template<adc1_channel_t... PINS>
class SmoothAdc {
const adc1_channel_t pins[sizeof...(PINS)] = {PINS...};
volatile uint32_t results[sizeof...(PINS)] = {};
uint16_t reads[sizeof...(PINS)][256] = {};
uint8_t position = 0;
Nemo64 / doctrine_live_tempaltes.xml
Created Mar 29, 2021
Live templates for common doctrine fields
View doctrine_live_tempaltes.xml
<template name="bool:default" value="/**&#10; * @var bool&#10; * @ORM\Column(type=&quot;boolean&quot;, options={&quot;default&quot;: $default$})&#10; */&#10;private bool $$$name$ = $default$;&#10;&#10;$END$&#10;&#10;public function is$method$(): bool&#10;{&#10; return $this-&gt;$name$;&#10;}&#10;&#10;public function set$method$(bool $$$name$): void&#10;{&#10; $this-&gt;$name$ = $$$name$;&#10;}" description="boolean column" toReformat="false" toShortenFQNames="true">
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="default" expression="enum(&quot;false&quot;, &quot;true&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="method" expression="capitalize(name)" defaultValue="" alwaysStopAt="false" />
<option name="PHP Class Member" value="true" />
<template name="bool:nullable" value="/**&#10; * @var bool|null&#10; * @ORM\Column(type=&quot;boolean&quot;, nullable=true)&#10; */&#10;private ?bool $$$name$ = nul
View StopwatchCompilerPass.php
namespace App\Service;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
Nemo64 / main.cpp
Created Mar 15, 2021
Untested way of disabling power management of an esp32
View main.cpp
#include <Arduino.h>
#include <esp_pm.h>
void setup()
esp_pm_lock_handle_t powerLock;
if (esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "", &powerLock) != ESP_OK) {
Nemo64 / main.cpp
Last active Feb 20, 2021
This is a test sketch to read voltages using an esp32.
View main.cpp
// This sketch shows how to read voltages from an esp32
// Your ESP has to be manufactured in 2018 or newer for the values to be burned into eFuse.
// more infos here:
#include <Arduino.h>
#include <esp_adc_cal.h>
esp_adc_cal_characteristics_t chars;
Nemo64 / remove-all-passwords.js
Created Jun 19, 2020
a script you can execute to delete all password in chrome. You may need to run it multiple times due to timing issues.
View remove-all-passwords.js
// $0 = <password-list-item> so you'll need to pick that element in your browser first
// then execute this script until your password list is empty (there is a timing issue but after about 3 tries the password list is empty)
$0.parentNode.querySelectorAll('password-list-item').forEach(item => {
Nemo64 / userscript.js
Created Jul 22, 2019
This is a userscript for tampermonkey to automatically remove a bunch of urls from google.
View userscript.js
// ==UserScript==
// @name Bulk removal google hack
// @namespace
// @version 0.1
// @description Bulk remove a search result from google
// @author Marco Pfeiffer
// @match*
// @grant none
// ==/UserScript==
Nemo64 / elevatorgame.js
Created Dec 21, 2018
my solution to the elevator game (not perfect)
View elevatorgame.js
init: function(elevators, floors) {
this.elevators = elevators;
this.floors = floors;
this.todos = [];
this.time = 0;
this.overSizeTheashold = 6;
for (let floor of floors) {
floor.on('down_button_pressed', () => this.addFloorButtonPush(floor, 'down'));
Nemo64 / AbstractDbalRepository.php
Last active Oct 2, 2018
createQueryBuilder for typo3 extbase repository using dbal
View AbstractDbalRepository.php
namespace Vendor\Extension\Domain\Repository;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
Nemo64 / poll.txt
Last active Sep 20, 2018 essens poll
View poll.txt
/poll "Was wollen wir heute essen?
Ciao Bella:
Taverna Romana:" "Ciao Bella (Italiener)" :pizza: "Döner/Paulis Kumpir (und Croque)/Thai Pauli" :stuffed_flatbread: "Azeitona (Falafel)" :broccoli: "Olympisches Feuer (Grieche)" :amphora: "Kleine Pause (Fast food)" :fries: "Asia Imbiss (Asiate)" :ramen: "Maharaja (Inder)" :curry: "Trattoria da Mario (Italiener)" :spaghetti: "Taverne Romana" :stew: "Graupi" :potato: