Posts

Showing posts from 2017

Cannot create AWS SNS Platform Application for Apple Push Notification

Image
AWS SNS's help( http://docs.aws.amazon.com/ja_jp/sns/latest/dg/mobile-push-apns.html ) is detailed, but actual steps are rather vague. Exact steps are thease create certificate signing request.certSigningRequest on Keychain.app upload certificate signing request file. Then create and download aps.cer(APNS SSL certificate) from Apple Developer. Double click aps.cer and confirm Apple Push Services is added to KeyChain Right click the Keychain's item and write to .p12 file with your new password On AWS SNS Dashboard, click "Create AWS SNS Platform Application", choose previous p12 file and password for the certification① Push "read certification from file" button② fills two text fields below, and now you can push the "create" button at the bottom③ sorry for Japanese screen shot

Getting valid time spans from timestamped data using Python Pandas.

Assume we have a Panda's DataFrame indexed by a time. 2017-12-15 00:00:00 ..... 2017-12-15 00:00:15 ..... 2017-12-15 00:00:29 ..... 2017-12-15 00:00:46 ..... 2017-12-15 03:31:01 ..... 2017-12-15 03:31:17 ..... 2017-12-15 03:31:29 ..... 2017-12-15 03:32:16 ..... And if we want to get time spans from the data under condition that if rows' intervals is less than threashold, make it one span. start end 2017-12-15 00:00:00 2017-12-15 00:00:46 2017-12-15 03:31:01 2017-12-15 03:32:16 you can do it by import pandas as pd from datetime import timedelta threashold = timedelta(seconds=30) df = pd.read_csv("original_data.csv") intervals = df_origin.index[1:] - df_origin.index[:-1] df[HEAD][1:] = intervals > threshold df[TAIL][:-1] = intervals > threashold df[HEAD][0] = True df[TAIL][-1] = True _df = df[df["HEAD"] ^ df["TAIL"]] result = pd.DataFrame({"start":_df[_df["HEAD"]].index, "end":_df[_df[&q

Cannot import SVG file to android studio (AssetStudio) by "The specified asset could not be parsed" error.

Image
Android studio's Asset Studio is easy to import SVG file to resource, but it does not seem to support full SVG and some valid SVG files get an error as "The specified asset could not be parsed". Some say height & width attribute of svg tag should have px, but in my case with SVG files made by AutoDesk's Graphic(Mac), the problem was <svg ... viewbox="0, 0, 40.513, 34.544"> (viewBox attribute of svg tag is comma separated). I open the file by a text editor and changed it to <svg ...="" viewbox="0 0 40.513 34.544">(separate figures only by a space) , then it works. I don't know how many people use Graphic and Android Asset Studio, but I hope this finding will save someone's time.

If you can't write .p12 file from .cer ... (greyed out)

Image
... make sure your .certSigningRequest file is one from Key Chain Access on your current Mac, and it has key pair information. Then, you submit it to Apple developer console and download .cer file. With double clicking .cer file, you can see it on the Key Chain Access and hopefully you can choose .p12 extention to write.

Amazon EC2 Container Service(ECS): EC2 instance does not appear on Cluster-ECS Instance Tab.

If you don't see EC2 Instance(ECS instance in formal??) on ECS-Cluster-ECS Instance tab on AWS console, try check EC2 instance must have ecsInstanceRole. EC2 instance must created from one of ecs-optimized AIM. user data of EC2 instance(Action -> Instance Setting -> User Data) has to include your cluster-name. EC2 must in subnet with internet-gateway.

Docker simplest alpine sshd

Long time no see, (but who cares?) As I struggled to install and run sshd on alpine linux, I want to share it with you. (I assume you are the one googled docker/alpine/sshd, aren't you?) Before docker build need public key to connect server. # create id_ed25519 and id_ed25199.pub to current dir. > sshd-keygen -t ed25519 Dockerfile FROM alpine RUN apk add --update --no-cache openssh && \ rm -rf /tmp/* /var/cache/apk/* && \ adduser -D user && \ passwd -u user && \ # SSHD CONFIG { \ echo "PermitRootLogin prohibit-password"; \ echo "PasswordAuthentication no"; \ } >> /etc/ssh/sshd_config && \ # GENERATE KEYS { \ echo "$PASS=PASS$RANDOM"; \ echo "PASSWORD for user is $PASS"; \ echo "echo -e $PASS'\n'$PASS | passwd user"; \ echo "ssh-keygen -A"; \ echo 'exec "$@"'; \ } > /usr/sbin/key_gen.sh COPY i