Skip to content

Instantly share code, notes, and snippets.

View cbruegg's full-sized avatar

Christian Brüggemann cbruegg

View GitHub Profile
@cbruegg
cbruegg / rewe-lieferservice-verfuegbarkeit.js
Last active January 26, 2024 19:19
Scriptable REWE Lieferservice Verfügbarkeit
let zipCode = "33100"
let widget = new ListWidget()
widget.setPadding(8, 8, 8, 8)
widget.url = "https://shop.rewe.de/"
await createWidget()
Script.setWidget(widget)
Script.complete()
interface SootEvent { }
class SomeSootEvent implements SootEvent { ... }
class Foo {
PublishSubject<SootEvent> eventSubject = PublishSubject.create();
void modifyState() {
// ... modify some state ...
eventSubject.onNext(new SomeSootEvent(...));
}
fun main(args: Array<String>) {
println(fib().take(5).toList())
}
fun fib() = sequence<Int> {
yield(1)
yield(1)
var prev = 1
var prevPrev = 1
package de.maxisma.allaboutsamsung
import android.content.Intent
import android.support.design.widget.Snackbar
import android.support.v4.app.Fragment
import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonEncodingException
import kotlinx.coroutines.experimental.CancellationException
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Job
@cbruegg
cbruegg / calccorr.kt
Created September 2, 2017 11:06
Plot cryptocurrency difficulty correlations (quick and dirty)
package diffchecker
import org.jsoup.Jsoup
import java.net.URL
import java.util.*
private val currencies = arrayOf("bitcoin", "xmr", "ltc", "eth", "etc", "dash")
private fun urlFor(currency: String) = "https://bitinfocharts.com/comparison/$currency-difficulty.html"
private val dataRegex = Regex("\\[new Date\\(\"([0-9/]*)\"\\),([0-9.E+]*)]")
package edu.brown.cs.paneclient;
import java.io.IOException;
import java.net.InetAddress;
public class PaneSample {
private static final String PANE_CONTROLLER_HOSTNAME = "localhost";
private static final int PANE_CONTROLLER_PORT = 9000;
private static final String PANE_USERNAME = "username";
import psutil
import time
import collections
###
### Simply pipe the output of this program into a file
### to obtain CSV formatted data about the CPU, memory,
### network and disk. Press CTRL-C to stop writing.
###
Iteration 149
HashSkipNode{skipNode=SkipNode{running=true, id=2, bitstring='001000', neighbors=0:{[7, 10]}1:{[]}2:{[]}3:{[]}4:{[]}5:{[]}, internalMap={2=3, 4=5, 6=20}}
HashSkipNode{skipNode=SkipNode{running=true, id=7, bitstring='111010', neighbors=0:{[2, 10, 20]}1:{[10]}2:{[10]}3:{[]}4:{[]}5:{[]}, internalMap={8=4}}
HashSkipNode{skipNode=SkipNode{running=true, id=10, bitstring='110011', neighbors=0:{[2, 7]}1:{[7]}2:{[7]}3:{[]}4:{[]}5:{[]}, internalMap={1=2}}
HashSkipNode{skipNode=SkipNode{running=false, id=20, bitstring='001101', neighbors=0:{[2, 10]}1:{[2]}2:{[2]}3:{[2]}4:{[]}5:{[]}, internalMap={1=2}}
-----------------------------
Iteration 150
TEST: Join node 25 at node 2
HashSkipNode{skipNode=SkipNode{running=true, id=2, bitstring='001000', neighbors=0:{[7, 10]}1:{[]}2:{[]}3:{[]}4:{[]}5:{[]}, internalMap={2=3, 4=5, 6=20}}
HashSkipNode{skipNode=SkipNode{running=true, id=7, bitstring='111010', neighbors=0:{[2, 10, 20]}1:{[10]}2:{[10]}3:{[]}4:{[]}5:{[]}, internalMap={8=4}}
package chess;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
class Graph {
final Set<Node> nodes;
final Set<Edge> edges;
class A()
class B<T>()
fun <T> A.f(b: B<T>) {
val eq = this == b // Error: Operator '==' cannot be applied to 'A' and 'B<T>'
}
class A2<T>()
class B2<T>()