Skip to content

Instantly share code, notes, and snippets.

View hackerzhut's full-sized avatar

Sara hackerzhut

View GitHub Profile
@hackerzhut
hackerzhut / Jenkinsfile
Last active May 27, 2019 06:01
Sample Jenkinsfile to push docker image
def image = ''
def registry = ''
node('slaves'){
stage('Checkout'){
checkout scm
}
stage('Build'){
docker.build(image)
@hackerzhut
hackerzhut / GetRequestBody.java
Created June 20, 2019 10:10
Get Request Body
private String getBody(HttpServletRequest request) {
StringBuffer sb = new StringBuffer();
BufferedReader br = null;
InputStream is = null;
try {
is = request.getInputStream();
if (is != null) {
br = new BufferedReader(new InputStreamReader(is));
@hackerzhut
hackerzhut / cloudwatch_commands.sh
Created July 21, 2019 06:54
Cloudwatch commands from kaihendry
# Full text search
[hendry@t480s 5xx]$ cat bugzilla.sh
aws --profile uneet-dev logs filter-log-events --log-group-name bugzilla --start-time $(date -d "-1 hour" +%s000) \
--filter-pattern '"apex/ping/v1.0"'
# (faster) Query on a JSON structured log
[hendry@t480s 5xx]$ cat alambda.sh
aws --profile uneet-demo logs filter-log-events --log-group-name "/aws/lambda/alambda_simple" --start-time $(date -d "-8
@hackerzhut
hackerzhut / TestServer.java
Created August 13, 2019 11:44
Jetty Test Server Testing
package com.tmna.ct.telematics.one.core.filter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
@hackerzhut
hackerzhut / main.workflow
Created September 9, 2019 01:06 — forked from pahud/main.workflow
Github Actions with Amazon EKS CI/CD
workflow "Demo workflow" {
on = "push"
resolves = ["SNS Notification"]
}
action "Build Image" {
uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6"
runs = ["/bin/sh", "-c", "docker build -t $IMAGE_URI ."]
env = {
IMAGE_URI = "xxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/github-action-demo:latest"
@hackerzhut
hackerzhut / golang-tls.md
Created October 22, 2019 12:32 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@hackerzhut
hackerzhut / trace.go
Created May 14, 2020 00:56
Sample Trace Id function
// traceID returns random traceID in uuid format.
func traceID() string {
traceID := uuid.NewV4()
hi, low := binary.LittleEndian.Uint64(traceID[:8]), binary.LittleEndian.Uint64(traceID[8:])
return fmt.Sprintf("%016x%016x", hi, low)
}
@hackerzhut
hackerzhut / Commands.md
Last active June 29, 2020 14:24
kubernetes commands

#k8s

kubectl get
kubectl create
kubectl describe

#See cluster set

@hackerzhut
hackerzhut / gitlab.go
Created December 16, 2022 14:34
find language of the repo - gitlab
package main
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
@hackerzhut
hackerzhut / github.go
Created December 16, 2022 14:35
find language of the repo - github
package main
import (
"context"
"fmt"
"github.com/google/go-github/v32/github"
"golang.org/x/oauth2"
)