Skip to content

Instantly share code, notes, and snippets.

@jgrgt
jgrgt / digoo-station.yaml
Created July 18, 2023 20:35 — forked from zry98/digoo-station.yaml
Digoo weather station sensor component for ESPHome
substitutions:
device_name: 'Digoo Station'
external_location: 'Balcony'
rf_receiver_pin: '4'
digoo_sensor_channel: '2'
digoo_sensor_id: '9'
esphome:
name: digoo-station
comment: 'ESP station for environment monitoring'
@jgrgt
jgrgt / readBson.groovy
Created November 4, 2015 08:13
Read bson files to documents in Java/Groovy
/**
* Publishing this publicly because it took me so long to get to this stage:
* - Using a memory-mapped byte buffer because I will handle *large* files.
* - Not too happy with the end of my loop, but I could not find how to check for the end of the buffer otherwise.
*/
import org.bson.BsonBinaryReader
import org.bson.BsonReader
import org.bson.Document
import org.bson.codecs.DecoderContext
import org.bson.codecs.DocumentCodec
@jgrgt
jgrgt / zip-vs-from.groovy
Created September 16, 2015 05:46
Experimenting with flatMap, concat and buffer in RxJava.
@Grab('com.netflix.rxjava:rxjava-joins:0.19.6')
import rx.Observable
import rx.functions.Func1
import rx.functions.Action1
import java.util.concurrent.TimeUnit
def range = new IntRange(5, 0)
range.each { println it}
@jgrgt
jgrgt / package.json
Created March 13, 2015 08:55
Locking up an npm connect proxy
{
"devDependencies": {
"connect": "~3.3.4",
"proxy-middleware": "~0.11.0",
"url": "~0.10.3",
"http": "0.0.0"
},
"scripts": {
"start": "node server.js"
}
class DefaultXConnector {
// ...
@Override
rx.Observable<JsonObject> getSessionWithTimeout(JsonObject jsonObject, long timeout) {
log.debug('Getting session with timeout {} for query: {} ({}, {})', timeout, jsonObject, this, this.eventBus)
return eventBus.sendWithTimeout(ServiceLocation.BUS_SESSION_SERVICE_LOCATION, jsonObject, timeout).map(body(true))
}
public static <T> Func1<RxMessage<T>, T> body(boolean logMessage) {
return { RxMessage<T> message ->
@jgrgt
jgrgt / keybase.md
Last active September 19, 2018 20:03
Keybase Proof

Keybase proof

I hereby claim:

  • I am jgrgt on github.
  • I am jensgeiregat (https://keybase.io/jensgeiregat) on keybase.
  • I have a public key whose fingerprint is 0E60 1C75 4EAE 8991 7293 839C F40A 1ED9 AC49 6619

To claim this, I am signing this object:

@jgrgt
jgrgt / .zshrc
Created March 29, 2013 15:30
My .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="kolo"
#ZSH_THEME="nicoulaj"
@jgrgt
jgrgt / pylogcapture.py
Created October 12, 2012 12:17
Pylabs logging Nosetests plugin. Still a WIP!
"""Save at /opt/qbase5/lib/python/site-packages/pylogcapture.py"""
from pylabs import q
from nose.plugins.base import Plugin
from nose.util import ln, safe_str
class PyLogTarget(object):
# TODO: memory management, filtering
enabled = True
@jgrgt
jgrgt / logstash_pylabs.rb
Created September 14, 2012 09:43
A logstash configuration to track Pylabs 5.1 logs.
input {
stdin {
type => "stdin-type"
}
file {
type => "pylabs"
path => [ "/opt/qbase5/var/log/pylabslogs/*/*.log" ]
}
@jgrgt
jgrgt / fetch_pyvideo.py
Created March 17, 2012 14:11 — forked from codeinthehole/fetch_pyvideo.py
Fetch PyCon videos from pyvideo.org and convert them to M4V so they can be synced to your iPhone
# Hacky script for downloading videos from PyVideo and converting them to m4v
# format so they can be synced onto your apple device. Useful if you
# want to see everything that happened at PyCon while commuting.
#
# Requirements:
# * pip install requests BeautifulSoup
# * youtube-dl (from https://github.com/rg3/youtube-dl/) - add this to the
# directory where this script runs and ensure its execute bit is set.
# This was the only YouTube downloader I found that worked. It doesn't
# really have a good Python API so I call it through os.system.