Skip to content

Instantly share code, notes, and snippets.

@waldheinz
waldheinz / prometheus.cgi
Created September 30, 2017 09:20
Prometheus Exporter for Homematic CCU
#!/bin/tclsh
load tclrega.so
source [file join $env(DOCUMENT_ROOT) once.tcl]
source [file join $env(DOCUMENT_ROOT) cgi.tcl]
cgi_eval {
cgi_input
cgi_content_type "text/plain; charset=iso-8859-1; version=0.0.4"
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@longtimeago
longtimeago / squash-commits.md
Last active April 1, 2024 20:44
How to squash commits in a GitHub pull request

How to squash commits in a GitHub pull request

o you've contributed some code to an open source project, say, Rails. And they'd like you to squash all of the commits in your pull request. But you're not a git wizard; how do you make this happen?

Normally, you'd do something like this. I'm assuming upstream is a git remote that is pointing at the official project repository, and that your changes are in your 'omgpull' branch:

@steeef
steeef / README.md
Last active February 4, 2017 03:11 — forked from lusis/README.md

This is a pretty opinionated solution that we use internally. It's strictly designed to post to slack via the API and it uses our notion of wrapping EVERYTHING with a role. All of our plugins automatically use brain storage as well. To be able to execute anything with hubot, you have to be a rundeck_admin role user (per the hubot-auth plugin).

HUBOT_RUNDECK_URL should be set to the root URL of your Rundeck server, not including the path to the current api version. NOTE: Currently relying on Rundeck API version 12.

You should be able to tease out the rundeck API stuff specifically.

It depends on a common format for your job defs in rundeck. We have two types of jobs in rundeck that we use via this plugin:

@yoggy
yoggy / mqtt_influxdb_sample.rb
Last active August 29, 2015 14:02
mqtt & influxdb sample..
#!/usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# mqtt & influxdb sample...
#
# libraries
# $ gem install mqtt
# $ gem install influxdb
#
@poolski
poolski / postfix.grok
Last active April 16, 2022 03:54
Usefuk Logstash GROK patterns
# Syslog stuff
COMPONENT ([\w._\/%-]+)
COMPID postfix\/%{COMPONENT:component}(?:\[%{POSINT:pid}\])?
POSTFIX %{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:hostname} %{COMPID}: %{QUEUEID:queueid}
# Milter
HELO (?:\[%{IP:helo}\]|%{HOST:helo}|%{DATA:helo})
MILTERCONNECT %{QUEUEID:qid}: milter-reject: CONNECT from %{RELAY:relay}: %{GREEDYDATA:milter_reason}; proto=%{WORD:proto}
MILTERUNKNOWN %{QUEUEID:qid}: milter-reject: UNKNOWN from %{RELAY:relay}: %{GREEDYDATA:milter_reason}; proto=%{WORD:proto}