Skip to content

Instantly share code, notes, and snippets.

View snebel29's full-sized avatar

Sven Nebel snebel29

  • Dublin, Ireland
View GitHub Profile
@snebel29
snebel29 / udp-echo-server.go
Last active August 26, 2019 15:45
Simple UDP echo server with time stamp
package main
import (
"net"
"fmt"
"time"
)
func main() {
@snebel29
snebel29 / main.go
Created February 15, 2019 10:17
slice of ints intersection in GO
package main
import (
"fmt"
)
func main() {
v := Intersection([]int{1,2,3,4,5,6}, []int{2,4,6})
fmt.Println(v)
}
@snebel29
snebel29 / gist:ca0ebcb46fa31cfa0dbfd86bb174c35d
Created September 4, 2018 10:41
List all multipart S3 bucket sizes with python
#!/usr/bin/env python
#inventory of all multipart uploads in a region
import boto3
import os
#Not sure this applies here but keeping just in case
region = "us-east-1"
#The profile to use in the credentials or boto.config file, if used
profile_nm = 'default'
import sys
import tldextract
input = sys.stdin.readlines()
for line in input:
u = tldextract.extract(line.strip())
print(u.domain + '.' + u.suffix)
$ make build
mkdir -p .deps
curl -o .deps/go1.8.1.linux-amd64.tar.gz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 87.0M 100 87.0M 0 0 6627k 0 0:00:13 0:00:13 --:--:-- 6675k
tar -C .deps -xzf .deps/go1.8.1.linux-amd64.tar.gz
touch /home/snebel/AYLIEN/tap_image_builder/.deps/go/bin/go
mkdir -p /home/snebel/AYLIEN/tap_image_builder/.deps/gopath
GOPATH=/home/snebel/AYLIEN/tap_image_builder/.deps/gopath GOROOT=/home/snebel/AYLIEN/tap_image_builder/.deps/go /home/snebel/AYLIEN/tap_image_builder/.deps/go/bin/go get github.com/constabulary/gb/...
$ make build
GOROOT=/home/snebel/AYLIEN/tap_image_builder/.deps/go /home/snebel/AYLIEN/tap_image_builder/.deps/gopath/bin/gb build all
# k8s.io/client-go/pkg/api
objectreference.go:23: import /home/snebel/AYLIEN/tap_image_builder/pkg/linux-amd64/k8s.io/apimachinery/pkg/runtime/schema.a: object is [linux amd64 go1.7.4 X:framepointer] expected [linux amd64 go1.8.1 X:framepointer]
# k8s.io/client-go/pkg/apis/authorization
register.go:20: import /home/snebel/AYLIEN/tap_image_builder/pkg/linux-amd64/k8s.io/apimachinery/pkg/runtime.a: object is [linux amd64 go1.7.4 X:framepointer] expected [linux amd64 go1.8.1 X:framepointer]
# k8s.io/client-go/pkg/apis/policy
register.go:20: import /home/snebel/AYLIEN/tap_image_builder/pkg/linux-amd64/k8s.io/apimachinery/pkg/runtime.a: object is [linux amd64 go1.7.4 X:framepointer] expected [linux amd64 go1.8.1 X:framepointer]
# k8s.io/client-go/pkg/apis/admissionregistration
register.go:20: import /home/snebel/AYLIEN/tap_image_builder/pkg/linux-amd64/k8s.io/apimachinery/pkg/runti
$ make build
GOROOT=/home/snebel/AYLIEN/tap_image_builder/.deps/go /home/snebel/AYLIEN/tap_image_builder/.deps/gopath/bin/gb build all
k8s.io/client-go/util/homedir
k8s.io/apimachinery/pkg/util/json
k8s.io/apimachinery/pkg/conversion/queryparams
k8s.io/apimachinery/pkg/util/framer
k8s.io/apimachinery/pkg/version
k8s.io/apimachinery/pkg/util/rand
k8s.io/apimachinery/pkg/runtime/schema
k8s.io/apimachinery/pkg/util/yaml
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"time"
"k8s.io/client-go/kubernetes"
import unittest
class TestGen(unittest.TestCase):
def test_generator(self):
def gen():
i = 1
while i < 10:
yield i
i += 1
def mygen():
i = 1
yield i
i += 1
print(next(mygen()))
print(next(mygen()))
print(next(mygen()))