Skip to content

Instantly share code, notes, and snippets.

Avatar
🌻
お花のように清く正しく美しく生きたい

Yuya Oka nnsnodnb

🌻
お花のように清く正しく美しく生きたい
View GitHub Profile
@nnsnodnb
nnsnodnb / decrypt.sh
Created Dec 15, 2020
GitHub Actions に暗号ファイルを載せる
View decrypt.sh
#!/bin/bash -e
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_PASS_PHRASE" --output /path/to/output_file /path/to/encrypted_file
@nnsnodnb
nnsnodnb / macos_xcode_template.yml
Last active Dec 1, 2020
[WIP] CloudFormation template for EC2 Mac Instance bundle latest Xcode.
View macos_xcode_template.yml
AWSTemplateFormatVersion: 2010-09-09
Parameters:
AMIId:
ConstraintDescription: Please choose AMIId
Description: Base image id for macOS
Type: AWS::EC2::Image::Id
KeyName:
ConstraintDescription: Must be the name of an existing EC2 KeyPair
Type: AWS::EC2::KeyPair::KeyName
Resources:
@nnsnodnb
nnsnodnb / get_bundle_ids.py
Created Dec 16, 2019
AppStoreConnect API sample
View get_bundle_ids.py
import json
import jwt
import time
import requests
from datetime import datetime, timedelta
from pathlib import Path
APP_STORE_KEY = 'XXXXXXXXXX'
@nnsnodnb
nnsnodnb / profile.py
Created Nov 27, 2019
django-silk がインストールされてないけど同じコードを扱いたいときあるじゃん?
View profile.py
class custom_profile(object):
def __init__(self, name=None, _dynamic=False):
super().__init__()
def __new__(cls, *args, **kwargs):
try:
from silk.profiling.profiler import silk_profile
except ImportError:
class silk_profile(object):
@nnsnodnb
nnsnodnb / AnyError.swift
Last active Sep 29, 2021
How to upload jpeg image using URLSession.
View AnyError.swift
import Foundation
struct AnyError: Error {
let error: Error
init(_ error: Error) {
self.error = error
}
}
View sample_asyncio.py
import asyncio
class Sample(object):
def start(self, **kwargs):
loop = asyncio.get_event_loop()
return loop.run_until_complete(self.create_tasks(loop, **kwargs))
async def create_tasks(self, loop, **kwargs):
@nnsnodnb
nnsnodnb / custom_library_push.py
Last active Jul 28, 2018
APNs Provider API sample with Python3
View custom_library_push.py
"""
pip install git+https://github.com/nnsnodnb/python-apns.git@payload#egg=gobiko.apns
https://github.com/nnsnodnb/python-apns/tree/payload
"""
from gobiko.apns.client import APNsClient
from gobiko.apns.payload import PayloadAlert, Payload
import jwt
@nnsnodnb
nnsnodnb / generated_resource.py
Last active Apr 16, 2018
External library automatic input script to ResouceKit.
View generated_resource.py
#!/usr/bin/env python
# coding: utf-8
"""
This script file automatically inserts the import of the libraries used for 'ResourceKit'.
Insert new 'Run Script' before 'Compile Sources' in Build Phases.
And fill this code.
python $SRCROOT/script/generated_resource.py LIBRARY_1 LIBRARY_2 LIBRARY_3 ...
@nnsnodnb
nnsnodnb / deny.py
Last active Feb 24, 2018
Nginx海外IP除外
View deny.py
#!/usr/bin/env python3
import gzip
import os
import re
import urllib.request
DOWNLOAD_FILE = 'cidr.txt.gz'
urllib.request.urlretrieve(
@nnsnodnb
nnsnodnb / api_client.py
Created Jan 24, 2018
特定のツイートのRTした人を取得してランダムで抽出するソレ
View api_client.py
# coding: utf-8
from requests_oauthlib import OAuth1Session, OAuth1
import requests
import settings
class APIClient(object):