Skip to content

Instantly share code, notes, and snippets.

View mttkay's full-sized avatar

Matthias Käppler mttkay

  • GitLab
  • Berlin, Germany
View GitHub Profile
@mttkay
mttkay / zipinfo.txt
Created November 22, 2021 12:33
Archive zipinfo
Archive: Archive.zip
There is no zipfile comment.
End-of-central-directory record:
-------------------------------
Zip archive file size: 9935199 (000000000097995Fh)
Actual end-cent-dir record offset: 9935177 (0000000000979949h)
Expected end-cent-dir record offset: 9935177 (0000000000979949h)
(based on the length of the central directory and its expected offset)
@mttkay
mttkay / coffee.scala
Last active September 4, 2018 21:00
Passing functions, not objects as collaborators
class Coffee
class Order
class CoffeeMaker {
def startCoffee(): Unit = ???
def isCoffeeReady: Boolean = ???
@mttkay
mttkay / geth.log
Created June 15, 2016 07:39
get --fast logs
I0615 09:11:30.700609 core/blockchain.go:751] imported 6 receipt(s) (0 ignored) in 1.002706ms. #372705 [bb0cce10… / 690c5ba5…]
I0615 09:11:31.994642 core/blockchain.go:751] imported 17 receipt(s) (0 ignored) in 2.624429ms. #372722 [5185b9fa… / 8c6fe057…]
I0615 09:11:32.029927 core/headerchain.go:294] imported 178 header(s) (14 ignored) in 24.758826ms. #374733 [297a5f22… / bb1ef962…]
I0615 09:11:32.602010 core/blockchain.go:751] imported 14 receipt(s) (0 ignored) in 1.509627ms. #372736 [e00911b5… / ccbd5a6b…]
I0615 09:11:32.914538 core/headerchain.go:294] imported 192 header(s) (0 ignored) in 22.871789ms. #374925 [c03127ff… / bcffe252…]
I0615 09:11:32.942771 core/blockchain.go:751] imported 19 receipt(s) (0 ignored) in 11.930873ms. #372755 [1c601c38… / 7a58945a…]
I0615 09:11:33.500175 core/blockchain.go:751] imported 20 receipt(s) (0 ignored) in 4.984327ms. #372775 [3de5382c… / 639f5c5f…]
I0615 09:11:33.536139 core/headerchain.go:294] imported 192 header(s) (0 ignored) in 27.151351ms. #375117 [a858cb8f… / 11d1
@mttkay
mttkay / report.txt
Created June 15, 2016 07:12
Mix 1.0.5 crash
Process: Mix-ide [31034]
Path: /Applications/Mix-ide.app/Contents/MacOS/Mix-ide
Identifier: .
Version: ??? (mix )
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Mix-ide [31034]
User ID: 502
Date/Time: 2016-06-15 09:09:57.574 +0200
@mttkay
mttkay / Pager.java
Created November 4, 2015 15:46
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
@mttkay
mttkay / DownloadTask.java
Last active December 21, 2015 16:19
An AsyncTask.
class DownloadTask extends AsyncTask<String, Void, File> {
protected File doInBackground(String... args) {
final String url = args[0];
try {
byte[] fileContent = downloadFile(url);
File file = writeToFile(fileContent);
return file;
} catch (Exception e) {
// ???
@mttkay
mttkay / gist:6050054
Created July 21, 2013 21:25
Note that you must setRetainInstance(true); otherwise the Observable and all associated state will get destroyed of course. So make sure you don't create strong references to views/context in onCreate or onActivityCreated, or they will leak. The nice thing about this is that there apart from splitting up the code for creating the observable from…
package com.github.super8.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import com.github.super8.R;
<TextView style="@style/my_textview_style" .../>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="my_textview_style" parent="@android:style/Widget.TextView">
<item name="android:id">@+id/my_text</item>
...
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="my_text" type="id" />
</resources>