Skip to content

Instantly share code, notes, and snippets.

View mogita's full-sized avatar

🌵 Yun Wang mogita

View GitHub Profile
@mogita
mogita / gcs-setup-for-cap-server.md
Created September 17, 2025 05:31
GCS Setup for Cap Server

GCS buckets provide S3-compatible interface and can work directly with Cap. Details on the environment variables:

First, generate your HMAC keys (equivalent to S3 keys):

  1. In your Google Cloud Platform organization, create a service account that has Cloud Storage Admin permission.
  2. Navigate to Cloud Storage → Settings → Interoperability → “Create a key for a service account” to obtain the HMAC keys.

Then, setup the environment variables accordingly:

  • CAP_AWS_ACCESS_KEY: (GCS HMAC Access Key ID)

Carbon Accounting Platform - API & Database Schemas

Core API Endpoints

Authentication and IAM

POST /v1/auth/login
- User login to exchange for access token and refresh token
- Email/password authentication
- Returns: JWT access_token (1h), refresh_token (7d), user profile
@mogita
mogita / bookmarklet.js
Created May 24, 2024 10:18
Share to mastodon bookmarklet with commet placeholder
// Usage:
// - copy the minified line of code
// - replace the mastodon domain name near the end of the code with your instance
// - create a new bookmark in your browser and paste the whole code to the URL input box
// - click on the bookmark to share the current page
// - (optional) feel free to tweak the format of the shared text if you know some JavaScript
// minified
javascript:void((function(w,d,e,i){s=w.getSelection().toString();t=e(s?s+"\n\n":"");w.open(`https://${i}/share?text=${t}${e(d.title)}${e(" ")}${e(d.URL)}${e("\n\n// ")}`,'_blank')}(window,document,encodeURIComponent,'mastodon.social')));
@mogita
mogita / .vimrc
Created September 23, 2021 07:35
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic — @amix3k
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
@mogita
mogita / .vimrc
Created June 30, 2021 12:02
Vim Simple Auto Complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Auto Complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Navigate the complete menu item like CTRL+n / CTRL+p would
inoremap <expr> <Down> pumvisible() ? "<C-n>" : "<Down>"
inoremap <expr> <Tab> pumvisible() ? "<C-n>" : "<Tab>"
inoremap <expr> <Up> pumvisible() ? "<C-p>" : "<Up>"
" Select the complete menu item like CTRL+y would
inoremap <expr> <CR> pumvisible() ? "<C-y>" : "<CR>"
@mogita
mogita / notepad-in-browser.md
Created December 24, 2020 08:08
Open an instant notepad in your browser

Copy and paste the following whole line and save it to your browser's bookmark. Click on the bookmark you created to have an instant available notepad. No extensions/plugins required, no JavaScript ever runs.

Caution: closing the browser or tab will lose anything in the notepad.

data:text/html,%3Chtml%20contenteditable%3E%3Cstyle%3Ebody%7Bfont-family%3A%22JetBrains%20Mono%22%2C%20%22Source%20Code%20Pro%22%2CConsolas%2CMenlo%2Cmonospace%3Bcolor%3A%23aaaeb3%3Bbackground-color%3A%23282c34%3Bfont-size%3A10px%3Bline-height%3A1.5em%3Bpadding%3A12px%3B%7D%3C%2Fstyle%3E%3C%2Fhtml%3E

Styles customization:

  • Copy the part after data:text/html,, URL decode it
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
spec:
ports:
- name: http
port: 8080
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: keycloak
spec:
tls:
- hosts:
- KEYCLOAK_HOST
rules:
- host: KEYCLOAK_HOST
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
spec:
ports:
- name: http
port: 8080
@mogita
mogita / index.d.ts
Last active October 22, 2019 10:59
[WIP] Evergreen UI Type Definitions
/* tslint:disable:interface-name max-classes-per-file no-empty-interface */
declare module 'evergreen-ui' {
import * as React from 'react';
type PositionTypes = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
type IntentTypes = 'none' | 'success' | 'warning' | 'danger';
type IconNameTypes =
''
| 'loading'