Skip to content

Instantly share code, notes, and snippets.

View vaskoz's full-sized avatar
🏠
Working from home

Vasko Zdravevski vaskoz

🏠
Working from home
View GitHub Profile
@vaskoz
vaskoz / strategy.go
Created April 8, 2014 18:33
Golang strategy pattern
package main
import "fmt"
type Strategy func(string, string) string
type Strategic interface {
SetStrategy(Strategy)
Result() string
}
@vaskoz
vaskoz / Http.java
Last active June 28, 2018 20:40
JDK11 new GCs
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Http {
public static void main(String[] args) throws Exception {
var httpClient = HttpClient.newBuilder().build();
var response = httpClient.send(HttpRequest.newBuilder(URI.create("https://www.google.com/")).build(),
HttpResponse.BodyHandlers.ofString());
@vaskoz
vaskoz / Deps.java
Created July 17, 2013 07:40
An example of "jdeps" command line tool in Java 8 with JDeps usage help and 3 different outputs of -v (verbose) -P (profile) and -R (recursive)
import java.util.Set;
import java.util.HashSet;
public class Deps {
public static void main(String[] args) {
System.out.println(Math.random());
Set<String> set = new HashSet<>();
}
}
@vaskoz
vaskoz / README.md
Created June 17, 2018 16:33 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

OP: @leonardofed founder @ plainflow.


@vaskoz
vaskoz / StringHashCollisionGenerator.java
Created June 4, 2013 03:44
Generates Java Strings with the same hashCode.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class StringHashCollisionGenerator {
public static void main(String[] args) {
if (args.length != 1) {
printUsage();
System.exit(1);
@vaskoz
vaskoz / AlgorithmL.java
Created June 5, 2013 06:41
Implementation of Lexicographic Permutation Generation. Algorithm L by Knuth. Usage: java AlgorithmL "122233344555"
import java.util.Arrays;
public class AlgorithmL {
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Usage: provide a string (quoted if multiword)");
System.exit(1);
}
char[] letters = args[0].toCharArray();
Arrays.sort(letters);
Hi there from a C++ program
2018/01/22 05:09:25 <nil>
START RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Version: $LATEST
Hi there from a C++ program
2018/01/22 05:09:25 <nil>
END RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b
REPORT RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Duration: 179.64 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 14 MB
RequestId: 6a2e5b39-ff32-11e7-805a-630e62a1c78b Process exited before completing request
package main
import (
"fmt"
"sync"
)
type Connection interface {
Send([]byte) error
Release()
go test -parallel=1 -race -v parallel_test.go
=== RUN TestOne
=== PAUSE TestOne
=== RUN TestTwo
=== PAUSE TestTwo
=== CONT TestTwo
=== CONT TestOne
--- PASS: TestTwo (0.00s)
--- PASS: TestOne (0.00s)
PASS
package main
import (
"context"
"log"
"math/rand"
"os"
"runtime/trace"
"sync"
"time"