gh extension install Link-/gh-token
APP_ID=<APP ID>
PRIVATE_KEY=<PATH TO PRIVATE KEY>
INSTALLATION_ID=$(gh token installations --app-id $APP_ID --key $PRIVATE_KEY | jq '.[] | .id')
import { Octokit } from "octokit"; | |
import dotenv from "dotenv"; | |
dotenv.config(); | |
const octokit = new Octokit({ | |
auth: process.env.GITHUB_TOKEN, | |
}); | |
const username = process.argv[2] |
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):
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.
require "octokit"
octokit = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
Octokit.auto_paginate = true
import { Octokit } from "octokit";
import dotenv from "dotenv";
dotenv.config();
const octokit = new Octokit({
#!/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 )) |
#!/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 python | |
""" slack_delete.py | |
Removes files uploaded to Slack | |
Usage: | |
virtualenv slack | |
source slack/bin/activate | |
pip install requests |
#!/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 |