Skip to content

Instantly share code, notes, and snippets.

View jayv's full-sized avatar

Jo Voordeckers jayv

View GitHub Profile
@jayv
jayv / install-graphite-ubuntu-12.04.sh
Created October 25, 2012 21:11 — forked from jgeurts/install-graphite-ubuntu-12.04.sh
Install Graphite 0.9.10 on Ubuntu 12.04
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
sudo apt-get update
sudo apt-get upgrade
@jayv
jayv / gist:3957788
Created October 26, 2012 09:14
install statsd on ubuntu 12.04
# Install NodeJS
sudo apt-get install python-software-properties git-core
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install Statsd
git clone https://github.com/etsy/statsd.git
@jayv
jayv / install_graylog.sh
Created October 26, 2012 12:11 — forked from ctavan/install_graylog.sh
Install mongodb, elasticsearch, graylog2, logstash on Ubuntu 12.04
#!/bin/bash
# WARNING: Don't use this in production since all passwords are kept at their default.
# mongodb
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo -e "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen\n" > /etc/apt/sources.list.d/mongodb-10gen.list
apt-get update
apt-get install -y mongodb-10gen
@jayv
jayv / kafka-offset-tail.sh
Created October 23, 2015 02:18
Move offsets for a given kafka topic and group to the tail of the queue
env=prod
topic=pns.stream
group=renderered
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafka-seed-1.${env}.livefyre.com:9092 --topic ${topic} --time -1 | perl -pe s/\(${topic}\):\(\\d+:\\d+\)/\\/consumers\\/${group}\\/offsets\\/\$1\\/\$2/ | kafka-run-class.sh kafka.tools.ImportZkOffsets --zkconnect zk-seed-1.${env}.livefyre.com --input-file /dev/stdin
@jayv
jayv / shl.sh
Created October 30, 2015 18:48
Syntax highlighting code on the clipboard to RTF colored and formatted to paste into Keynote
pbpaste | highlight -O rtf /dev/stdin --font-size 34 --font Menlo --style molokai -W -J 80 -j 3 --src-lang java | pbcopy
import re
import sys
import subprocess
from collections import defaultdict
def move_tail(topic, groups, path="/opt/kafka/bin/", env="staging"):
command = r"%skafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafka-seed-1.%s.livefyre.com:9092 --topic %s --time -1 "
cli = command % (path, env, topic)
proc = subprocess.Popen(cli, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
@jayv
jayv / mute-apple-mail-thread.applescript
Last active February 2, 2019 21:18
AppleScript for use in an Automator Service to bind to a shortcut to mute threads in Mail.app (like gmail mute)
on run {input, parameters}
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
if "Mail" is in activeApp then
tell application "Mail"
-- Collect the rules that already exist
set ruleNames to {}
repeat with ruleNumber from 1 to count rules
@jayv
jayv / ExampleSpec.scala
Last active March 4, 2017 20:37
Mocking CDI Events doesn't work out of the box with ScalaMock, extend from the MockEventFactory and create an Event[T] using mockEvent[T]
import MockEventFactory
import javax.enterprise.event.Event
import org.junit.runner.RunWith
import org.scalamock.scalatest.MockFactory
import org.scalatest.junit.JUnitRunner
import org.scalatest.FlatSpec
@RunWith(classOf[JUnitRunner])
class ExampleSpec extends FlatSpec with MockFactory with MockEventFactory {
@jayv
jayv / git-transplant.sh
Last active July 27, 2017 18:37
git rebase transplant
git rebase --onto <target> <common-forkpoint> <feature>
will detach <feature> from <common-forkpoint> and reattach on top of <target>
@jayv
jayv / jenkins-autofav-clear.groovy
Last active February 15, 2018 01:41
clear jenkins favorites for users of multi-branch
def user = User.get("<your user id>")
user.getProperty(hudson.plugins.favorite.user.FavoriteUserProperty.class).data.clear()
user.save()
// Execute here:
http://lfbuild.corp.adobe.com:8080/script