Skip to content

Instantly share code, notes, and snippets.

View ben181231's full-sized avatar
🤤
Staying Hungry

Ben Lei ben181231

🤤
Staying Hungry
View GitHub Profile
@ben181231
ben181231 / Makefile
Last active September 7, 2021 10:13
Skeleton of Google Cloud Function with wire
.PHONY: build
build:
@echo "Nothing to build"
.PHONY: deploy
deploy: deploy/Ping
.PHONY: deploy/Ping
deploy/Ping:
gcloud functions deploy Ping \
@ben181231
ben181231 / Makefile
Created May 18, 2021 09:37
Auto-helped Makefile
.PHONY: help
help: ## Show this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[33m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z\/_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# Ref. https://gist.github.com/href/1319371
from collections import namedtuple
def convert(dictionary):
for key, value in dictionary.items():
if isinstance(value, dict):
dictionary[key] = convert(value)
if isinstance(value, list):
dictionary[key] = [convert(i) for i in value]
@ben181231
ben181231 / upload-to-appstore.sh
Created October 27, 2015 06:51 — forked from jedi4ever/upload-to-appstore.sh
Command upload App/Ipa to the iTunes Connect App Store
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=bla
@ben181231
ben181231 / CreateRamDisk.sh
Created February 25, 2015 15:32
Create ram disk on OS X
#!/bin/bash
LIMIT=8 #size limit
if [[ $# -eq 1 ]]; then
if [[ ! $1 =~ ^[0-9]+$ ]]; then
>&2 echo "Error: Invalid parameter: \"$1\""
exit 1
fi
SIZE=$1