Skip to content

Instantly share code, notes, and snippets.

View koistya's full-sized avatar
🏠
Working from home

Konstantin Tarkus koistya

🏠
Working from home
View GitHub Profile
@koistya
koistya / README.md
Last active October 23, 2023 14:08
Load environment variables and secrets from `.env` files and Google Secret Manager.

Environment Variables and Secrets

The following demonstrates how to load environment variables and secret values into a software project for local development.

  • [Step 1]: Create secret records in Google Secret Manager
  • [Step 2]: Save environment variables and secret references to .env file(s)
  • [Step 3]: Add a call to loadEnv(environment, options) where you need those variables

Basic Example

Keybase proof

I hereby claim:

  • I am koistya on github.
  • I am koistya (https://keybase.io/koistya) on keybase.
  • I have a public key ASASJaNjk9roFklMXj8X8HgeLDA_sCqiu9xzjv890zVSMQo

To claim this, I am signing this object:

@koistya
koistya / pull_request_template.md.txt
Last active February 23, 2024 19:27
Pull Request Template for GitHub
<!--
Craft a meaningful explanation for why this tweak matters and outline the awesome updates you've implemented. Feel free to toss in some snazzy screenshots if you've got 'em. ✨
-->
### 🚀 What's new
- [ ] Some change...
- [ ]
### 📣 Special notes for reviewer
@koistya
koistya / twitter-api.md
Last active July 20, 2023 17:05
Twitter API v2 usage example using Got and OAuth-1.0a

Twitter API v2 Usage Example

Install got and oauth-1.0a NPM dependencies.

import { TwitterClient } from "./twitter";

// Initializes a new Twitter client using OAuth 1.0a credentials
const twitter = new TwitterClient({
 // Twitter App credentials (API key and secret)
@koistya
koistya / github-actions-workflows.md
Last active July 10, 2023 11:16
Reusable workflows in GitHub Actions

Reusable Workflows in GitHub Actions

Assuming you have the root-level main.yml and a couple of reusable workflows main-a.yml and main-b.yml.

Your goal is to run the the workflows A and B automatically as part of the main (root) workflow as well as being able to fire up them manually one by one for different environments.

The top-level (root) workflow would looks something like this:

.github/workflows/main.yml

@koistya
koistya / main.yml
Last active July 8, 2023 16:46
GitHub Actions Workflows (example)
# GitHub Actions Workflow (example)
# .github/workflows/main.yml
name: CI/CD
on:
push:
branches: [main]
tags:
- "v*"
@koistya
koistya / twitter-auth.md
Last active July 8, 2023 14:57
Twitter auth flow using Firebase Auth (a.k.a. Google Identity Platform)
@koistya
koistya / crypto.md
Last active December 29, 2023 21:27
Using Google Cloud credentials (service account keys) in Cloudflare Workers environment

Allow retrieving an OAuth 2.0 authentication token for interacting with Google services using the service account key.

Usage Example with Cloudflare Workers

Base64-encode your service account JSON key and save it to *.env files (GOOGLE_CLOUD_CREDENTIALS)

import { getAuthToken, Env } from "core";

export default {
interface PluginConfigTypes {
gtag: {
trackingID: string
}
otherPlugin: {
test: number
}
}
type Config<K extends keyof PluginConfigTypes> = {
/* SPDX-FileCopyrightText: 2021-present Konstantin Tarkus (hello@endtest.dev) */
/* SPDX-License-Identifier: MIT */
import * as React from "react";
import { TextField, Autocomplete } from "@mui/material";
import type { AutocompleteProps } from "@mui/material";
import { projects } from "./data";
type Option = { id: string; label: string };
type ComboboxProps = Omit<