Skip to content

Instantly share code, notes, and snippets.

View SuborbitalPigeon's full-sized avatar

Bruce Cowan SuborbitalPigeon

View GitHub Profile
@SuborbitalPigeon
SuborbitalPigeon / web.js
Last active December 1, 2019 17:47
A web browser, in JavaScript.
#!/usr/bin/gjs
// TODO
// Proper actions
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const WebKit2 = imports.gi.WebKit2;
@SuborbitalPigeon
SuborbitalPigeon / simpson.js
Last active December 1, 2019 15:28
Simpson's rule using GTK+ via gjs
#!/usr/bin/gjs
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const GtkSource = imports.gi.GtkSource;
const Pango = imports.gi.Pango;
var Simpson = GObject.registerClass(
class Simpson extends Gtk.Application
{
class Probe:
required_string = ['type']
string = ['probe_manufacturer', 'probe_serial_number', 'probe_tag',
'wedge_manufacturer', 'wedge_serial_number', 'wedge_tag']
required_other = ['element_position', 'element_minor', 'element_major',
'element_shape', 'centre_frequency']
other = ['element_radius_of_curvature', 'element_axis_of_curvature',
'wedge_surface_point', 'wedge_surface_normal', 'dead_element',
'bandwidth']
@SuborbitalPigeon
SuborbitalPigeon / model.lua
Last active December 13, 2016 21:17
FEMM model for group A1
-- Useful functions
function average(a, b)
return (a + b) / 2
end
function get_x_y(radius, angle)
x = radius * cos(angle * (pi / 180))
y = radius * sin(angle * (pi / 180))
return x, y
end
@SuborbitalPigeon
SuborbitalPigeon / postcode.js
Last active November 12, 2016 16:44
Postcode validation using GJS or PyGObject
#!/usr/bin/gjs
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
var re = /[A-Z]{1,2}[\d][A-Z0-9]? ?[\d][A-Z]{2}/
const Postcode = new Lang.Class(
{
Name: 'Postcode',
from math import pi
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
A = pi/4 * 0.8**2 # Diameter: 800 mm
speeds = list(range(60, 270, 10))
altitudes = list(range(0, 45000, 1000))

Keybase proof

I hereby claim:

  • I am SuborbitalPigeon on github.
  • I am suborbitalpigeon (https://keybase.io/suborbitalpigeon) on keybase.
  • I have a public key whose fingerprint is 973E D580 A846 6D55 AA74 285B A0D0 4867 BBC3 4355

To claim this, I am signing this object:

from datetime import datetime
import json
import os
import subprocess
from sys import argv
dir = argv[1]
files = []
for dirpath, dirname, filenames in os.walk(dir):
@SuborbitalPigeon
SuborbitalPigeon / numbase.py
Last active October 12, 2015 07:07
Number to base
#!/usr/bin/env python
class Converter:
"""A bunch of converters"""
def __init__(self, number):
self.number = number
def to_base(self, digits):
# TODO: make the digits automatic and input the base instead
div = self.number
[
{
"id" : "stage",
"type" : "ClutterStage",
"width" : 800,
"height" : 600,
"color" : "black",
"children" : [ "rectangle" ],
"signals" :
[