Skip to content

Instantly share code, notes, and snippets.

View nnsnodnb's full-sized avatar
🌻
お花のように清く正しく美しく生きたい

Yuya Oka nnsnodnb

🌻
お花のように清く正しく美しく生きたい
View GitHub Profile
@nnsnodnb
nnsnodnb / compose.yml
Created March 19, 2024 06:15
DynamoDB local & admin
version: "3.8"
services:
dynamodb:
image: amazon/dynamodb-local:2.3.0
container_name: dynamodb
ports:
- 8000:8000
command: -jar DynamoDBLocal.jar -dbPath /data -sharedDb
volumes:
@nnsnodnb
nnsnodnb / enable_touch_id_in_terminal
Created October 3, 2023 03:11
Enable Touch ID in terminal
#!/usr/bin/env bash -e
if [[ $(whoami) != "root" ]]; then
echo "Must be run as root user."
exit 1
fi
chmod +w /etc/pam.d/sudo
# Insert following text in line 2
# auth sufficient pam_tid.so
chmod -w /etc/pam.d/sudo
@nnsnodnb
nnsnodnb / decrypt.sh
Created December 15, 2020 11:51
GitHub Actions に暗号ファイルを載せる
#!/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 January 31, 2024 12:11
[WIP] CloudFormation template for EC2 Mac Instance bundle latest Xcode.
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 / main.py
Last active January 5, 2023 08:16
AppStoreConnect API sample
# pip install pyjwt requests cryptography
# and put "app-store-connect-api-key.json" in this script directory
import json
import time
from datetime import datetime, timedelta
from pathlib import Path
import jwt
import requests
@nnsnodnb
nnsnodnb / profile.py
Created November 27, 2019 13:45
django-silk がインストールされてないけど同じコードを扱いたいときあるじゃん?
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 February 29, 2024 17:41
How to upload jpeg image using URLSession.
import Foundation
struct AnyError: Error {
let error: Error
init(_ error: Error) {
self.error = error
}
}
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 July 28, 2018 08:26
APNs Provider API sample with Python3
"""
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 April 16, 2018 10:27
External library automatic input script to ResouceKit.
#!/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 ...