Skip to content

Instantly share code, notes, and snippets.

@zouzias
zouzias / .gitignore
Created July 12, 2014 17:48 — forked from kogakure/.gitignore
Ignore files for Latex Projects
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@zouzias
zouzias / Vagrantfile.rb
Created July 24, 2014 16:55
Vagrant for multiple machines
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Multi-VM Configuration: Builds Web, Application, and Database Servers using JSON config file
# Configures VMs based on Hosted Chef Server defined Environment and Node (vs. Roles)
# Author: Gary A. Stafford
# read vm and chef configurations from JSON files
nodes_config = (JSON.parse(File.read("nodes.json")))['nodes']
chef_config = (JSON.parse(File.read("chef.json")))['chef']
@zouzias
zouzias / vagrant-copy-ssh-id.sh
Last active August 29, 2015 14:04
Vagrant:Copy ssh private ssh key to all virtual machines
#!/bin/bash
# Iterate over all listening ssh ports of all VMs
for VM_PORT in `vagrant ssh-config | grep Port | awk '{ print $2}'`
do
echo "Copying ~/.vagrant.d/insecure_private_key to host with ssh listening on port ${VM_PORT}"
scp -i ~/.vagrant.d/insecure_private_key -P ${VM_PORT} ~/.vagrant.d/insecure_private_key vagrant@localhost:~/.ssh/id_rsa
done
@zouzias
zouzias / restapi
Created October 20, 2014 09:28
Create a rest API with Jersy (quickly)
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service-webapp -Dpackage=com.example \
-DarchetypeVersion=2.13
Resource:
https://jersey.java.net/documentation/latest/getting-started.html
@zouzias
zouzias / tomcat7.logstash.conf
Created November 26, 2014 16:35
Apache Tomcat Logstash Filter
# Based on http://spredzy.wordpress.com/2013/03/02/monitor-your-cluster-of-tomcat-applications-with-logstash-and-kibana/
# Changed URIPARAMS with GREEDYDATA. URIPARAMS has problem with POST (i.e., no url parameters)
filter {
grok {
type => "access-log"
pattern => "%{IP:client} \- \- \[%{DATA:datestamp}\] \"%{WORD:method} %{URIPATH:uri_path}%{GREEDYDATA:params} %{DATA:protocol}\" %{NUMBER:code} %{NUMBER:bytes}"
@zouzias
zouzias / gist:ab5d3b0881645e7e8ec7
Created December 3, 2014 11:14
Redirect ports using IPTABLES
# Re-directs port 80 to 5601
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5601
# Apply
sudo service iptables restart
# Ubuntu
@zouzias
zouzias / nginx-tomcat.conf
Created December 15, 2014 11:27
Nginx: Proxy Configuration for Apache Tomcat
# Simple proxying to tomcat
server {
listen nginx.server.com:80;
server_name nginx.server.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@zouzias
zouzias / client_guide
Created February 18, 2015 15:21
Install nagios on CentOS client
> wget dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
> rpm -ivh epel-release-6-8.noarch.rpm
> yum install nrpe nagios-plugins-all openssl
Then go to '/etc/nagios/nrpe.cfg '
and update the
allowed_hosts=nagios.change_me.com
@zouzias
zouzias / hdfs
Created May 13, 2015 11:45
HDFS useful commands
# Summary of HDFS filesystem
sudo su hdfs -c "hdfs dfsadmin -report"
# Check the HDFS filesystem (detail block file)
sudo su hdfs -c "hdfs fsck / -files -blocks"
# Generic Aliases
alias ll='ls -latr' # List all file in long list format by modification time
alias ..='cd ..' # Go up one directory
alias ...='cd ../..' # Go up two directories
alias ....='cd ../../..' # Go up three directories
alias -- -='cd -' # Go back
alias c='clear' # Clear Screen
alias k='clear' # Clear Screen
alias cls='clear' # Clear Screen
alias _="sudo" # Execute with sudo