Skip to content

Instantly share code, notes, and snippets.

@zouzias
zouzias / dblp_parser.rb
Created June 11, 2015 04:56
Iterate over DBLP database
#!/usr/bin/env ruby
require 'nokogiri'
require './xml_parser.rb'
file="dblp.xml"
Xml::Parser.new(Nokogiri::XML::Reader(open(file))) do
inside_element 'article' do
for_element 'author' do puts "Author: #{inner_xml}" end
# Recipe for scala-2.10.0-RC5
require 'formula'
class ScalaCompletion < Formula
homepage 'http://www.scala-lang.org/'
url 'https://raw.github.com/scala/scala-dist/27bc0c25145a83691e3678c7dda602e765e13413/completion.d/2.9.1/scala'
version '2.9.1'
sha1 'e2fd99fe31a9fb687a2deaf049265c605692c997'
@zouzias
zouzias / checkMD5Dir.sh
Created July 7, 2015 08:02
MD5: Check md5 of all files from a directory
#!/bin/bash
# Check md5 from all files in a dir. It assumes that for each file "filename.txt" there exists a "filename.txt.md5" corresponding file
FILES=`ls *`
for f in $FILES
do
# echo "Processing $f"
MD5=`md5 $f`
TRUE_MD5=`cat $f.md5`
@zouzias
zouzias / csvToHive.txt
Last active September 14, 2015 08:51
Import CSV data into Hive
# 1) Copy namefile.csv into HDFS
hadoop fs -put /path/on/localsystem /path/to/hdfs
# Start Hive shell . Just type hive
hive
# in your shell
# 2) Create table and show it.
create table example1(name String, address String, price int) row format delimited fields terminated by ',' ESCAPED BY '\\' stored as textfile;
@zouzias
zouzias / Remove all git tags
Last active September 8, 2015 10:27 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@zouzias
zouzias / nagios-ubuntu.txt
Created September 24, 2015 15:16
Setup Nagios Ubuntu Tomcat Jmeter
1 ) Install nagios on Ubuntu using the following guide.
https://help.ubuntu.com/lts/serverguide/nagios.html
2) Install the Jmeter and Tomcat Plugin from nagios exchange.
http://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/Apache-Tomcat/check_tomcat-2Epl/details
@zouzias
zouzias / introrx.md
Created September 28, 2015 19:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@zouzias
zouzias / aliases.txt
Last active October 2, 2015 18:45
My git aliases
# Add the following to your ~/.bashrc or ~/.profile file
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'
@zouzias
zouzias / countJavaLOC.sh
Created October 8, 2015 15:10
Java: Count lines of code
Type the following command
`find . -name '*.java' | xargs wc -l`
for java projects.
Source: http://stackoverflow.com/questions/10661636/how-to-count-lines-in-a-netbeans-project
@zouzias
zouzias / apache_nutch_with_mongodb.sh
Last active October 18, 2015 16:44
Install MongoDB 3.0, Elasticsearch 1.7 and Apache Nutch 2.0 (Ubuntu 14.04)
#######################
# Install Elasticsearch
#######################
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list
sudo apt-get update && sudo apt-get install -y elasticsearch
sudo update-rc.d elasticsearch defaults 95 10