Skip to content

Instantly share code, notes, and snippets.

View vagnernogueira's full-sized avatar

Vagner Nogueira vagnernogueira

View GitHub Profile
@luis-fss
luis-fss / convertUTF8toISO-description.txt
Created March 1, 2012 20:48
Convertendo de UTF-8 para ISO-8859-1 em Java: A solução definitiva
Recentemente enfrentei problemas em um aplicativo Android que desenvolvi, o qual se comunica com o banco de dados de um dos sistemas da empresa, codificado em ISO-8859-1 (Firebird) através de um web service.
Os dados eram gravados de forma errada, muitas vezes truncavam e as vezes apareciam caracteres estranhos.
Depois de algumas tentativas, cheguei até a seguinte solução:
@jcraane
jcraane / logback.xml
Created July 3, 2013 18:26
Sample logback.xml file with console and rolling file appender. The rollover is time based (daily) and size based, 5MB.
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links
@daniellevass
daniellevass / starting_library_project_AS.md
Last active August 30, 2020 00:48
Getting Started with a library project in Android Studio

Getting Started with a library project in Android Studio

So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).

Create Projects

The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.

Fix Up Library Project

@vagnernogueira
vagnernogueira / .bashrc
Last active February 6, 2020 05:45
Aliases in .bashrc on CentOS7
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
@vagnernogueira
vagnernogueira / bogonsblocks.sh
Last active May 25, 2022 13:08
Firewall-D and IPSETs
#!/bin/bash
# geoip on firewall in centos 7
# this file: /etc/cron.weekly/bogonsblocks.sh
# sudo chmod +x /etc/cron.weekly/bogonsblocks.sh
## create tmp dir
# sudo mkdir /var/tmp/ipbogons
## create list on ipset
# sudo ipset create bogonslist hash:net maxelem 1000000
## create rule on firewall-cmd
@tunjos
tunjos / copyReleaseApkToCustomDir.gradle
Last active December 8, 2021 03:10
Copy release apk to custom directory
def publish = project.tasks.create("copyReleaseApkToCustomDir")
publish.description "Copies release apk to custom directory"
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.outputs.each { output ->
if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) {
def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy)
def outputFile = output.outputFile
println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.apk"
@jgilfelt
jgilfelt / CurlLoggingInterceptor.java
Created January 9, 2016 15:34
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: