Skip to content

Instantly share code, notes, and snippets.

View tullo's full-sized avatar

Andreas tullo

  • localhost
  • 16:44 (UTC +02:00)
View GitHub Profile
@tullo
tullo / main.go
Created December 15, 2021 11:50 — forked from Ompluscator/main.go
Go Proxy Full
package main
import (
"archive/zip"
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
@tullo
tullo / sealed-secret-scanner.go
Last active April 25, 2021 14:02
sealedSecrets scanner
package main
import (
"bytes"
"fmt"
"strings"
"text/scanner"
)
const src = `
# Source: https://gist.github.com/84324e2d6eb1e62e3569846a741cedea
####################
# Create a Cluster #
####################
minikube start
#############################
# Deploy Ingress Controller #
@tullo
tullo / jq to filter by value.md
Last active January 29, 2021 22:23 — forked from ipbastola/jq to filter by value.md
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'
cat my.json | jq -c '.[] | select( ._id == 611 )
cat my.json | jq -c 'select( ._id == 611 )

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@tullo
tullo / run.tpl
Created December 15, 2020 00:22 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@tullo
tullo / crawler.go
Last active March 5, 2019 16:08 — forked from hello-josh/crawler.go
A Tour of Go - Exercise: Web Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@tullo
tullo / Makefile
Created December 9, 2018 21:22
Makefile for Go Projects
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
@tullo
tullo / git-flatten-history.md
Last active December 9, 2018 20:40 — forked from adeluccar/gist:d105299f2d5af55e3e96f9b989e7eb48
How to Flatten the History of a Git Repository Safely
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files
@tullo
tullo / git-clearHistory
Created December 9, 2018 19:56
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git

Keybase proof

I hereby claim:

  • I am tullo on github.
  • I am tullo (https://keybase.io/tullo) on keybase.
  • I have a public key whose fingerprint is AFF3 3284 DA3E 7937 BF5A 11C7 F314 11C7 556D 846F

To claim this, I am signing this object: