Skip to content

Instantly share code, notes, and snippets.

View chemzqm's full-sized avatar

Qiming zhao chemzqm

  • Los Angeles, California, United States
  • X @chemzqm
View GitHub Profile
@chemzqm
chemzqm / deepseek.js
Last active August 8, 2026 17:35
Deepseek balance
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-blue; icon-glyph: chart-line;
// ============================================================
// DeepSeek 余额查询(Scriptable)
//
// 数据来源(DeepSeek 官方 API):
// 余额 GET /user/balance (官方文档接口,API key 认证,可靠)
// (官方 API 不提供用量/消费查询,脚本只展示余额)
@chemzqm
chemzqm / translate.js
Last active August 8, 2026 15:44
Translate current buffer to fluent English using DeepSeek official API.
/**
* Translate current buffer to fluent English using DeepSeek official API.
* Place this file in your `~/.vim/coc-extensions` directory.
*
* Usage:
* :CocCommand deepseek.translateToEnglish
*
* Requirement:
* DEEPSEEK_API_KEY environment variable must be set (get it from
* https://platform.deepseek.com/api_keys)
@chemzqm
chemzqm / execute.js
Created March 28, 2021 12:42
Execute current file with auto execute support
const {Uri, commands, workspace, window, Mutex} = require('coc.nvim')
const path = require('path')
const programMap = {
javascript: 'node',
typescript: 'ts-node',
python: 'python'
}
let global_id = 0
@chemzqm
chemzqm / pack.js
Last active November 1, 2024 07:57
pack and unpack wxvpkg
const path = require('path')
const fs = require('fs')
const { execSync } = require('child_process')
let file = path.join(process.cwd(), 'core.wxvpkg')
if (fs.existsSync(file)) {
execSync(`rmtrash ${file}`)
}
let fd = fs.openSync(file, 'w')
@chemzqm
chemzqm / repl.js
Last active May 29, 2021 00:05
repl with coc.nvim
// Save the file to ~/.vim/coc-extensions
// Usage: xmap <silent> <TAB> <Plug>(coc-repl-sendtext)
const {commands, workspace} = require('coc.nvim')
exports.activate = context => {
let {nvim} = workspace
let terminal
context.subscriptions.push(commands.registerCommand('repl.openTerminal', async () => {
let filetype = await nvim.eval('&filetype')
let prog = ''
@chemzqm
chemzqm / Address.js
Created May 26, 2019 18:55
coc.nvim address extension.
const {sources} = require('coc.nvim')
const {spawn} = require('child_process')
const readline = require('readline')
exports.activate = async context => {
context.subscriptions.push(
sources.createSource({
// unique id
name: 'address',
// unsed in menu
@chemzqm
chemzqm / system.vim
Created April 11, 2019 11:17
system.vim
" ============================================================================
" Description: Some system commands for vim
" Author: Qiming Zhao <chemzqm@gmail.com>
" Licence: Vim licence
" Version: 0.3
" Last Modified: Jul 07, 2018
" ============================================================================
if exists('did_system_loaded') || v:version < 700
finish
@chemzqm
chemzqm / e.fish
Last active March 14, 2018 07:13
Quickly find a directory and file in terminal with fzy
# brew install ag
# brew install fzy
# Usage: e [part of filename]
function e
set -l file (ag . --silent -l -g '' | fzy -q $argv)
if test -z $file
return
else
nvim $file
end
@chemzqm
chemzqm / git-status.js
Created April 1, 2017 03:10
Gti status by node
#!/usr/bin/env node
var exec = require('child_process').exec
var Branch = new Promise(function(resolve, reject) {
exec('git symbolic-ref -q HEAD | cut -c 12-', function (err, stdout) {
if (err) return reject(err)
if (stdout.length) return resolve(stdout.replace('\n', ''))
exec('git rev-parse --short HEAD', function (err, stdout) {
if (err) return reject(err)
@chemzqm
chemzqm / promise.js
Created February 24, 2017 15:43
miniapp promise
var PENDING = 'pending'
var SEALED = 'sealed'
var FULFILLED = 'fulfilled'
var REJECTED = 'rejected'
var NOOP = function(){}
function isArray(value) {
return Object.prototype.toString.call(value) === '[object Array]'
}