Skip to content

Instantly share code, notes, and snippets.

View mrichar1's full-sized avatar

Matthew Richardson mrichar1

View GitHub Profile
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_utils import create_view
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)
127.0.0.1 adclick.g.doubleclick.net
127.0.0.1 adeventtracker.spotify.com
127.0.0.1 ads-fa.spotify.com
127.0.0.1 analytics.spotify.com
127.0.0.1 audio2.spotify.com
127.0.0.1 b.scorecardresearch.com
127.0.0.1 bounceexchange.com
127.0.0.1 bs.serving-sys.com
127.0.0.1 content.bitsontherun.com
127.0.0.1 core.insightexpressai.com
@mrichar1
mrichar1 / httpd.conf
Created September 20, 2013 16:52
Apache configuration to set Encryption and Authorisation for Kibana and Elasticsearch queries, with the option to restrict access to different indices.
#########################################################################################
# This configuration is based on that supplied here:
# https://github.com/elasticsearch/kibana/blob/master/sample/apache_ldap.conf
#
# The aim of this config is to set up encryption and authorisation on Kibana access.
# It also allows different authorisation rules for certain elasticsearch indexes.
#
# This config expects you to unpack kibana at /var/www/kibana/ and set config.js to be:
# https:// instead of http:// and 443 instead of 9200
#
@mrichar1
mrichar1 / gist:a433240cbe142f101e69
Last active September 6, 2017 18:47
Logging events from sensu to logstash

To log checks from sensu into logstash, I use the following sensu config:

{
  "handlers": {
    "logstash": {
      "type": "tcp",
      "socket": {
        "host": "logstash.example.com",
        "port": 1234
"""Script to launch the specified command in the next available workspace."""
import i3ipc
import sys
# Potential workspaces to use
WORKSPACES = set((1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
def main():
i3c = i3ipc.Connection()
@mrichar1
mrichar1 / split-size-toggle.py
Created February 10, 2017 21:59
Change i3 split based on current window dimensions
import i3ipc
i3 = i3ipc.Connection()
def on_window_focus(i3, e):
cont = e.container
if cont.rect.width < cont.rect.height:
print("splitv")
i3.command("split vertical")
else:
### Keybase proof
I hereby claim:
* I am mrichar1 on github.
* I am match (https://keybase.io/match) on keybase.
* I have a public key whose fingerprint is 129D 6F6D A317 AAA8 F492 A7E6 456A 62D5 6602 41D2
To claim this, I am signing this object:
@mrichar1
mrichar1 / gist:7416008
Created November 11, 2013 16:28
hacky script to generate fpm rpms from sensu-admin Gemfile, using ruby bundled with sensu and ignoring already existing gems
########################################################
# install sensu (epel rpms)
# you will also need some (all?) of sqlite-devel, mysql2-devel, rpm-build, libxslt-devel,libxml2-devel rpms
# use it's embedded gem to install bundler and fpm
mkdir /tmp/sensugems
/opt/sensu/embedded/bin/gem install --no-rdoc --no-ri -i /tmp/sensugems/ bundler
@mrichar1
mrichar1 / logstash.conf
Last active August 29, 2015 14:16
logstash output to influxdb
output {
http {
url => "http://influxdb.example.com/db/<database>/series?u=<user>&p=<pass>"
http_method => "POST"
}
}