Skip to content

Instantly share code, notes, and snippets.

@ytyng
ytyng / pwm_led.py
Last active August 29, 2015 14:03
PWM Led
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import threading
import time
try:
from RPi import GPIO
except ImportError:
from minimock import Mock
@ytyng
ytyng / led_blinker.py
Last active August 29, 2015 14:03
Raspberry pi LED Blinker
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import threading
import time
import math
from pwm_led import PWMLed
try:
<html>
<meta charset="utf-8">
<script>
function logging(message) {
// console.log(message);
}
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonCryptor.h>
@interface AES128ECBCipher : NSObject
- (AES128ECBCipher *)initWithKey:(NSString *)key;
#pragma mark - encryption
#!/usr/bin/env python
"""
Update version string in Info.plist on iOS project.
"""
from __future__ import print_function
import re
INFO_PLIST_PATH = 'project/project-Info.plist'
@staticmethod
def iter_chunk(iter, chunk_size):
pool = []
for index, item in enumerate(iter, start=1):
pool.append(item)
if index % chunk_size == 0:
yield pool
pool = []
if pool:
yield pool
import requests
import json
class AppleReceiptVerifyStatusError(Exception):
pass
class AppleReceipt(object):
@staticmethod
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
p = GPIO.PWM(12, 50) # channel=12 frequency=50Hz
p.start(0)
import json
import textwrap
import base64
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
class GooglePlayReceiptValidator(object):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import threading
try:
from django.utils.functional import cached_property
except ImportError:
cached_property = property