Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Willian Antunes willianantunes

🎯
Focusing
Block or report user

Report or block willianantunes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@willianantunes
willianantunes / check-image-build-it-if-needed.sh
Last active Jul 27, 2019
Check if an image exists and built it if not
View check-image-build-it-if-needed.sh
function docker_tag_exists() {
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"
if [[ $? == 0 ]]; then
echo $IMAGE_META
@willianantunes
willianantunes / set_env_variable.py
Created Jul 7, 2019
Sample logic about how to set variable on Azure DevOps
View set_env_variable.py
import os
import sys
branch_name: str = sys.argv[1]
print(f"Received argument: {branch_name}")
env_image_type = "ENV_IMAGE_TYPE"
def set_value(key, value):
print(f"Set key {key} as {value}")
@willianantunes
willianantunes / version_strategy.py
Last active Jul 25, 2019
Python Script following SemVer (Semantic Versioning) integrated with GitHub to use in Azure DevOps
View version_strategy.py
import json
import sys
import urllib.request
def set_value(key, value):
print(f"Set key {key} as {value}")
print(f"##vso[task.setvariable variable={key};]{value}")
@willianantunes
willianantunes / django_console.py
Created Mar 2, 2019
Starting script to enable Django Console in IntelliJ IDEA Ultimate
View django_console.py
import os
import sys
from runpy import run_module
import django
from django.core import management
print(f"Python {sys.version} on {sys.platform}")
print(f"Django {django.get_version()}")
print(f"Current dir: {os.getcwd()}")
View PointCuts.java
package br.com.globo.aop;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class PointCuts {
@willianantunes
willianantunes / HttpConnectProxyFactory.java
Created Oct 9, 2018
Connection to a SOCKET SERVER via HTTP proxy
View HttpConnectProxyFactory.java
package com.mysql.cj.protocol;
import com.mysql.cj.conf.PropertyDefinitions;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.Socket;
View HttpProxyInitialiser.java
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.util.Optional;
import static java.lang.String.join;
import static java.util.Arrays.asList;
/**
View jasmine-maven-plugin-sample-configuration.xml
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>3.0-alpha-01</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
View SampleControllerAspect.java
@Aspect
@Component
public class SampleControllerAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(SampleControllerAspect.class);
@Around("execution(* br.com.globo.controller.SampleController.sample(String)) && args(honestSampleHeader)")
public ModelAndView aroundWallMethod(ProceedingJoinPoint proceedingJoinPoint, String honestSampleHeader) throws Throwable {
LOGGER.debug("What was intercepted: {}", honestSampleHeader);
View SampleController.java
@Controller
public class SampleController {
private static final Logger LOGGER = LoggerFactory.getLogger(SampleController.class);
@Autowired
private SampleService sampleService;
@GetMapping(REQUEST_PATH_SAMPLE)
public ModelAndView sample(@RequestHeader(HONEST_SAMPLE_HEADER) String honestSampleHeader) {
You can’t perform that action at this time.