Skip to content

Instantly share code, notes, and snippets.

View mikeholler's full-sized avatar

Michael Holler mikeholler

View GitHub Profile
import asyncio
import datetime as dt
import logging
import os
import pyracing
import sys
from pyracing.client import Client
from pyracing.response_objects.chart_data import IRating
from pyracing.constants import ChartType
from pyracing.constants import Category
@mikeholler
mikeholler / dataclass_utils.py
Created January 8, 2020 21:25
Require keyword or positional arguments for Python dataclasses
from dataclasses import is_dataclass
from typing import TypeVar, Type, Callable, List, Dict, Any
_T = TypeVar("_T")
_Self = TypeVar("_Self")
_VarArgs = List[Any]
_KWArgs = Dict[str, Any]
def _kwarg_only_init_wrapper(
@mikeholler
mikeholler / antora-generate-wrapper.js
Created September 12, 2019 20:24
Wrapper that allows for --author-mode argument.
#!/usr/bin/env node
/**
* This is a wrapper to the `antora generate` command line tool that adds some
* functionality not otherwise present in antora.
*
* Before getting into that, one restriction is that the playbook.yml file MUST
* be the first argument to this command, otherwise this script will not work
* correctly. Other than that small restriction, all other uses of
* `antora generate` are supported here.
*
@mikeholler
mikeholler / Scratch.java
Created November 21, 2014 17:15
Profiling String Comparison vs. Class.isAssignableFrom(...) Comparison.
import java.util.Collection;
import java.util.List;
import java.util.Scanner;
public final class Scratch {
public static final String CORRECT_CLASS_NAME = List.class.getCanonicalName();
public static final String INCORRECT_CLASS_NAME = Scanner.class.getCanonicalName();
Cheat sheet for UML diagramming: From http://broken.build/assets/images/posts/cheat_sheet4.png
@mikeholler
mikeholler / DatabaseHelper.java
Created March 17, 2014 15:20
Maintain only one static database connection in Android. From http://touchlabblog.tumblr.com/post/24474750219/single-sqlite-connection
public class DatabaseHelper extends OrmLiteSqliteOpenHelper
{
private static DatabaseHelper instance;
public static synchronized DatabaseHelper getHelper(Context context)
{
if (instance == null)
instance = new DatabaseHelper(context);
return instance;
" URL: http://vim.wikia.com/wiki/Example_vimrc
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
" newbie, basing your first .vimrc on this file is a good choice.
" If you're a more advanced user, building your own .vimrc based
" on this file is still a good idea.
"------------------------------------------------------------
" Features {{{1
"
git tag -d 12345
git push origin :refs/tags/12345
@mikeholler
mikeholler / readme.md
Created February 10, 2014 15:43
A list of Android libraries.

Libraries

  • Otto event bus.
  • Picasso image downloading and caching library.
@mikeholler
mikeholler / instructions.md
Created February 10, 2014 00:42
Create a screen cast GIF in Ubuntu.

First install this:

sudo apt-get install imagemagick mplayer gtk-recordmydesktop

those are the required stuff, ImageMagick, MPlayer and Desktop Recorder. Then use Desktop Recorder to capture a portion of the screen/application to use as the screencast. After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.

On a terminal: