Skip to content

Instantly share code, notes, and snippets.

View thigm85's full-sized avatar

Thiago G. Martins thigm85

View GitHub Profile
# Figure 1
ggplot(GermanCredit, aes(x = Class)) +
geom_bar(aes(y = (..count..)/sum(..count..))) +
labs(y = "prob.")
thigm85 / YahooFinance_odb_table.R
Last active December 17, 2015 12:09
This is the first step to establish a simple and free database to hold stock quotes downloaded from Yahoo Finance!
database_path = "~/example_path/my_database.odb"
# Create a database
# Connect to the database
ODB <-
predictors = data.frame(x1 = rnorm(1000, mean = 5, sd = 2),
x2 = rexp(1000, rate=10))
p1 = ggplot(predictors) + geom_point(aes(x = x1, y = x2))
thigm85 / node_js_first_application.js
Created January 20, 2016 14:23
A minimal node.js application
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
<title>File Uploading Form</title>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form action="" method="POST"
<input type="file" name="file" size="50" />
thigm85 / pre_post_clean_pom.xml
Created February 17, 2016 21:25
POM file where a goal is executed in the pre-clean, clean and post-clean phases of the clean lifecycle. Reference:
<project xmlns=""
thigm85 / mininal-maven-pom.xml
Created February 17, 2016 21:50 — forked from torgeir/minimal-maven-pom.xml
A minimal maven pom.xml
<project xmlns=""
thigm85 /
Created March 2, 2016 14:42
Code sample for writing python unit tests with the unittest module.
import unittest
# Subclass TestCase class
class TestUM(unittest.TestCase):
# Execute code prior to unit tests being run
def setUp(self):
# create unit tests using assert methods
<?xml version="1.0"?>
<country name="Liechtenstein">
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/>
<country name="Singapore">
import xml.etree.ElementTree as ET
# parse XML from a file
tree = ET.parse(file_path) # parse the file and obtain ElementTree obj
root = tree.getroot() # get the root Element obj
# parse XML in a string format
root = ET.fromstring(country_data_as_string)
root = ET.XML(country_data_as_string) # equivalent to above