Skip to content

Instantly share code, notes, and snippets.

View pedrotoliveira's full-sized avatar
:octocat:
Working from home

Pedro Thiago A. G. Oliveira pedrotoliveira

:octocat:
Working from home
View GitHub Profile
language: java
sudo: required
dist: trusty
before_install:
- sudo sh -c "echo 'deb http://download.mono-project.com/repo/debian wheezy main' > /etc/apt/sources.list.d/mono-xamarin.list"
- sudo sh -c "echo 'deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main' >> /etc/apt/sources.list.d/mono-xamarin.list"
- sudo apt-get -qq update
- sudo apt-get install --force-yes mono-devel
@pedrotoliveira
pedrotoliveira / mvnw-fix.sh
Created April 14, 2020 14:34 — forked from kbastani/mvnw-fix.sh
Adds a settings.xml file to your Spring Boot maven wrapper
#!/usr/bin/env bash
# Secure workaround for https://issues.sonatype.org/browse/MVNCENTRAL-1369
# Navigate to the root of your Spring Boot project where a Maven wrapper is present and run this script
cd .mvn/wrapper
wget https://gist.githubusercontent.com/kbastani/d4b4c92969ec5a22681bb3daa4a80343/raw/f166086ef051369383b02dfb74317cd07b6f2c6e/settings.xml
cd ../../
./mvnw clean install -s .mvn/wrapper/settings.xml
@pedrotoliveira
pedrotoliveira / megasena.html
Created January 7, 2018 20:17
brincadeira da mega
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Números da Megasena</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
@echo off
ipconfig /release
echo Reparando a conexão...
arp -d *
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
netsh interface ip set address "local" dhcp
ipconfig /renew
package br.gov.sp.tce.audesp.controller.servlet;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@pedrotoliveira
pedrotoliveira / Solution.java
Last active December 30, 2015 16:33
A Graph Solution to Find Paths.
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
@pedrotoliveira
pedrotoliveira / Solution.java
Last active December 28, 2015 16:28
Flipping bits
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCases = in.nextInt();
for (int i=0; i< testCases; i++) {
if (in.hasNextLong()) {
@pedrotoliveira
pedrotoliveira / EuclideanAlgorithm.java
Created December 23, 2015 12:17
Euclidean Algorithm
public class EuclideanAlgorithm {
private final List<Long> numbers;
public EuclideanAlgorithm(final List<Long> numbers) {
this.numbers = Collections.unmodifiableList(numbers);
}
public long calculateGCD() {
Iterator<Long> it = numbers.iterator();
@pedrotoliveira
pedrotoliveira / add_serializable.sh
Last active November 18, 2015 19:17
Add Serializable for all classes in project
#!/bin/bash
function findClassesToImplementSerializable() {
for filename in $(find . -name "*.java");
do
echo $filename | /bin/grep -v "test";
if [ "${?}" -eq 0 ]
then
echo "$filename";
changeline;
fi
@pedrotoliveira
pedrotoliveira / gist:9eb2b1932efe9274ba97
Last active August 29, 2015 14:04
onMessage method
@Override
public final void onMessage(final Message message, final Channel channel) throws IOException {
try {
logger.all().logInfo(String.format("Received Message: %s",message));
Assert.notNull(message, "Unknow message: " + message);
if (consumerEnabled()) {
T object = getObject(message);
this.beforeOnMessage(object);
R response = this.onMessage(object);
this.afterOnMessage(object);