Skip to content

Instantly share code, notes, and snippets.

@robrant
robrant / slack-count-messages.py
Last active October 11, 2021 20:56
Count number of messages in a slack channel
#!/usr/bin/python
'''
Script to count messages by user posted to a channel for a given date range.
Install:
# sudo pip install -r requirements.txt
Also you will need to obtain a slack API token:
https://api.slack.com/docs/oauth-test-tokens
@robrant
robrant / install_local_rpm.yml
Created August 18, 2017 06:32
Find and install a local rpm
# The version of createrepo coming over can change
# We can't wildcard in ansible yum, so list with wildcard, then install
- name: List the files called create repo
find:
paths: "{{ yum_repo_location }}"
patterns: "createrepo*.rpm"
register: create_repo_files
- name: Install correct version of create repo
yum:
@robrant
robrant / playbook.yml
Created August 10, 2017 06:55
Showing how Ansible `register` nicely handles `with_items` loops.
# Simple playbook to understand and illustrate how nicely ansible handles registering output as part of a `with_items` loop.
# To call:
# $> ansible-playbook playbook.yml
---
- hosts: localhost
tasks:
- stat:
path: "/tmp"
@robrant
robrant / jicofo.log
Created May 25, 2017 20:13
Jitsi Meet Jicofo Log
Jicofo 2017-05-25 20:07:40.516 SEVERE: [52] org.jitsi.jicofo.ChannelAllocator.log() Failed to allocate channels using bridge: jitsi-videobridge.jitsi.mydomain.net
net.java.sip.communicator.service.protocol.OperationFailedException: Failed to allocate colibri channels: <iq id="85Wk4-61" to="focus@auth.jitsi.mydomain.net/focus29813371057323" from="jitsi-videobridge.jitsi.mydomain.net" type="error"><conference xmlns='http://jitsi.org/protocol/colibri' name='helloworld'><content name='audio'><channel endpoint='87f60587' initiator='true' channel-bundle-id='87f60587' last-n='-1'><payload-type name='opus' clockrate='48000' id='111' channels='2'><parameter value='10' name='minptime'/><parameter value='1' name='useinbandfec'/></payload-type><payload-type id='103' name='ISAC' clockrate='16000'/><payload-type id='104' name='ISAC' clockrate='32000'/><payload-type id='126' name='telephone-event' clockrate='8000'/><rtp-hdrext id='1' uri='urn:ietf:params:rtp-hdrext:ssrc-audio-level'/></channel></content><content name
@robrant
robrant / OrcaIndexer.java
Created March 28, 2017 06:58
Print the classpath from within code.
// Inspect the classpath - used during debugging
//ClassLoader cl = ClassLoader.getSystemClassLoader();
//URL[] urls = ((URLClassLoader) cl).getURLs();
//for (URL url : urls) {
// System.out.println(url.getFile());
//}
@robrant
robrant / pythonOpencvHomebrewInstallFix.md
Created February 22, 2017 22:03
Script to fix opencv homebrew install on OSX > El Capitan
@robrant
robrant / dumpall.j2
Created November 7, 2016 13:56
Ansible play for debugging a whole load of useful variables. Might be an issue with one of the template filters on 2.2
Module Variables ("vars"):
--------------------------------
{{ vars | to_nice_json }}
Environment Variables ("environment"):
--------------------------------
{{ environment | to_nice_json }}
GROUP NAMES Variables ("group_names"):
--------------------------------
@robrant
robrant / ansible_synchronize.yml
Created November 7, 2016 12:50
Synchronise between servers ansible
- name: Install rsync
yum: name=rsync state=latest
tags: filebeat_cert
- name: Sync the cert to the logstash box
synchronize:
src: "{{ cert_path }}/{{ filebeat_cert_name }}"
dest: "{{ cert_path }}/{{ filebeat_cert_name }}"
mode: pull
@robrant
robrant / ansible_fetch.yml
Created November 7, 2016 07:57
Ansible fetch example
- name: Fetch down the key to this control box
fetch:
src: "{{ filebeat_key_path }}/{{ filebeat_key_name }}"
dest: "{{ playbook_dir }}/roles/filebeat/files/{{ filebeat_key_name }}"
flat: yes
tags: logstash_fetch
@robrant
robrant / Logstash filebeat error
Created October 31, 2016 10:47
Logstash filebeat error
{:timestamp=>"2016-10-28T17:21:44.445000+0100", :message=>"Pipeline aborted due to error", :exception=>java.lang.NullPointerException, :backtrace=>["org.logstash.netty.PrivateKeyConverter.generatePkcs8(org/logstash/netty/PrivateKeyConverter.java:43)", "org.logstash.netty.PrivateKeyConverter.convert(org/logstash/netty/PrivateKeyConverter.java:39)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)", "RUBY.create_server(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-beats-3.1.0.beta4-java/lib/logstash/inputs/beats.rb:139)", "RUBY.register(/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-beats-3.1.0.beta4-java/lib/logstash/inputs/beats.rb:132)", "RUBY.start_inputs(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:311)", "org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)", "RUBY.start_inputs(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:310)", "RUBY.start_workers(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:187)", "RUB