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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:v="urn:schemas-microsoft-com:vml" | |
xmlns:o="urn:schemas-microsoft-com:office:office"> | |
<head> | |
<!--[if gte mso 9]><xml> | |
<o:OfficeDocumentSettings> | |
<o:AllowPNG/> | |
<o:PixelsPerInch>96</o:PixelsPerInch> | |
</o:OfficeDocumentSettings> |
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
#!/usr/bin/env sh | |
set -e | |
key=`openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout 2>/dev/null` | |
# Extract the public key and remove the EC prefix 0x04 | |
pub=`echo "${key}" | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//'` | |
# Extract the private key and remove the leading zero byte | |
priv=`echo "${key}" | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//'` |
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
#!/usr/bin/env bash | |
set -e | |
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key | |
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub | |
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv | |
echo "Private Key: \n" | |
cat priv |
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
#!/usr/bin/env bash | |
set -e | |
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key | |
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub | |
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv |
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
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key | |
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub | |
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv |
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
public class FileMetadata { | |
public String id; | |
public String fileName; | |
public long length; | |
public byte[] contents; |
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
public class FeignClient { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
synchronousTest(); | |
asyncTest(); | |
} | |
private static void synchronousTest() { | |
FileApi fileApi = FileApiFactory.getSynchronousFileAPI(); |
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
@RequestMapping("file") | |
public interface AsyncFileApi { | |
@GetMapping("/{id}") | |
CompletableFuture<FileMetadata> getFile(@PathVariable String id); | |
@GetMapping("/search") | |
CompletableFuture<List<FileMetadata>> searchFiles(@RequestParam(name = "name") String name); | |
@PostMapping("/save") |
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
// Custom datetime serializer | |
private static final LocalDateTimeSerializer CUSTOM_DATE_SERIALIZER = | |
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("dd-MMM-yyyy HH:mm")); | |
// Custom datetime deserializer | |
private static final LocalDateTimeDeserializer CUSTOM_DATE_DESERIALIZER = | |
new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("dd-MMM-yyyy HH:mm")); | |
// Feign based API | |
public static FileApi getFileAPI() { |
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
public static FileApi getFileAPI() { | |
String URL = "http://localhost:8080"; // This must be passed as an ENV variable | |
return Feign.builder() | |
.contract(new SpringMvcContract()) | |
.target(FileApi.class, URL); | |
} |
NewerOlder