Skip to content

Instantly share code, notes, and snippets.

View ararog's full-sized avatar

ararog ararog

  • Brazil
  • 09:51 (UTC -03:00)
View GitHub Profile
package main
import (
"json";
"flag";
"fmt";
"http";
"os";
"io";
)
events {
worker_connections 4096; ## Default: 1024
}
http {
upstream backend {
server web1:3000;
server web2:3000;
server web3:3000;
}
package com.atlantbh.nutch.filter.xpath;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
@ararog
ararog / plot1.jl
Last active November 26, 2015 15:56
Sample code that ilustrastes how plotting is done with Julia programming language.
# Installing and loading libraries if needed
using Gadfly
using DataFrames
using DataFramesMeta
using ZipFile
using HTTPClient.HTTPC
# Read computer available memory
#available_memory = memory.limit()
@ararog
ararog / monitor.ps1
Created November 5, 2013 10:01
This script does a computer monitor lookup.
[CmdletBinding(DefaultParameterSetName="ComputerName")]
param (
[Parameter(Mandatory = $FALSE, ParameterSetName="ComputerName", HelpMessage="Name of computer to check")]
[String]
$ComputerName
)
Function InArray($element, $array, $position) {
If($array.Count -eq 0) {
@ararog
ararog / helpers.js
Last active December 30, 2015 00:29
Javascript version of Days360 excel function.
function days360(initialDate, currentDate) {
var dateA = initialDate;
var dateB = currentDate;
var dayA = dateA.getDate();
var dayB = dateB.getDate();
@ararog
ararog / AnagramFinder.java
Last active July 28, 2016 19:47
This program takes a text file with a list of words and checks how many words can be formed with the letters provided by command line argument.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.commons.lang.StringUtils;
@ararog
ararog / site_checker.ps1
Created November 5, 2013 10:35
A powershell script that can be used to check if a site is up and running, full description can be found at: http://faces.eti.br/2011/07/28/checking-website-status-with-powershell/
function Show-MessageBox ($title, $msg) {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[Windows.Forms.MessageBox]::Show($msg, $title, [Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Warning, [System.Windows.Forms.MessageBoxDefaultButton]::Button1, [System.Windows.Forms.MessageBoxOptions]::DefaultDesktopOnly) | Out-Null
}
[string] $url = 'http://www.saidosofa.com.br'
[net.httpWebRequest] $req = [net.webRequest]::create($url)
$req.Method = "HEAD"
@ararog
ararog / MsgPackConverter.java
Created October 23, 2014 14:55
MessagePack converter for retrofit
package br.eti.faces.retrofit.converter;
import org.msgpack.MessagePack;
import org.msgpack.packer.Packer;
import org.msgpack.unpacker.Unpacker;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Type;
@ararog
ararog / TransformXml.groovy
Created November 5, 2013 10:34
A tool to apply a xml stylesheet into a source file and output the styled version to another file.
import javax.xml.transform.TransformerFactory
import javax.xml.transform.stream.StreamResult
import javax.xml.transform.stream.StreamSource
def cli = new CliBuilder( usage: 'groovy TransformXml.groovy -h -i inputfile -o output -x xsltfile...')
cli.h(longOpt:'help', 'usage information')
cli.i(argName:'input', longOpt:'input', args:1, required:true, type:GString, 'Directory/file for input')
cli.o(argName:'output', longOpt:'output', args:1, required:true, type:GString, 'Direcoty/file for output')
cli.x(argName:'xsltfile', longOpt:'xsltfile', args:1, required:true, type:GString, 'The transformation file')