- mitsuruog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A virtualenv running Python3.6 on Amazon Linux/EC2 (approximately) simulates the Python 3.6 Docker container used by Lambda | |
# and can be used for developing/testing Python 3.6 Lambda functions | |
# This script installs Python 3.6 on an EC2 instance running Amazon Linux and creates a virtualenv running this version of Python | |
# This is required because Amazon Linux does not come with Python 3.6 pre-installed | |
# and several packages available in Amazon Linux are not available in the Lambda Python 3.6 runtime | |
# The script has been tested successfully on a t2.micro EC2 instance (Root device type: ebs; Virtualization type: hvm) | |
# running Amazon Linux AMI 2017.03.0 (HVM), SSD Volume Type - ami-c58c1dd3 | |
# and was developed with the help of AWS Support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# GoogleMapDownloader.py | |
# Created by Hayden Eskriett [http://eskriett.com] | |
# | |
# A script which when given a longitude, latitude and zoom level downloads a | |
# high resolution google map | |
# Find the associated blog post at: http://blog.eskriett.com/2013/07/19/downloading-google-maps/ | |
import urllib.request | |
from PIL import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unicodedata import east_asian_width | |
def count_text(message): | |
# 全角文字を半角文字2つとしてカウントする | |
width_dict = { | |
'F': 2, # Fullwidth | |
'H': 1, # Halfwidth | |
'W': 2, # Wide | |
'Na': 1, # Narrow | |
'A': 2, # Ambiguous |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var topLeft = slate.operation("corner", { | |
"direction" : "top-left", | |
"width" : "screenSizeX/2", | |
"height" : "screenSizeY/2" | |
}); | |
var topRight = slate.operation("corner", { | |
"direction" : "top-right", | |
"width" : "screenSizeX/2", | |
"height" : "screenSizeY/2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function peco-lscd { | |
cd "$GOPATH/src/$( ghq list | peco)" | |
} | |
alias sd='peco-lscd' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl \ | |
-X POST -D - \ | |
http://localhost:3010/employees \ | |
-H 'Content-Type: application/json' \ | |
-d '{"firstName":"Test","lastName":"Test","phone":"123-456-789'","picture":"http://aaa.bbb.ccc.com'"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
FROM="../sample-bff/" | |
TO="../../workspace/sample-bff/" | |
# -z: 文字列の長さが0 | |
if [ -z $1 ]; then | |
echo "usage: $ bash sync [commit message]" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"fmt" | |
) | |
// sqrt(2) = 1.1421356237 | |
// sqrt(3) = 1.73205080757 | |
func Sqrt(x float64) float64 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ライブラリへの保存(別スレッド) | |
PHPhotoLibrary.shared().performChanges({ _ in | |
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: outputFileURL) | |
}, completionHandler: { (completed: Bool, _) -> Void in | |
if completed { | |
print("Video is saved!") | |
DispatchQueue.main.async { [weak self] _ in | |
// ✓ボタンの表示 | |
self?.finishButtonFrameView.isHidden = false | |
// 保存中のインジケータを非表示 |
NewerOlder