Skip to content

Instantly share code, notes, and snippets.

View jeiting's full-sized avatar

Jacob Eiting jeiting

View GitHub Profile
@jeiting
jeiting / psdkAnalyticsServiceWrapper.mm
Last active January 29, 2019 18:35 — forked from daveweaver/psdkAnalyticsServiceWrapper.mm
Originator / Revenue Cat integration
/*
The main class in this file is the AnalyticsServiceWrapper. It handles any connections to analytics services we
use, such as Google Analytics, crash reporting, revenue reporting, etc., and of course Adjust and Revenue Cat. This
is fairly old code, which is why it's written as a C++ class that contains Objective-C calls.
*/
#import <AdSupport/ASIdentifierManager.h>
#import "Adjust.h"
#import "Purchases.h"
# Load the contents of the receipt file
receipt_file = open('./receipt_data.bin', 'rb').read()
# Use asn1crypto's cms definitions to parse the PKCS#7 format
from asn1crypto.cms import ContentInfo
pkcs_container = ContentInfo.load(receipt_file)
# Extract the certificates, signature, and receipt_data
certificates = pkcs_container['content']['certificates']
signer_info = pkcs_container['content']['signer_infos'][0]
/**
This method will post all purchases associated with the current App Store account to RevenueCat and become associated with the current `appUserID`.
If this App Store account is already associated with another `appUserID` that has an active subscription this will produce an error. This prevents one App Store account from providing subscriptions for multiple users. This is the default behavior.
If the App Store account has no active subscriptions or purchases it will restore and transfer purchases and subscriptions to the current `appUserID`.
If you want to transfer purchases even if there is an active subscription, you can set this in the RevenueCat web app. You should use this if you app doesn't have a seperate account to system that you use to restore purchases.
*/
- (void)restorePurchasesForAppStoreAccount;
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
switch(transaction.transactionState) {
case .purchasing:
break;
case .purchased:
case .restored:
handlePurchase(transaction);
case .failed:
handleFailure(transaction);
import gym
import numpy as np
env = gym.make('CartPole-v0')
x = env.reset()
# x, xdot, theta, thetadot
gamma = (4.0 / 3.0 - env.masspole / env.masscart)
"""
This will be a very simple control method consisting of one set of weights and biases (theta)
that is optimized via CEM.
"""
import gym
from gym import wrappers
import numpy as np
class DiscreteDeterministicControlPolicy():
def __init__(self, mean, std_dev, observation_dim, action_dim):
InterestingDataStruct *data = giveMeInterestingDataPlease();
11111 5
11110 4
11101 4
11100 3
11011 4
11010 3
11001 3
11000 2
10111 4
10110 3
{
"id": "Bloon",
"content": {
"default" : {
"description": "Default",
"adapter": {
"type": "SimpleConceptAdapter",
"config": {
"question": "foreign_word",
"answer": "native_word",