Skip to content

Instantly share code, notes, and snippets.

View MisterRager's full-sized avatar

A. Rager MisterRager

View GitHub Profile
@MisterRager
MisterRager / oswg_profile.py
Last active August 21, 2018 14:34
OSWG Profile Generation
import math
import FreeCAD, FreeCADGui, Part
# R(x) = sqrt(R0^2 + 2*R0*tan(F)*x + (tan(A)*x)^2)
#
# x .. distance from the throat along the WG axis
# R(x) .. radius of the WG at x
# R0 .. radius of the WG at the throat
# A .. coverage angle
@MisterRager
MisterRager / ContentProviderUpdates.kt
Created March 21, 2018 23:48
Watch a ContentProvider for updates
import android.database.ContentObserver
import android.net.Uri
import android.os.Handler
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
class ContentProviderUpdates(handler: Handler) : ObservableOnSubscribe<Uri>, ContentObserver(handler) {
private var emitter: ObservableEmitter<Uri>? = null
@MisterRager
MisterRager / DataUpdatesStaging.kt
Created March 14, 2018 00:04
A simple utility for staging updates on a stream of records without holding merged record state
private typealias Update<T> = T.() -> Unit
class DataUpdatesStaging<T> {
private val updateBuffer: MutableList<Update<T>> = ArrayList()
private val updateStream: BehaviorSubject<List<Update<T>>> = BehaviorSubject.create(updateBuffer)
fun stageUpdate(update: Update<T>) {
synchronized(updateBuffer) {
updateBuffer.add(update)
updateStream.onNext(updateBuffer)
@MisterRager
MisterRager / instaminer.sh
Last active March 2, 2018 19:55
instaminer
docker run --rm wernight/cpuminer-multi:alpine cpuminer -a yescrypt -o stratum+tcp://yescrypt.us.hashrefinery.com:6233 -u 1MQpRBPmBW5fDW3sxpagmSYE9RWFxWLTDo -p BTC
@MisterRager
MisterRager / CMakeLists.txt
Last active March 22, 2021 17:10
Build SQLite fts5 extension with CMake
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
ExternalProject_Add(sqlite-sources
URL http://www.sqlite.org/2017/sqlite-src-3200100.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/sqlite-sources
CONFIGURE_COMMAND cd ../sqlite-sources && ./configure
BUILD_COMMAND ""
INSTALL_COMMAND "")
@MisterRager
MisterRager / Makefile
Created November 10, 2017 00:16
Build FTS5 Module for SQLite
# http://www.sqlite.org/download.html
SQLITE_VERSION ?= 3200100
SQLITE_YEAR ?= 2017
SQLITE_BASENAME := sqlite-src-$(SQLITE_VERSION)
# Complete URL sample: https://sqlite.org/2017/sqlite-3200100.zip
SQLITE_URL := http://www.sqlite.org/$(SQLITE_YEAR)/$(SQLITE_BASENAME).zip
CC = gcc
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Pair;
import java.util.UUID;
import rx.Observable;
@MisterRager
MisterRager / Dockerfile
Last active October 24, 2017 22:32
m33 Fio Dockerfile: octoprint + m3d control extension in a Docker container
FROM ubuntu:xenial
RUN apt-get update && apt-get install -y \
wget \
unzip \
sudo \
python \
python-setuptools \
python-dev \
build-essential
@MisterRager
MisterRager / OrderedCursorDta.java
Created September 22, 2017 23:56
OrderedData: an abstraction over Data!
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.dmodel.mapper;
import android.database.Cursor;
import rx.functions.Func1;
/*
* Copyright (c) 2017 PlanGrid, Inc. All rights reserved.
*/
package com.plangrid.android.dmodel.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)