Skip to content

Instantly share code, notes, and snippets.

@icai
icai / 010F00B400000A01020304050607083B00
Created November 5, 2021 17:29
010F00B400000A01020304050607083B00
010F00B400000A01020304050607083B00
@icai
icai / linkedin-mail-pin.html
Created January 12, 2022 09:09
linkedin-mail-pin
<table role="presentation" align="center" border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#EDF0F3"
style="background-color:#edf0f3;table-layout:fixed">
<tbody>
<tr>
<td align="center">
<center style="width:100%">
<table role="presentation" border="0" class="m_-8216574913864069663phoenix-email-container"
cellspacing="0" cellpadding="0" width="512" bgcolor="#FFFFFF"
style="background-color:#ffffff;margin:0 auto;max-width:512px;width:inherit">
<tbody>
@icai
icai / tree.js
Last active September 15, 2023 03:57
miniprogram pages csv with title
// out put current directory tree
const fs = require('fs')
const path = require('path')
function outPageTitle() {
const appjson = fs.readFileSync('./app.json', 'utf8')
const appjsonObj = JSON.parse(appjson)
const pages = appjsonObj.pages.concat(
...appjsonObj.subPackages.map((item) => {
@icai
icai / translate.js
Created March 7, 2023 02:50
chatgpt GPT3 Translates Text.
const axios = require('axios');
class Base {
constructor(key, language, apiBase = null) {
this.key = key;
this.language = language;
this.currentKeyIndex = 0;
}
getKey(keyStr) {
@icai
icai / fetch.js
Created September 14, 2023 12:38
fetch file content to local
const fs = require('fs')
const path = require('path')
const https = require('https')
const url = require('url')
// Function to fetch a file from a server and save it locally
async function fetchAndSaveFile(url, localFilePath) {
// mkdir -p localFilePath
const dirname = path.dirname(localFilePath)
if (!fs.existsSync(dirname)) {
@icai
icai / cloudflare-ddns-update.sh
Created January 5, 2024 12:18 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@icai
icai / diff.sh
Created January 9, 2024 13:10
Git File Diff Script
#!/bin/bash
branch=$(git rev-parse --abbrev-ref HEAD)
# echo "Enter the first commit hash:"
# read commit1
# echo "Enter the second commit hash:"
# read commit2
@icai
icai / diff-branch.sh
Created January 10, 2024 04:05
git diff two branches change
#!/bin/bash
max_log_entries=30
# Get the list of branches
branches=$(git for-each-ref --sort='-committerdate:iso8601' --format '%(refname:short)' refs/heads/)
# Display branch list for user selection
PS3="Select two branches for file changes: "
@icai
icai / readDir.js
Created March 20, 2024 03:48
scan directory and show list
const fs = require('fs')
const path = require('path')
function readDir(dir, extFilter) {
let fileList = []
// Function to recursively read directories
function readDirectoryRecursive(directory) {
// Read the directory
fs.readdir(directory, (err, files) => {
@icai
icai / appx-web-view-format.js
Last active April 12, 2024 06:23
支付宝 appx/web-view.js 源代码
/*!
*
* ap/v1.25.9
* Mon Jun 20 2022 08:37:45 GMT+0000 (Coordinated Universal Time)
*
*/
var myApp = (function (modules) {
var moduleCache = {};
function require(moduleId) {