Skip to content

Instantly share code, notes, and snippets.

View tillsc's full-sized avatar

Till Schulte-Coerne tillsc

View GitHub Profile
@tillsc
tillsc / query.flex
Last active January 3, 2021 13:46
query influx data with unevenly distributed points
// Replace this with your specific query/selection
base = from(bucket: "hassio")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "kw")
|> filter(fn: (r) => r["entity_id"] =~ /bhz3_leistung_zus/)
|> filter(fn: (r) => r["_field"] == "value")
|> window(every: v.windowPeriod)
|> sort(columns: ["_time"], desc: false)
// This does NOT caclulate the correct mean (maybe `timeWeightedAvg` would be the right choice here but I couldn't
@tillsc
tillsc / end.gcode
Last active November 21, 2022 20:59
GCodes for Sidewinder X1
M42 P4 S255 ; led green
M42 P5 S50 ; led red
M42 P6 S50 ; led blue
M104 S0 ; nozzle heater off
M140 S0 ; bed heater off
G92 E1 ; relative positioning mode
G1 E-1 F300 ; Retract the filament
G28 X ; Home the X axis
G0 Y280 F600 ; Bring the bed to the front for easy print removal
@tillsc
tillsc / can_ids.md
Last active February 28, 2019 11:29
Brunner CAN IDs

BHZ 3.0 - 1.82

Bei sämtlichen hier aufgeführten Paketen handelt es sich um 4 Byte Daten. Das letzte Byte ist immer 0x00 und muss weg gelassen werden.

Temperaturen

ID Name Einh.
0x1c104009 VL HK1 (S1) °C/10
0x1c10400a VL HK2 (S2) °C/10
@tillsc
tillsc / galen-setup.js
Last active September 28, 2015 14:39
galen setup script tying to fix `clientWidth` in Browsers showing a vertical scrollbar
function setup() {
// create driver and other stuff
// ...
driver.get(url);
var realWidth = inject(driver, 'return document.documentElement.clientWidth');
if (realWidth < size.width) {
var w = 2 * size.width - realWidth;
@tillsc
tillsc / dm-to_xlsx.rb
Last active August 29, 2015 14:26
to_xlsx for DataMapper
# -*- encoding : utf-8 -*-
module DataMapper
module Xlsx
module Model
def xlsx_columns
self.properties.reject{ |p| p.options[:no_export] }.
sort{ |a, b| (a.options[:export_pos] || 0) <=> (b.options[:export_pos] || 0) }.

Keybase proof

I hereby claim:

  • I am tillsc on github.
  • I am tillsc (https://keybase.io/tillsc) on keybase.
  • I have a public key whose fingerprint is F789 21B7 A0EA 859A DDB8 97F8 E861 8608 B8CF E1E1

To claim this, I am signing this object:

@tillsc
tillsc / index.html
Last active December 21, 2015 02:59
Discussion about RDFa vs. POSH with @tistre
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<meta charset="UTF-8" />
<title>
Story: 1828128 from BAB / BNH, page 3 from Thursday, July 25, 2013 – DC-X 1.7.8.0 BTAG API
</title>
<link href="http://dcxtrunk.digicol.de/dcx_static/trunk/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
</head>
@tillsc
tillsc / gist:4233025
Created December 7, 2012 12:42
Defining a JNDI OracleConnectionPool in JRuby for testing purposes
if RUBY_PLATFORM =~ /java/
require 'java'
# Add ojdbc to the Java classpath
$CLASSPATH << File.expand_path('../../lib/ojdbc5.jar', __FILE__)
# Simply add all apache tomcat libs (some juli.jar might need to be added too)
Dir.glob("/usr/local/Cellar/apache-tomcat/6.0.24/lib/*.jar") do |filename|
$CLASSPATH << filename
end
@tillsc
tillsc / eager_loading.rb
Created July 23, 2012 07:02
Eager Loading DM associations
# Usage:
#
# customers = Customer.all
# customers.eager_load(Customer.orders.line_items.item, Customer.address)
#
module DataMapper
module EagerLoading
def eager_load(*query_paths)
@tillsc
tillsc / my_helper.rb
Created March 8, 2012 09:03
all_errors helper method for DataMapper 1.2
module DataMapper
module MyHelpers
def all_errors(seen=[])
return [] if seen.include?(self)
seen << self
res = self.errors
parent_relationships.each do |relationship|
association = relationship.get!(self)