Skip to content

Instantly share code, notes, and snippets.

View hackerzhut's full-sized avatar

Sara hackerzhut

View GitHub Profile
@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 / 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 / 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 / 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 / README.txt
Created May 16, 2019 03:31 — forked from ncw/README.txt
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh [email protected]
Run the server in one terminal
go run server.go
@hackerzhut
hackerzhut / b62.go
Created May 11, 2019 10:08 — forked from 607011/b62.go
Performance comparison of various base62 encoder techniques in Go
package main
import (
"fmt"
"math"
"reflect"
"runtime"
"sort"
"time"
)
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
func mergeMaps(x1, x2 map[string]interface{}) interface{} {
for k, v2 := range x2 {
if v1, ok := x1[k]; ok {
if m1, ok := v1.(map[string]interface{}); ok {
if m2, ok := v2.(map[string]interface{}); ok {
x1[k] = mergeMaps(m1, m2)
continue
}
}
}
@hackerzhut
hackerzhut / cert.go
Created May 6, 2019 15:28
Verify x509 certificates
package main
import (
"crypto/x509"
"encoding/pem"
"fmt"
"log"
)
func main() {
@hackerzhut
hackerzhut / color.go
Created May 2, 2019 11:55
Color Console
package console
import "fmt"
const (
TextBlack = iota + 30
TextRed
TextGreen
TextYellow
TextBlue