Skip to content

Instantly share code, notes, and snippets.

View harhogefoo's full-sized avatar

Masataka Shinohara harhogefoo

View GitHub Profile
@harhogefoo
harhogefoo / install_python_36_amazon_linux.sh
Created April 16, 2019 09:53 — forked from niranjv/install_python_36_amazon_linux.sh
Install Python 3.6 in Amazon Linux
# 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
@harhogefoo
harhogefoo / GoogleMapDownloader.py
Created April 5, 2019 01:50 — forked from sebastianleonte/GoogleMapDownloader.py
A python script to download high resolution Google map images given a longitude, latitude and zoom level. (Works with Python 3)
#!/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
@harhogefoo
harhogefoo / text_counter.py
Created February 12, 2019 15:05
全角文字を半角文字2つとしてカウントする
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
@harhogefoo
harhogefoo / .slate.js
Last active January 19, 2019 14:46
Slate config file
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"
@harhogefoo
harhogefoo / .bash_profile
Last active November 9, 2018 02:43
bash with ghq and peco
function peco-lscd {
cd "$GOPATH/src/$( ghq list | peco)"
}
alias sd='peco-lscd'
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'"}'
@harhogefoo
harhogefoo / index.md
Created November 22, 2017 07:07 — forked from mitsuruog/index.md
express実践入門

express実践入門


自己紹介

小川充

  • mitsuruog
@harhogefoo
harhogefoo / sync.sh
Last active October 24, 2017 04:13
特定のディレクトリを除外してコピー & gitへpush
#!/bin/sh
FROM="../sample-bff/"
TO="../../workspace/sample-bff/"
# -z: 文字列の長さが0
if [ -z $1 ]; then
echo "usage: $ bash sync [commit message]"
exit 1
fi
package main
import (
"math"
"fmt"
)
// sqrt(2) = 1.1421356237
// sqrt(3) = 1.73205080757
func Sqrt(x float64) float64 {
@harhogefoo
harhogefoo / store_library.swift
Created September 28, 2017 03:20
store library(swift3)
// ライブラリへの保存(別スレッド)
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
// 保存中のインジケータを非表示