Skip to content

Instantly share code, notes, and snippets.

View aegis1980's full-sized avatar

Jon Robinson aegis1980

View GitHub Profile
aegis1980 /
Last active September 12, 2015 23:58
Custom view subclass of Android TextView widget that allows you to use HTML string resources (for better localisation). Development of Millthorn's answer with CDATA tag in this stackoverflow question: His(Her?) solution required you to programmati…
package com.fitc.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.text.Html;
import android.util.AttributeSet;
import android.widget.TextView;
* Created by Jon on 3/01/2015.
aegis1980 /
Last active August 22, 2017 06:21 — forked from ruslanosipov/
Script to convert WordPress posts to plain text files
#!/usr/bin/env python
"""This script converts Wordpress WXR file to a number of plain text files.
WXR stands for "WordPress eXtended RSS", which basically is just a
regular XML file. This script extracts entries from the WXR file into
plain text files. Output format: article name prefixed by date for
posts, article name for pages.
Usage: filename [-o output_dir]
aegis1980 /
Last active January 8, 2018 19:57 — forked from peterkuterna/
Use FragmentStatePagerAdapter with cursor rather than Collection/Array data structure
package com.example;
import android.content.Context;
import android.database.Cursor;
import android.util.SparseIntArray;
import android.view.ViewGroup;
import android.content.Context;
import android.content.Intent;
import android.hardware.usb.UsbDevice;
import android.os.AsyncTask;
import android.os.Bundle;
# Fractile estimation from samples – prediction method with t-student distribution, if you dont know parent pop sd
tp <- function(x,n){
result <- qt(x,n-1) * sqrt(1+(1/n))
# Fractile estimation from samples – prediction method with normal distribution, if you do know parent pop sd
up <- function(x,n){
result <- qnorm(x) * sqrt(1+(1/n))
aegis1980 /
Last active August 22, 2019 20:05
Programmatic parsing of a requirements file and importing
import subprocess
import sys
from pip import _internal as pip #this seems a little dangerous. as-off
DEBUG = True
def myprint(string_to_print):
aegis1980 /
Last active November 29, 2019 06:28
For using a (hall sensor) flow sensor connected to RPi4 GPIO pins.d
import RPi.GPIO as GPIO
import time
import sys
import threading
from typing import List, Type
import math
class FlowSensor:
def __init__(self, pin=23, calibration_factor=6, calibration_offset=8, sample_interval : float = 1):
import os
import shapely.geometry as sg
import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection
import dxf
import utils
#change to fp of your dxf
aegis1980 / TwoD_block_stir.jl
Last active August 8, 2021 04:44
Modified TwoD_block.jl example for Waterlilly.jl' CFD library.
using WaterLily
using StaticArrays
function block(L=2^5;Re=250,U=1,amp=0,ϵ=0.5,thk=2ϵ+√2)
# Set viscosity
# Create dynamic block geometry
function sdf(x,t)
# SDF defines form a paddle (a rectangle)
aegis1980 / lora_node.ino
Created October 18, 2021 20:49
Lora node sketch for XC4392 Arduino shield
#include <dht.h>
#include <SPI.h>
#include <RH_RF95.h>
// Singleton instance of the radio driver
RH_RF95 rf95;
float frequency = 915.0; //frequency settings
dht DHT;
#define DHT11_PIN A0
float temperature,humidity,tem,hum;