Skip to content

Instantly share code, notes, and snippets.

View PJUllrich's full-sized avatar

Peter Ullrich PJUllrich

View GitHub Profile
from observer.observer_pattern import Observable, Observer
class Elf:
name = 'Galadriel'
def nall_nin(self):
print('Elf says: Calling the Overlord ...')
@PJUllrich
PJUllrich / pushover.sh
Last active October 23, 2023 20:49
Bash script to send your IP via Pushover
#!/bin/bash
IP=`hostname -I | awk '{print $1}'`
MESSAGE="Pi ${HOSTNAME} fully booted. New IP: $IP"
TITLE="`whoami`@${HOSTNAME}"
APP_TOKEN="YOUR_APP_TOKEN_HERE"
USER_TOKEN="YOUR_USER_TOKEN_HERE"
wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 &
@PJUllrich
PJUllrich / demo
Last active June 19, 2018 19:58
Solidity Call, Callcode, Delegatecall Demo. Deploy contracts. Call functions and see how sender changes in either B, or C.
pragma solidity ^0.4.24;
contract A {
address public sender;
function dcall(B other, C child) public {
other.dcall(child);
}
}
@PJUllrich
PJUllrich / pubsub.ex
Last active December 23, 2021 19:48
PubSub Library for broadcasting results of Ecto operations
defmodule MyApp.PubSubLib do
@moduledoc """
This library implements easy to use Publish-Subscribe functionality.
## Usage
Use this library with `use MyApp.PubSubLib`.
## Example
defmodule MyApp.MyPublishingModule do
name: Elixir CI
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
defmodule Support.FeatureCase do
@moduledoc false
use ExUnit.CaseTemplate
using do
quote do
@moduletag :feature
use Wallaby.DSL
name: Update data
on:
schedule:
- cron: "0 5 * * *"
jobs:
execute:
runs-on: ubuntu-latest
require 'google/apis/identitytoolkit_v3'
require 'google/apis/core/api_command'
require 'googleauth'
require 'addressable/template'
require 'json'
require 'securerandom'
# Request to delete account.
class CreateSessionCookieRequest
include Google::Apis::Core::Hashable
@PJUllrich
PJUllrich / regularly_check_appointments_in_cologne.exs
Last active June 7, 2021 12:26
Checks for available appointments in the "Bürgeramt" in Cologne and notifies via Pushover
defmodule Terminvergabe do
@moduledoc """
This script checks for available appointments in the "Bürgeramt" (city hall)
every 5min and notifies a user via Pushover if new appointments become were added.
In order to use Pushover, you must configure the following environment variables:
PUSHOVER_USER
PUSHOVER_TOKEN
@PJUllrich
PJUllrich / big-o.md
Last active April 28, 2024 14:19
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements