Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Fletcher adamf

View GitHub Profile
@adamf
adamf / run_minikube.sh
Created Aug 5, 2020
Running minikube + tilt ci in a github action
View run_minikube.sh
#!/bin/bash
set -exu
PLATFORM=$(uname)
# If the minikube cluster doesn't exist, the return code is 7
# we'll test this later to see if we need to do a bunch of initial setup on
# services (eg, create RBAC for k8s, create DB users, etc)
MINIKUBE_STATUS_GREP_NON_EXISTENT=0
View example_django_chart_from_helm.yaml
$ helm template q /Users/adamf/Source/Q/services/webapp/django-core-chart --set otherGlobalLabels.bar=foo
---
# Source: django-core-chart/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: q-django-core-chart
labels:
helm.sh/chart: django-core-chart-0.1.0
View example_django_chart_from_helm.yaml
$ helm template q /Users/adamf/Source/Q/services/webapp/django-core-chart --set otherGlobalLabels.bar=foo
---
# Source: django-core-chart/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: q-django-core-chart
labels:
helm.sh/chart: django-core-chart-0.1.0
@adamf
adamf / generated_service.yaml
Last active Feb 7, 2020
Helm example chart testing
View generated_service.yaml
$ helm template q /Users/adamf/Source/Q/services/example-service/example-service-chart --set q-example-service-chart.metadata.metadata.labels.f=ff --set example-service-chart.labels.foo=bar
---
# Source: example-service-chart/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: q-example-service-chart
labels:
app.kubernetes.io/name: example-service-chart
helm.sh/chart: example-service-chart-0.1.0
View data_wrangling_pandas.py
df = pd.read_csv("example.csv", parse_dates=True, infer_datetime_format=True)
df.starttime = pd.to_datetime(arg=df.starttime, infer_datetime_format=True)
df.index = pd.DatetimeIndex(df.starttime)
df['date_only'] = df.index.floor('1D')
df['2018-08-01':'2018-08-03'].groupby(['name','date_only','event_id']).event_count.sum()
start_date = datetime.date(2018, 8, 30)
df[start_date - pd.DateOffset(days=10):start_date].groupby(['name','date_only','event_id','event_sub_id']).event_count.sum()
df[start_date - pd.DateOffset(days=10):start_date].groupby(['name','date_only','event_id']).event_count.sum()[:10].to_csv()
@adamf
adamf / buggy_sf2.lua
Created Nov 7, 2017
Lua code to read player data from StreetFighter II Turbo for SNES via BizHawk's Lua environment. Contains some bugs!
View buggy_sf2.lua
json = require "json"
function get_framecount()
return emu.framecount()
end
function get_p1_health()
return mainmemory.read_u8(0x000530)
end
View bazel_monorepo_circle_config.yaml
machine:
xcode:
version: 8.3
dependencies:
override:
- source bin/setup_dev_env.sh
compile:
override:
View print_csv_field.py
import csv
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--field', help='field number to output')
parser.add_argument('--filename', help='filename to parse')
args = parser.parse_args()
with open(args.filename) as csvfile:
fields = csv.reader(csvfile)
@adamf
adamf / test_comcast.sh
Created Aug 9, 2017
A script to track when my internet goes up and down
View test_comcast.sh
#!/bin/bash
set -x
SERVERIP=8.8.8.8
LOGFILE=pings.txt
STATE=U
END=5000000
for ((i=1;i<=END;i++)); do
foo=`date`
View Gyroscope.m
#import <Gyroscope/Gyroscope.h>
[Gyroscope start:@”APIKEY”];
[Gyroscope actionList:showAd, ...];
You can’t perform that action at this time.