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 / 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
}
}
@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 / nikkei.py
Last active January 22, 2024 11:27
日経平均株価のリアルタイムページスクレイピング
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen('http://nikkei225jp.com/chart/')
soup = BeautifulSoup(html , "html.parser")
nikkei = soup.find('div' , class_ = 'if_cur')
price = nikkei.string
print(price)
@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 / 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 / img_out2.php
Created July 2, 2015 01:37
指定フォルダ内にある.jpgを含むファイルをすべて表示する
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>画像をある分だけ表示する</title>
</head>
<body>
<?php
$count = 0;
$files = count(glob("/img/*.jpg"));
@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
#!/bin/bash -eu
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y git build-essential libffi-dev libssl-dev zlib1g-dev liblzma-dev libbz2-dev libreadline-dev libsqlite3-dev
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
@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):