View Answer
import { Octokit } from "octokit";
import dotenv from "dotenv";
dotenv.config();
const octokit = new Octokit({
require 'rake' | |
require 'rspec/core/rake_task' | |
require 'yaml' | |
namespace :spec do | |
desc 'Run unit tests' | |
task :unit do | |
FileList["modules/*/Rakefile"].each do |project| | |
dir = project.pathmap("%d") | |
sh "cd #{dir}; rake spec:unit" |
apiVersion: v1 | |
data: | |
fluentd.conf: | | |
# Capture the kubernetes pod container logs | |
<source> | |
@type tail | |
format json | |
path /var/log/containers/*.log | |
pos_file /var/log/kubernetes.pos | |
time_format %Y-%m-%dT%H:%M:%S |
#!/bin/bash | |
if grep -q -i "release 6" /etc/redhat-release 2> /dev/null | |
then | |
sudo yum -y install scl-utils | |
sudo yum -y install --enablerepo=rhui-ap-southeast-2-rhel-server-rhscl rh-python36 | |
PYTHON36=$(scl enable rh-python36 "bash -c 'which python'") | |
export PATH=$(dirname $PYTHON36):$PATH | |
fi |
#! /usr/bin/env python | |
""" slack_delete.py | |
Removes files uploaded to Slack | |
Usage: | |
virtualenv slack | |
source slack/bin/activate | |
pip install requests |
#!/usr/bin/env python3 | |
from aws_cdk import core | |
from my_python_sample.my_python_sample_stack import MyPythonSampleStack | |
app = core.App() | |
MyPythonSampleStack(app, 'my-python-sample', env={'region': 'ap-southeast-2'}) |
#!/usr/bin/env bash -e | |
for commit in $(git log --format="%H"); do | |
size=0 | |
blobs=0 | |
IFS=$'\n' | |
for line in $(git log -1 --raw --no-merges --no-renames --no-abbrev --full-index --raw --pretty=oneline $commit | tail -n +2); do | |
id=$(echo $line | cut -d' ' -f4) | |
blob_size=$(git cat-file -s $id 2>/dev/null || echo 0) | |
(( size += blob_size )) |
import { Octokit } from "octokit";
import dotenv from "dotenv";
dotenv.config();
const octokit = new Octokit({
require "octokit"
octokit = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
Octokit.auto_paginate = true
Go to https://github.com/robandpdx/octokit-js-demo > Code > Create codespace..
Give it a few minutes to set up.
Rename env.orig to .env and populate with your PAT and org name.
Add breakpoints in script.js.
Follow the exercise from https://probot.github.io/docs/development.
Bonus:
Open your probot source directory in VSCode.
Add a new VSCode Launch config (Run > Add Configuration):