This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"log" | |
"os" | |
) | |
var ( | |
logFile = flag.String("log-file", "", "Log file name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME := stashkins | |
ARCH := amd64 | |
VERSION := 1.0 | |
DATE := $(shell date) | |
COMMIT_ID := $(shell git rev-parse --short HEAD) | |
SDK_INFO := $(shell go version) | |
LD_FLAGS := -X main.version $(VERSION) -X main.commit $(COMMIT_ID) -X main.buildTime '$(DATE)' -X main.sdkInfo '$(SDK_INFO)' | |
all: clean binaries package |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'load-path "/Users/mpetrovic/.emacs.d/") | |
(require 'go-mode-load) | |
(add-hook 'before-save-hook 'gofmt-before-save) | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") | |
(ac-config-default) | |
(require 'go-autocomplete) | |
(require 'auto-complete-config) | |
;; (setq auto-save-visited-file-name t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Good: | |
@Configuration | |
@EnableSwagger | |
public class SwaggerConfiguration { | |
public static final List<String> DEFAULT_INCLUDE_PATTERNS = Arrays.asList("^(?!/error|/internal/).*$"); | |
private static final String SWAGGER_GROUP = ""; | |
@Bean | |
public SwaggerSpringMvcPlugin swaggerPlugin(SpringSwaggerConfig springSwaggerConfig) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if err, ok := err.(net.Error); ok { | |
if err.Timeout() { | |
responseCode = http.StatusGatewayTimeout | |
fmt.Printf("Timeout\n") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In org.apache.curator.x.discovery.ServiceInstanceBuilder | |
private static final AtomicReference<LocalIpFilter> localIpFilter = new AtomicReference<LocalIpFilter> | |
( | |
new LocalIpFilter() | |
{ | |
@Override | |
public boolean use(NetworkInterface nif, InetAddress adr) throws SocketException | |
{ | |
return (adr != null) && !adr.isLoopbackAddress() && (nif.isPointToPoint() || !adr.isLinkLocalAddress()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configurations { | |
jaxws | |
} | |
dependencies { | |
jaxws 'com.sun.xml.ws:jaxws-tools:2.1.4' | |
} | |
task wsimport { | |
ext.destDir = file("${projectDir}/src/main/generated") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private byte[] drainInputStream(InputStream is) throws IOException { | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
byte[] buffer = new byte[8192]; | |
int bytesRead; | |
while ((bytesRead = is.read(buffer)) != -1) { | |
baos.write(buffer, 0, bytesRead); | |
} | |
return baos.toByteArray(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat ~/bin/jsonpp.py | |
#!/usr/bin/python | |
import sys, json | |
print json.dumps(json.load(sys.stdin), sort_keys=True, indent=4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
afterEvaluate { project -> | |
configure(subprojects.findAll { new File(it.projectDir, "src").exists() }) { | |
apply plugin: 'java' | |
compileJava { | |
options.compilerArgs << '-Xlint:unchecked' | |
} | |
sourceCompatibility = targetCompatibility = 1.6 | |
tasks.withType(Test) { |