Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Vijlbrief tomtor

View GitHub Profile
@tomtor
tomtor / rdtape.c
Created Mar 19, 2016
Convert SIMH simulator tapes to normal files
View rdtape.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
* Convert SIMH simulator tapes to normal files
*
* Copyright 2016 Tom Vijlbrief
*
* tvijlbrief at gmail dot com
@tomtor
tomtor / MendixWidgetWrapper.html
Created May 26, 2016
A simple Wrapper for Mendix Widgets
View MendixWidgetWrapper.html
<html>
<head>
<script src="../lib/jquery-1-11-3.js"></script>
</head>
<body>
<script>
function declare_f(w, a, p) {
p.domNode= $('body')[0];
p._contextObj= { set: function(k,v) { console.log(v); }};
View json-func.sql
-- See
-- http://stackoverflow.com/questions/18209625/how-do-i-modify-fields-inside-the-new-postgresql-json-datatype
-- All credits to the original author
---------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION "json_object_set_key"(
"json" json,
"key_to_set" TEXT,
"value_to_set" anyelement
)
View epsg28992.sql
----------------------------------------------------------------------------
-- CRS conversion functions for GeoJSON coordinates and lat/long pairs
-- in PostgreSQL/PostGIS:
--
-- from (Google) Web Mercator (OpenLayers:900913, EPSG:3785 and EPSG:3857 (prefered))
-- and WGS-84 Lat (y) Long (x) (EPSG:4326)
--
-- to EPSG:28992 (RD new)
--
-- Needs the PostGIS extension (surprise ;-)
@tomtor
tomtor / CCS811_test.ino
Last active Jun 2, 2017
CCS811 low power Arduino sketch
View CCS811_test.ino
/***************************************************
This is an example for the CCS811 digital TVOC/eCO2 Sensor by CCMOSS/AMS
http://www.ccmoss.com/gas-sensors#CCS811
Updated: March 28, 2017
The sensor uses I2C protocol to communicate, and requires 2 pins - SDA and SCL
Another GPIO is also required to assert the WAKE pin for communication. this
pin is passed by an argument in the begin function.
View STM32-OTA-CCS811.ino
/*******************************************************************************
Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
(c) 2017 Tom Vijlbrief
Permission is hereby granted, free of charge, to anyone
obtaining a copy of this document and accompanying files,
to do whatever they want with them without any restriction,
including, but not limited to, copying, modification and redistribution.
NO WARRANTY OF ANY KIND IS PROVIDED.
@tomtor
tomtor / ULP-stack.S
Last active Oct 11, 2017
ESP32 ULP subroutine and stack macros and multiply routine
View ULP-stack.S
/*
* Demo of Stack and subroutine macros for ESP32 ULP
*
* R3 is the SP
*/
#include "soc/rtc_cntl_reg.h"
#include "soc/rtc_io_reg.h"
#include "soc/soc_ulp.h"
@tomtor
tomtor / XOR.S
Last active Oct 13, 2017
Esp32 ULP macro function
View XOR.S
/* r0 = r0 xor r2, spills r1 */
.macro xor
/*
See https://stackoverflow.com/a/5377173
int bitwise_XOR(int a, int b)
{
return (a + b) - (a & b) - (a & b);
}
@tomtor
tomtor / upload.py
Last active May 18, 2018
Upload file to Google Drive
View upload.py
#!/usr/bin/python
import sys
import os
from optparse import OptionParser
from os.path import expanduser
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
@tomtor
tomtor / clone_drive.py
Last active Aug 16, 2018
Clone fishtest LTC PGN files to Google Drive
View clone_drive.py
#!/usr/bin/env python3
import os
import sys
import subprocess
import re
import requests
import bz2
from pymongo import MongoClient, ASCENDING, DESCENDING