Skip to content

Instantly share code, notes, and snippets.

View ph's full-sized avatar
💭
Where is the Microsoft Paperclip?

Pier-Hugues Pellerin ph

💭
Where is the Microsoft Paperclip?
View GitHub Profile
@graphaelli
graphaelli / aws-session-env.py
Created December 29, 2017 18:21
Export environment variables for AWS cli w/MFA.
#!/usr/bin/env python
"""Export environment variables for AWS cli w/MFA.
eval $(aws-session-env.py $1)
"""
import argparse
import os
import boto3
@jsvd
jsvd / lpv.rb
Last active March 18, 2021 10:51
logstash plugin version
#!/usr/bin/env ruby
# use ./lpv.rb logstash_version plugin_name
#
# example:
# % ./lpv.rb 5.2.0 logstash-output-elasticsearch
# logstash-output-elasticsearch 6.2.4 https://github.com/logstash-plugins/logstash-output-elasticsearch/tree/v6.2.4
require 'net/http'
anonymous
anonymous / kafka.sh
Created May 15, 2015 20:09
#!/bin/bash
KAFKA_URL='http://mirror.cogentco.com/pub/apache/kafka/0.8.2.1/kafka_2.10-0.8.2.1.tgz'
KAFKA_HOME='/tmp/kafka-es'
DATA_DIR_KAFKA='/tmp/kafka-logs'
DATA_DIR_ZOOKEEPER='/tmp/zookeeper'
ZOOKEEPER_PID=$KAFKA_HOME/zookeeper.pid
KAFKA_PID=$KAFKA_HOME/kafka.pid
require "benchmark/ips"
require "granola"
require "json"
require "msgpack"
require "multi_json"
require "oj"
require "yajl"
User = Struct.new(:name, :age)
anonymous
anonymous / kafka.sh
Created March 23, 2015 21:24
#!/bin/bash
KAFKA_URL='http://mirror.cogentco.com/pub/apache/kafka/0.8.2.1/kafka_2.10-0.8.2.1.tgz'
KAFKA_HOME='/tmp/kafka-es'
DATA_DIR_KAFKA='/tmp/kafka-logs'
DATA_DIR_ZOOKEEPER='/tmp/zookeeper'
ZOOKEEPER_PID=$KAFKA_HOME/zookeeper.pid
KAFKA_PID=$KAFKA_HOME/kafka.pid
@jsvd
jsvd / gist:c4b030daf6c76ca8b77a
Last active August 29, 2015 14:13
list plugins that have diferences between the last tag and master
# needs a repos variable with a list of organization/plugin items
echo "repository,last_tag,commits_ahead_master,changes_against_master"
for repo in "${repos[@]}"; do
last_tag=`curl -u "$CREDENTIALS" -s https://api.github.com/repos/$repo/tags | jq -r ".[0].name"`
if [ $last_tag == "null" ]; then
continue
fi
ahead_commits=`curl -u "$CREDENTIALS" -s https://api.github.com/repos/$repo/compare/$last_tag...master | jq -r ".ahead_by"`
if [ $ahead_commits != "null" ] && [ "$ahead_commits" -gt 0 ]; then
@sjl
sjl / ext.vim
Created December 15, 2014 18:58
ways to run external commands in vim
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
:!uptime
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
@rothgar
rothgar / main.yml
Last active September 10, 2024 09:53
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@silviud
silviud / mysql.yml
Last active April 12, 2017 17:49
Debian/Ubuntu install Percona Server with Ansible
# file for pressed
# password is empty
percona-server-server-5.6 percona-server-server/root_password password
percona-server-server-5.6 percona-server-server/root_password_again password
# playbook
---
@garethrees
garethrees / gist:5591027
Last active October 14, 2020 19:44
Ansible set timezone on Ubuntu host
- name: Group by Distribution
hosts: all
tasks:
- group_by: key=${ansible_distribution}
- name: Set Time Zone
hosts: Ubuntu
gather_facts: False
tasks:
- name: Set timezone variables