Skip to content

Instantly share code, notes, and snippets.

View mikalv's full-sized avatar

Mikal mikalv

View GitHub Profile
@mikalv
mikalv / slave_gevent.py
Created April 23, 2024 17:50 — forked from pcdinh/slave_gevent.py
gevent+kombu actor/mailbox using decorators
from __future__ import with_statement
from kombu import BrokerConnection
from collections import defaultdict
import gevent
from gevent import monkey
monkey.patch_all()
class WorkerHub():
"""
WorkerHub controls the local mailboxes that the @worker decorator assigns.
@mikalv
mikalv / fields.py
Created April 9, 2024 14:05 — forked from evert0n/fields.py
Virtual Field for Django
from django.db.models import Field
from django.conf import settings
from django.utils.decorators import cached_property
class VirtualField(object):
"""
A virtual field, mainly used for caching and seamless computed field retrieval.
This acts both like a (cached) property and a virtual field if supported.
"""
@mikalv
mikalv / tesla-key-card-protocol.md
Created September 20, 2023 22:27 — forked from darconeous/tesla-key-card-protocol.md
Tesla Key Card Protocol

Tesla Key Card Protocol

Researched by Robert Quattlebaum darco@deepdarc.com.

Last updated 2020-02-03.

Image of Tesla Key Card Image of Tesla Model 3 Key Fob

@mikalv
mikalv / Python PDF Password
Created March 15, 2016 13:37 — forked from mrpollo/Python PDF Password
Python PDF Password cracker
#!/usr/local/bin/python
from pyPdf import PdfFileWriter, PdfFileReader
import random
from pprint import pprint as pp
import sys
# sys.setrecursionlimit(10000000)
seed = 'BN9F'
pile = [1]
def getNumber():
@mikalv
mikalv / esphome_ble_config.yaml
Created February 17, 2023 09:00 — forked from kmdm/esphome_ble_config.yaml
esphome, esp32 ble tracker and Home Assistant mqtt_room sensors
# MQTT broker configuration
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_username
password: !secret mqtt_password
discovery: False # Only if you use the HA API usually
id: mqtt_client
# Define the room for this ESP32 node
substitutions:
@mikalv
mikalv / update_notifications.yaml
Created January 28, 2023 01:35 — forked from mdegat01/update_notifications.yaml
Update Notifications Automation Blueprint
blueprint:
name: Update notifications
description: Send notifications for new updates and install or skip on action
homeassistant:
min_version: '2022.4.0'
domain: automation
input:
update_entities:
name: Update entities
description: >-
@mikalv
mikalv / SpaceshipPawn.cpp
Created January 17, 2019 01:08 — forked from pomettini/SpaceshipPawn.cpp
Unreal Engine 4 Custom Pawn Class to control a Spaceship
#include "SpaceshipPawn.h"
// Sets default values
ASpaceshipPawn::ASpaceshipPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
USphereComponent * SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(40.0f);
@mikalv
mikalv / gist:3f2c2499a2be0db28644fdedfd85d263
Last active January 13, 2023 14:32 — forked from erasmospunk/gist:b915bc8b8046729649f4
Adding Anoncoin to Coinomi

Usecase - Integrating Anoncoin to Coinomi

A simple usecase of a Bitcoin compatible coin integration. Not all coins are created equal, so it is possible that extra work must be done to successfully integrate a new cryptocurrency.

  1. Start the Anoncoin daemon and in the anoncoin.conf file add the option "txindex=1"
rpcuser=anoncoinrpc
rpcpassword=MFfySYp9o9qQi0mYbQmxOdE1pEHVS1DQuhhHssOzkO3
rpcport=8022
@mikalv
mikalv / README-oneshot-systemd-service.md
Created December 5, 2022 22:21 — forked from drmalex07/README-oneshot-systemd-service.md
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh: