Skip to content

Instantly share code, notes, and snippets.

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

Chao Yang chaoyangnz

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python
# Linux usage: ./extract_tampermonkey_script.py "/home/<USER>/.config/<BROWSER>/Default/Local Extension Settings/<EXTENSION_ID>"
# i.e.: ./extract_tampermonkey_script.py "/home/foo/.config/google-chrome-beta/Default/Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf"
# Mac usage: ./extract_tampermonkey_script.py "/Users/<USER>/Library/Application Support/Google/Chrome/Default/Local Extension Settings/<EXTENSION_ID>/"
# i.e.: ./extract_tampermonkey_script.py "/Users/foo/Library/Application Support/Google/Chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo/"
import leveldb
import sys
import re
// ==UserScript==
// @name buildkite-unblock
// @namespace http://tampermonkey.net/
// @version 0.1
// @description unblock builkite job
// @author Chao
// @match https://buildkite.com/*/builds/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
// ==UserScript==
// @name graylog-eyecandy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Graylog EyeCandy script for siteminder
// @author Chao Yang
// @icon https://pics.freeicons.io/uploads/icons/png/1000492771548141155-512.png
// @grant GM_addStyle
// @grant GM_addElement
// @match *://graylog.siteminder.systems/*
@chaoyangnz
chaoyangnz / pass.md
Created April 15, 2022 09:05 — forked from abtrout/pass.md
Using password-store with git repository synching

Password-store keeps your passwords (or any other sensitive information) saved in GnuPG encrypted files organized in ~/.password-store. For more information about GPG, consult the GNU Privacy Handbook.

Getting started

To get started, install pass and generate a keypair.

$ brew install pass
$ gpg --gen-key
$ gpg --list-keys
{"messageType":"DATA_MESSAGE","owner":"513548267075","logGroup":"/ffx/production/ecs","logStream":"stuff-content-service-cq-sync/stuff-content-service-cq-sync/83e9719a-196c-4351-bb6f-50c5f7ffc22b","subscriptionFilters":["kiwiops-ecs-production-lambda-CloudWatchLogsECSFilter-G5BX8F9164MJ"],"logEvents":[{"id":"35437349079141711007758191346109325641839207860737802240","timestamp":1589065691019,"message":"INFO 2020/05/09 23:08:11,018 [Camel (camel-1) thread #1 - GooglePubsubConsumer[stuff.content.cs.asset.published.subscription]] (n.c.s.s.c.s.c.CsAssetPublishedRoute.log:159) - Received publish event with message id = ID-c3d11bbfc887-1588826815662-0-128057, message body = {
 "asset" : {
 "assetType" : "story",
 "id" : 121465710,
 "sectionHeadline" : "Covid costs swell Coast DHB deficit",
 "sectionIntro" : "The West Coast DHB has gone further into the red this month to fund its response to the Covid-19 pandemic.",
 "assetSubType" : "generic",
 "source" : "Stuff",
 "lastPublishedAt" : "2020-0
{"messageType":"DATA_MESSAGE","owner":"513548267075","logGroup":"/ffx/production/ecs","logStream":"stuff-content-service-cq-sync/stuff-content-service-cq-sync/83e9719a-196c-4351-bb6f-50c5f7ffc22b","subscriptionFilters":["kiwiops-ecs-production-lambda-CloudWatchLogsECSFilter-G5BX8F9164MJ"],"logEvents":[{"id":"35437510453221364307759336754505867747353865762156904448","timestamp":1589072927283,"message":"INFO 2020/05/10 01:08:47,282 [Camel (camel-1) thread #1 - GooglePubsubConsumer[stuff.content.cs.asset.published.subscription]] (n.c.s.s.c.s.c.CsAssetPublishedRoute.log:159) - Received publish event with message id = ID-c3d11bbfc887-1588826815662-0-133346, message body = {
 "asset" : {
 "assetType" : "image",
 "id" : 300009089,
 "assetSubType" : "photograph",
 "source" : "Stuff",
 "lastPublishedAt" : "2020-05-10T01:08:46.973700Z",
 "openToComment" : false,
 "excludeFromSeo" : false,
 "lastUpdated" : "2020-05-10T01:08:46.983161Z",
 "lastPublished" : "2020-05-10T01:08:47.063024Z",

  • Kubectl exec Pod
gcloud container clusters get-credentials dunlap-gke-private --region australia-southeast1 --project stuff-98118045375 && \
kubectl exec stuff-content-service-67b9779bcf-fqb6c --namespace devint -c stuff-content-service -it -- sh
  • In Pod, dump the heap
apt-get update
apt-get install wget
wget -L -O /usr/local/bin/jattach \

Put these two functions into your ~/.bashrc or ~/.zshrc

decrypt_secret() {
	if [ "$#" -ne 2 ]; then
	  echo "Usage: decrypt_secret <secret.yaml> <passphrase>"
	  return 1
	fi
	openssl enc -aes-256-cbc -d -base64 -in "$1.aes256" -out "$1" -k "$2"
}

Put these two functions into your ~/.bashrc or ~/.zshrc

decrypt_secret() {
	if [ "$#" -ne 2 ]; then
	  echo "Usage: decrypt_secret <secret.yaml> <passphrase>"
	  return 1
	fi
	openssl enc -aes-256-cbc -d -base64 -in "$1.aes256" -out "$1" -k "$2"
}

when you run npm run dev, sometimes you will come accross this error:

Open node_modules/typescript/lib/typescript.js, and go to line 8873:

if (!sourceFile) {
    return ts.createTextSpan(0, 0);
}