Skip to content

Instantly share code, notes, and snippets.

View poy's full-sized avatar

Andrew Poydence poy

View GitHub Profile
@poy
poy / kf-points.go
Created September 10, 2019 16:18
This will tell you how many points are in a milestone for github.com/google/kf
package main
import (
"context"
"flag"
"fmt"
"os"
"strconv"
"github.com/google/go-github/github"
@poy
poy / push.sh
Created February 8, 2019 17:19
Push source code to GCS bucket and have knative build and deploy it
#!/bin/bash
# Copyright 2019 Google LLC.
# SPDX-License-Identifier: Apache-2.0
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <Service Name> <Path>"
exit 1
fi
service_name=$1
@poy
poy / chatbot.go
Created November 14, 2018 18:29
bot initiated message
package main
import (
"context"
"io/ioutil"
"log"
"net/http"
"os"
"golang.org/x/oauth2"
go build -gcflags '-m' ./main.go
#!/bin/bash
for i in `ls`
do
for j in `ls $i`
do
repo="$i/$j"
echo $repo
pushd $repo
fly -t loggregator builds -j=loggregator/loggregator-tests | grep -m1 -B 999999 failed | grep succeeded | wc -l
package tree_test
import (
"math/rand"
"sort"
"testing"
avl "github.com/emirpasic/gods/trees/avltree"
"github.com/emirpasic/gods/utils"
)
package bench_test
import (
"crypto/rand"
"fmt"
"os"
"testing"
"code.cloudfoundry.org/loggregator/doppler/internal/grpcmanager/v1"
"code.cloudfoundry.org/loggregator/plumbing"
@poy
poy / duration
Last active July 17, 2017 18:09
Prints duration between ns timestamps from stdin
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"time"
)
@poy
poy / dropped_udp.sh
Created June 6, 2017 15:55
Detects and counts dropped UDP packets for 60 seconds (for port 0x0d81)
#!/bin/bash
for i in `seq 0 60`; do
echo "sample $i";
timestamp=$(date +%s)
value=$(cat /proc/net/udp | grep ": 0100007F:0D81" | tr -s [:space:] '|' | sed 's/|/ /g' | awk '{print $13}')
echo "$timestamp $value"
sleep 1
done