Skip to content

Instantly share code, notes, and snippets.

@ethanliu
ethanliu / dock-compose.yml
Last active November 17, 2022 06:53
sonarqube docker-compose.yml
version: "3"
services:
db:
image: postgres:15
container_name: postgresql
ports:
- "5432:5432"
environment:
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
/**
*
* Snippets.me TextMate Distributor replacement script
*
* TextMate Distributor is not working after TextMate 2 bundle identifier changed,
* the script remove all exists snippets from TextMate, then add valid snippets.
*
* @author Ethan Liu - https://creativecrap.com
*
* References:
@ethanliu
ethanliu / iTunes.swift
Created July 13, 2016 08:08 — forked from pvieito/iTunes.swift
iTunes ScriptingBridge header
//
// iTunes.swift
//
import AppKit
import ScriptingBridge
// MARK: Enum Definitions -
@objc enum iTunesEKnd: NSInteger {
@ethanliu
ethanliu / xcode-todo.sh
Created June 1, 2016 10:47
Xcode Build Script - Mark TODO, FIXME as waring
KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@ethanliu
ethanliu / xcode-bundle-version.sh
Created June 1, 2016 10:45
Xcode Build Script - Use git HEAD counts for CFBundleVersion without dirty the repo
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list HEAD --count`
infoPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
#infoPath="${PROJECT_DIR}"/"${INFOPLIST_FILE}"
if [ $CONFIGURATION = "Debug" ]; then
branchName=`"$git" rev-parse --abbrev-ref HEAD`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild-$branchName" "$infoPath"
else
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "$infoPath"
@ethanliu
ethanliu / PChome Loader
Created January 21, 2015 09:01
PChome auto pager script for greasemonkey
// ==UserScript==
// @name PChome Loader
// @namespace ETHAN_PCHOME
// @include http://*.pchome.com.tw/*
// @version 1.0.0
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js
// @run-at document-end
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
@ethanliu
ethanliu / disqus2wpxml.php
Created September 20, 2013 09:04
Convert xml exported from disqus to wordpress format for importing back to disuqs
<?php
/**
* Convert xml exported from disqus to wordpress format for importing back to disuqs
*
* @author Ethan Liu <ethan@creativecrap.com>
* @copyright Creativecrap.com, 20 September, 2013
**/
$feed = new SimpleXMLElement(file_get_contents("src.xml"));