Skip to content

Instantly share code, notes, and snippets.

@flymop
flymop / create-sa.sh
Created November 24, 2023 10:58
create a service account and bind it with cluster-admin role, then export as a kubeconfig
#!/bin/bash
# create a service account and bind it with cluster-admin role, then export as a kubeconfig
# typically used when creating a new minikube/kind cluster
set -ex
set -o pipefail
NAMESPACE=$1
SA_ACCOUNT_NAME=$2
EXPORT_KUBECONFIG_PATH=$3
@flymop
flymop / clean-new-chat-conversations.js
Created March 23, 2023 16:15
Clean ChatGPT "New Chat" Conversations
// ==UserScript==
// @name Clean New Chat Conversations
// @version 1
// @description Deletes all conversations with the title "New chat" in ChatGPT chat page
// @match https://chat.openai.com/*
// ==/UserScript==
const KEY_ACCESS_TOKEN = "chatgpt_access_token";
(async function() {
@flymop
flymop / go-mpsc-channel.go
Created July 30, 2022 07:23
An example on multi producer (sender) and single consumer (receiver) golang channel
// https://go.dev/play/p/z7lFk4D-mhA
package main
import (
"context"
"fmt"
"math/rand"
"strconv"
"strings"
"sync"
@flymop
flymop / EdgeSettings.mobileconfig
Last active December 14, 2021 15:32
Remove unnecessary settings on Microsoft Edge for MacOS, check all Edge policies at edge://policy/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>DiagnosticData</key>
<integer>0</integer>
<key>FamilySafetySettingsEnabled</key>
@flymop
flymop / block-leetcode-cn.txt
Created February 1, 2021 03:18
block leetcode-cn banner
! block leetcode-cn banner on the global site
assets.leetcode-cn.com/lccn-resources/cn.js
@flymop
flymop / ssl.patch
Created December 9, 2019 14:53
ruby-2.2-openssl-patch
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 8c04cb5..132d803 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -104,6 +104,9 @@
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
+have_func("SSLv3_method")
+have_func("SSLv3_server_method")
@flymop
flymop / urlshortener.js
Created December 9, 2018 09:04
simple tools to shorten url
const express = require('express')
const app = express()
const sqlite = require('sqlite3')
const bodyPraser = require('body-parser')
app.use(bodyPraser.urlencoded({extended: false}))
app.use(bodyPraser.json())
const PORT = 8114
@flymop
flymop / uploadserver.py
Last active July 15, 2018 02:29
single onefile server with upload
#!/usr/bin/env python
# Simple HTTP Server With Upload.
import os
import posixpath
import BaseHTTPServer
import urllib
import cgi
import shutil
import mimetypes
@flymop
flymop / parser.py
Created April 22, 2018 01:11
generate shadowsocks sip003 uri scheme and qrcode (only support obfs plugin)
# -*- coding: utf-8 -*-
#generate shadowsocks sip003 uri scheme and qrcode (only support obfs plugin)
import base64
import ipaddress
import json
import urllib.parse
import qrcode
# for check
must_fields = ["server", "server_port", "password", "method"]

Keybase proof

I hereby claim:

  • I am flymop on github.
  • I am fly_mop (https://keybase.io/fly_mop) on keybase.
  • I have a public key whose fingerprint is 2B2A BEEE 7E0A 9AD0 48E1 0293 153D 1863 4F2C E590

To claim this, I am signing this object: