Skip to content

Instantly share code, notes, and snippets.

View xSAVIKx's full-sized avatar
🇺🇦

Yurii Serhiichuk xSAVIKx

🇺🇦
View GitHub Profile
@xSAVIKx
xSAVIKx / long-running-tasks-example.workflows.yaml
Created April 20, 2024 20:18
Tasks Runner e2e test GCP Workflows workflow
main:
params: [input]
steps:
- checkSleepTimeout:
switch:
- condition: ${"sleepTimeoutSeconds" in input}
assign:
- sleepTimeoutSeconds: ${int(input.sleepTimeoutSeconds)}
- condition: true
assign:
@xSAVIKx
xSAVIKx / sample-long-running-gcp-workflow.workflows.yaml
Last active January 9, 2023 11:28
Sample GCP Workflow with long-running architecture
main:
steps:
- createCallback:
call: events.create_callback_endpoint
args:
http_callback_method: "POST"
result: callbackDetails
- createHttpCallPayload:
assign:
- httpCallPayload: {}
@xSAVIKx
xSAVIKx / sample-gcp-workflow.workflows.yaml
Last active January 9, 2023 11:28
A sample GCP Workflow
main:
steps:
- getCurrentTime:
call: http.get
args:
url: https://us-central1-workflowsample.cloudfunctions.net/datetime
result: currentDateTime
- returnOutput:
return: ${currentDateTime.body.dayOfTheWeek}
@xSAVIKx
xSAVIKx / radix-converter.js
Last active October 30, 2019 20:38
Converts numbers in string representation to their int representation using supplied radix.
const glbl = global || globalThis || window;
const radixes = '0123456789абвгдеёжзийклмнопрстуфхцчшщъыьэюя';
const parseInt = (text, radix) => {
const actualRadix = radixes.indexOf(radix);
const result = glbl.parseInt(text, actualRadix);
return result;
};
console.log(parseInt('210', 3)); // 21
@xSAVIKx
xSAVIKx / Demo.java
Created March 20, 2017 21:10
JAXB Unmarshalling from Source example
import javax.xml.bind.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class Demo {
public static void main(String[] args) throws JAXBException, IOException {
JAXBContext context = JAXBContext.newInstance(Type.class, InnerType.class);
@xSAVIKx
xSAVIKx / Demo.java
Created March 20, 2017 20:54
JAXB Custom Adapter Example
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
/**
* Created by User on 20.03.2017.
*/
public class Demo {
public static void main(String[] args) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Type.class, InnerType.class);
@xSAVIKx
xSAVIKx / logstash.xml
Last active January 15, 2017 20:10
Logstash IDEA configuration
<filetype binary="false" description="Logstash Config" name="Logstash Config">
<highlighting>
<options>
<option name="LINE_COMMENT" value="#" />
<option name="COMMENT_START" value="" />
<option name="COMMENT_END" value="" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
package school.lemon.changerequest.java.pr1.lesson;
import java.util.Arrays;
/**
* Created by User on 19.12.2016.
*/
public class Array {
private int[] array;
private int size;
@xSAVIKx
xSAVIKx / BarcodeGenerator.java
Created July 26, 2016 13:11
BarcodeGenerator
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
public class BarcodeGenerator {
public static void main(String[] args) throws IOException {
@xSAVIKx
xSAVIKx / HttpsRequestPoster.java
Created April 28, 2016 13:04
Simple HTTPS POST request using raw JAVA for quering web-form
import javax.net.ssl.*;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;