Skip to content

Instantly share code, notes, and snippets.

View skyjia's full-sized avatar
🎯
Focusing

Sky JIA skyjia

🎯
Focusing
View GitHub Profile
@skyjia
skyjia / connect-flipperzero.nu
Last active November 10, 2024 03:00
Connect to a Flipper Zero device using minicom
#!/usr/bin/env nu
# Connect to a Flipper Zero device using minicom
# https://docs.flipper.net/development/cli#rnDLl
# check if minicom is installed
if (which minicom | length) == 0 {
print "Please install minicom before using this script."
exit 1
}
@skyjia
skyjia / proxy.md
Created October 31, 2024 13:44 — forked from yougg/proxy.md
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@skyjia
skyjia / list-applications.sh
Created July 10, 2024 13:18
List all installed applications on macOS
#! /bin/sh
ls /Applications | egrep '\.app$' | sed 's/\.app$//'
@skyjia
skyjia / git-overwrite-branch.sh
Created July 21, 2021 08:10 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@skyjia
skyjia / deployment-manual.md
Created July 21, 2021 06:20
部署操作手册示例范本

【闲情偶寄】系统部署操作手册

文档负责人:李渔

最后更新时间:2021年7月1日

目录

package main
import (
"fmt"
"regexp"
)
func main() {
e := `^(?P<length>\d+)(?P<unit>[dmy])$`
r := regexp.MustCompile(e)
@skyjia
skyjia / parse_struct.go
Last active May 25, 2020 13:27
Parse go struct
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"strings"
)
@skyjia
skyjia / update-version.sh
Created August 31, 2017 03:51 — forked from jellybeansoup/update-version.sh
Script for Incrementing Version Numbers
#!/bin/bash
# Link: <https://gist.github.com/jellybeansoup/db7b24fb4c7ed44030f4>
#
# A command-line script for incrementing build numbers for all known targets in an Xcode project.
#
# This script has two main goals: firstly, to ensure that all the targets in a project have the
# same CFBundleVersion and CFBundleShortVersionString values. This is because mismatched values
# can cause a warning when submitting to the App Store. Secondly, to ensure that the build number
# is incremented appropriately when git has changes.
#
@skyjia
skyjia / comments_style.md
Created July 18, 2017 08:54
代码注释规范

代码注释规范

标点, 拼写和语法

注释的通常写法是包含正确大小写和结尾句号的完整语句. 短一点的注释 (如代码行尾注释) 可以随意点, 依然要注意风格的一致性. 完整的语句可读性更好, 也可以说明该注释是完整的, 而不是一些不成熟的想法.

虽然被别人指出该用分号时却用了逗号多少有些尴尬, 但清晰易读的代码还是很重要的. 正确的标点, 拼写和语法对此会有所帮助.

Tag注释

@skyjia
skyjia / paging_with_key.sql
Last active March 18, 2016 14:52
使用Key进行分页
SET @start_key=1005069;
SET @paging_size = 20;
SELECT * FROM (
SELECT
(@row_num:=@row_num + 1) AS `@row_num`,
(@row_num_in_page:=CASE
WHEN f.id = @start_key THEN 0
WHEN @row_num_in_page>=0 THEN @row_num_in_page+1
ELSE -1