Skip to content

Instantly share code, notes, and snippets.


Jony Santos jonyfs

View GitHub Profile
ateucher /
Last active Sep 1, 2021
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global 'Firstname Lastname'
    git config --global ''
reddikih /
Last active Apr 10, 2020
java convert bytebuffer to string
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
Method Usage
ByteBuffer bf = string2ByteBuffer("test", Charset.forName("UTF-8"));
rambabusaravanan / .gitconfig
Last active Aug 31, 2021
Git Diff and Merge Tool - IntelliJ IDEA
View .gitconfig
# Linux
# add the following to "~/.gitconfig" file
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
facundofarias /
Last active Jan 28, 2019
Enabling WebSockets on Jersey (Tyrus)
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.slf4j.Logger;
gilyes / Backup, restore postgres in docker container
Last active Aug 25, 2021
Backup/restore postgres in docker container
View Backup, restore postgres in docker container
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
bcalmac /
Created Mar 10, 2015
Case insensitive SetMultimap using Guava
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/** SetMultimap decorator that coverts keys to lower case before delegation */
public class CaseInsensitiveSetMultimap<V> extends ForwardingSetMultimap<String, V> {
View gist:4df7e2257d7e10c50a30
#%RAML 0.8
title: pagamentos
version: 1.0
mediaType: application/json
dnozay /
Last active Jul 29, 2021
jenkins groovy scripts collection.
carlcantprogram / gist:42fbecb399af7e8ce4c0
Last active Jun 29, 2018
Oracle JDK7 Download Install powershell
View gist:42fbecb399af7e8ce4c0
$url = ''
$filename = $url.Substring($url.LastIndexOf("/") + 1);
$client = new-object System.Net.WebClient;
$client.Headers.Add("Cookie", "oraclelicense=accept-securebackup-cookie");
$client.DownloadFile( $url, $filename );
$result = (Start-Process -FilePath $filename -ArgumentList "/quiet /qn /norestart /l* jdk7_install.log" -Wait -Passthru).ExitCode;
echo $result;
Get-WmiObject -Class Win32_Product -Filter "Name LIKE '%java%SE Development Kit 7%'";
# IdentifyingNumber : {64A3A4F4-B792-11D6-A78A-00B0D0170600}
ggtools /
Created Oct 7, 2014
A Spring configuration to use an embedded MongoDB during tests
public class TestMongoConfig {
private static final MongodStarter starter = MongodStarter.getDefaultInstance();
private MongoProperties properties;
@Autowired(required = false)
private MongoClientOptions options;