Skip to content

Instantly share code, notes, and snippets.

View jonyfs's full-sized avatar

Jony Santos jonyfs

View GitHub Profile
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active May 3, 2024 11:06
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 user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
@reddikih
reddikih / convertBytebufferToString.java
Last active April 10, 2020 18:17
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
rambabusaravanan / .gitconfig
Last active May 30, 2025 10:16
Git Diff and Merge Tool - IntelliJ IDEA
# Linux
# add the following to "~/.gitconfig" file
[merge]
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
[diff]
@facundofarias
facundofarias / WebSocketResource.java
Last active January 28, 2019 14:10
Enabling WebSockets on Jersey (Tyrus)
import java.io.IOException;
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
gilyes / Backup, restore postgres in docker container
Last active January 18, 2025 00:57
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@bcalmac
bcalmac / CaseInsensitiveSetMultimap.java
Created March 10, 2015 18:34
Case insensitive SetMultimap using Guava
import com.google.common.collect.ForwardingSetMultimap;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
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> {
@steppat
steppat / gist:4df7e2257d7e10c50a30
Last active August 29, 2015 14:16
Simple RAML file
Obs: http://tinyurl.com/raml-file
-----
#%RAML 0.8
baseUri: http://mocksvc.mulesoft.com/mocks/a296cd19-32ae-4c10-ba8a-ffb527bd4f24
title: pagamentos
version: 1.0
mediaType: application/json
@dnozay
dnozay / _Jenkins+Script+Console.md
Last active May 21, 2025 00:30
jenkins groovy scripts collection.
@carlcantprogram
carlcantprogram / gist:42fbecb399af7e8ce4c0
Last active June 29, 2018 13:01
Oracle JDK7 Download Install powershell
$url = 'http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-windows-x64.exe'
$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
ggtools / TestMongoConfig.java
Created October 7, 2014 06:51
A Spring configuration to use an embedded MongoDB during tests
@Configuration
public class TestMongoConfig {
private static final MongodStarter starter = MongodStarter.getDefaultInstance();
@SuppressWarnings("SpringJavaAutowiringInspection")
@Autowired
private MongoProperties properties;
@Autowired(required = false)
private MongoClientOptions options;