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
import sys | |
import time | |
import boto3 | |
AWS_REGION = 'ap-northeast-1' | |
AWS_PROFILE = 'your-profile' | |
if __name__ == "__main__": | |
session = boto3.Session(profile_name=AWS_PROFILE, region_name=AWS_REGION) |
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
import sys7 | |
import urllib.request | |
import json | |
DEEPL_AUTH_KEY = "key" #ここをAPIキーで置き換える | |
DEEPL_ENDPOINT_TRANSLATE = "https://api-free.deepl.com/v2/translate" | |
DEEPL_ENDPOINT_USAGE = "https://api-free.deepl.com/v2/usage" | |
def monitor_usage(): | |
"""使用状況を確認する""" |
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
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
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
<?php | |
namespace App\Test\TestCase\Controller; | |
use Cake\ORM\TableRegistry; | |
use Cake\TestSuite\TestCase; | |
class ArticlesControllerTest extends TestCase | |
{ | |
public $Articles; |
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
use std::io::{self}; | |
fn main() { | |
hello(); | |
loop_for(); | |
loop_if(); | |
} |
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
# ref: https://frasco.io/golang-dont-afraid-of-makefiles-785f3ec7eb32 | |
GOCMD=go | |
GOBUILD=$(GOCMD) build | |
GOCLEAN=$(GOCMD) clean | |
GOTEST=$(GOCMD) test | |
GOGET=$(GOCMD) get | |
BINARY_NAME=mybinary | |
BINARY_UNIX=$(BINARY_NAME)_unix | |
all: test build |
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
const usableGeolocation = () => { | |
return "geolocation" in navigator; | |
}; | |
window.onload = () => { | |
if (!usableGeolocation()) { | |
console.error('Cannot use geolocation'); | |
return false; | |
} | |
const geoLocation = navigator.geolocation; |
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
// sliceの重複要素を削除 | |
func slimSlice(slice []int) []int { | |
m := make(map[int]int) | |
slim := make([]int, 0) | |
for _, element := range slice { | |
if _, ok := m[element]; !ok { | |
m[element] = 0 | |
slim = append(slim, element) | |
} | |
} |
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
func gcd(a, b int) int { | |
if b == 0 { | |
return a | |
} | |
return gcd(b, a%b) | |
} |
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 ( | |
"database/sql" | |
) | |
func main() { | |
// open database | |
db, err := sql.Open("mysql", "root:root@tcp(127.0.0.1:3306)/my_database") | |
if err != nil { |
NewerOlder