Skip to content

Instantly share code, notes, and snippets.

@yangyubo
yangyubo / App-Store-Connect-API-Python.md
Last active January 17, 2022 02:43 — forked from corrieriluca/App-Store-Connect-API-Python.md
Connection to the App Store Connect API using Python3 and Applaud
@yangyubo
yangyubo / ArrayOfCStrings.swift
Last active August 10, 2019 09:11
Passing an Array of Strings from Swift to C
// Support for array of C strings
// https://oleb.net/blog/2016/10/swift-array-of-c-strings/
// https://github.com/apple/swift/blob/master/stdlib/private/SwiftPrivate/SwiftPrivate.swift
private func scan<
S : Sequence, U
>(_ seq: S, _ initial: U, _ combine: (U, S.Iterator.Element) -> U) -> [U] {
var result: [U] = []
result.reserveCapacity(seq.underestimatedCount)
var runningResult = initial
for element in seq {
@yangyubo
yangyubo / RVNReceiptValidation.m
Created May 24, 2018 02:26
Mac App Store Receipt Validation Sample (Mac OS X 10.7)
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
#!/usr/bin/env python
"""
An echo server (the echo protocol is standardized in RFC 862). This
one implements only TCP.
Implemented with Python standard module SocketServer.
# http://www.bortzmeyer.org/files/echoserver.py
@yangyubo
yangyubo / gist:3148381
Created July 20, 2012 02:54
Assignment tag
# django tempatetag
# usage: {% set <var_name> = <var_value> %}
class SetVarNode(template.Node):
def __init__(self, var_name, var_value):
self.var_name = var_name
self.var_value = var_value
def render(self, context):
try:
@yangyubo
yangyubo / gist:3148316
Created July 20, 2012 02:38
Get object's full model name, formatted as "app_label.module_name"
# django tempatetag
# django version >= 1.4 is required
@register.assignment_tag
def get_full_modelname(object):
"""
usage:
{% get_full_modelname object as modelname_var %}
"""
@yangyubo
yangyubo / bootstrap.rc
Created June 10, 2012 14:22
Booststrap bash script for quickly create & enter Django 1.4 development & production environment
# Tested with Django 1.4 and Ubuntu 12.04 LTS
# Absolute path to this script. /home/user/bin/foo.sh
BURNE_SCRIPT=$(readlink -f "${PWD}/${BASH_SOURCE}")
# Absolute path this script is in. /home/user/bin
BURNE_TOP_PATH=`dirname "$BURNE_SCRIPT"`
BURNE_PARENT_PATH=`dirname "$BURNE_TOP_PATH"`
BURNE_PROJECT_NAME=`basename "$BURNE_TOP_PATH"`
BURNE_DJANGO_ADMIN="$BURNE_TOP_PATH/ENV/bin/django-admin.py"