Skip to content

Instantly share code, notes, and snippets.

View yujinqiu's full-sized avatar
💭
🚀

yujinqiu

💭
🚀
View GitHub Profile

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@yujinqiu
yujinqiu / service-checklist.md
Created December 22, 2016 04:05 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@yujinqiu
yujinqiu / formatBytes.swift
Created September 9, 2020 06:58 — forked from mminer/formatBytes.swift
Formats bytes into a more human-readable form (e.g. MB).
import Foundation
func format(bytes: Double) -> String {
guard bytes > 0 else {
return "0 bytes"
}
// Adapted from http://stackoverflow.com/a/18650828
let suffixes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
let k: Double = 1000
@yujinqiu
yujinqiu / SearchView.swift
Created September 25, 2020 02:44
mac os SearchView
import SwiftUI
extension NSTextField {
open override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
}
@yujinqiu
yujinqiu / iPod.swift
Created September 25, 2020 05:18 — forked from jordansinger/iPod.swift
Swift Playgrounds iPod Classic
import SwiftUI
import PlaygroundSupport
struct iPod: View {
var body: some View {
VStack(spacing: 40) {
Screen()
ClickWheel()
Spacer()
}
//
// ContentView.swift
//
//
// Created by Bernstein, Joel on 7/4/20.
//
import SwiftUI
struct ElementModel: Identifiable
@yujinqiu
yujinqiu / Settings.swift
Created February 22, 2021 10:51 — forked from jordansinger/Settings.swift
iOS 6 Settings built in SwiftUI
//
// Settings.swift
// Settings
//
// Created by Jordan Singer on 2/20/21.
//
import SwiftUI
struct Settings: View {
@yujinqiu
yujinqiu / CombineFetcherAndDecoder.swift
Created April 1, 2021 07:12 — forked from stinger/CombineFetcherAndDecoder.swift
Combine - fetching and decoding JSON data
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String), parserError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@yujinqiu
yujinqiu / CombineMockClient.swift
Last active April 2, 2021 04:15 — forked from stinger/CombineMockClient.swift
Mock data loader using Combine
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknownError
case unknownURL
case unknownData
case parserError(reason: String)
case apiError(reason: String)
@yujinqiu
yujinqiu / gist:f266ab137b6f3ee6f7a1e7a253fbb014
Created January 22, 2022 03:16 — forked from andrewgrant/gist:477c7037b1fc0dd7275109d3f2254ea9
Example changes for automake to support x86 & arm64 plus universal binaries
# configure.ac
# add an --enable-macos-universal-binary flag that when building for mac
# create a universal x86_64 / arm64 binary
AC_ARG_ENABLE([macos-universal-binary],
[AS_HELP_STRING([--enable-macos-universal-binary],
[Create an universal x86_64+arm64 binary when building for macos)])],,
[enable_macos_universal_binary=no])
# Determine if we're building for macos/darwin by checking for macos & darwin