Skip to content

Instantly share code, notes, and snippets.

@takuya-andou
takuya-andou / merge_all.py
Created March 15, 2024 10:32
カレントディレクトリ以下のすべてのファイルの内容を1つの大きなテキストファイルにまとめるためのものです。
# 作者: t_andou
#
# このスクリプトは、カレントディレクトリ以下のすべてのファイルの内容を再帰的に読み込み、
# 1つの大きなテキストファイルにまとめるためのものです。
#
# 使い方:
# 1. このスクリプトをプロジェクトのルートディレクトリに配置します。
# 2. コマンドラインから `python merge_all.py` を実行します。
# (merge_all.py は実際のスクリプトファイル名に置き換えてください)
# 3. スクリプトが実行されると、カレントディレクトリ以下のすべてのファイルの内容が
@takuya-andou
takuya-andou / job.yaml
Created October 29, 2019 11:53
GKEでの並列ジョブ
apiVersion: batch/v1
kind: Job
metadata:
name: job-wq
spec:
# 並列実行数
parallelism: 3650
template:
metadata:
name: job-wq
@takuya-andou
takuya-andou / pvc.yaml
Created October 29, 2019 11:51
永続ボリューム
# 参考:https://tkzo.jp/blog/use-persistent-volumes-in-gke/
# volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
# 任意のPV名を設定します
name: persistvol
spec:
capacity:
# 作成したボリュームの容量と合わせます
@takuya-andou
takuya-andou / create_cluster.sh
Created October 29, 2019 11:35
GKEのクラスターを作成するスクリプト
# キューを扱うNodeのためのNodePool
gcloud container clusters create autoscaled-cluster \
--num-nodes 2 \
--machine-type=n1-standard-1 \
--zone us-west1-a --disk-size=10\
# キューを処理するためのNodePool。preemptibleにしている。
gcloud container node-pools create preemptible-pool96 \
--cluster autoscaled-cluster --preemptible --num-nodes 0 \
--enable-autoscaling --min-nodes 0 --max-nodes 960 \
@takuya-andou
takuya-andou / add_queue.sh
Created October 29, 2019 10:18
日付の文字列をキューに入れていくだけのスクリプト
#!/bin/sh
#
# YYYY-MM-DD
#
STARTDATE=20100101
ENDDATE=20191005
CURRENTDATE=$STARTDATE
@takuya-andou
takuya-andou / LineBotBeaconAPI.php
Created October 6, 2016 02:55
LineビーコンとLineMessagingAPIによる勤怠管理
<?php
$json_string = file_get_contents('php://input');
$json_object = json_decode($json_string);
$AndoUserID = '<<LineUserID>>';
error_log("callback start.");
foreach ($json_object->events as $event) {
if('message' == $event->type){
if ($event->source->userId == $AndoUserID) {
if ($event->message->text =='おは'){
@takuya-andou
takuya-andou / ConvertToQR.py
Created August 28, 2017 06:19
リスト内のURLを一気にQR化するためのスクリプト
# -*- coding: utf-8 -*-
import sys
import qrcode
# QRコードを作る場合
URLarray = ['http://google.com','http://yahoo.co.jp']
for i, URL in enumerate(URLarray):
img = qrcode.make(URL) # ''内の文字をQRコードに変換
img.save('qr_img' + str(i) + '.png') # QRコードに名前をつけて保存
@takuya-andou
takuya-andou / GoogleShortener.py
Created August 28, 2017 06:11
リスト内のURLを一気に短縮化するためのスクリプト
# coding:utf-8
import sys
import re
from urllib2 import urlopen as U, Request as R
from json import loads as J
API_KEY = "ここはGoogleのAPIを取得して使う"
API = "https://www.googleapis.com/urlshortener/v1/url?key=" + API_KEY
const DashButton = require('dash-button');
const {exec} = require('child_process');
const do1 = new DashButton("xx:xx:xx:xx:xx:xx"); //じゃがりこ
const re = new DashButton("xx:xx:xx:xx:xx:xx"); //パンテーン
const mi = new DashButton("xx:xx:xx:xx:xx:xx"); //ヘルシア
const fa = new DashButton("xx:xx:xx:xx:xx:xx"); //カロリーメイト
const so = new DashButton("xx:xx:xx:xx:xx:xx"); //エヴィアン
const ra = new DashButton("xx:xx:xx:xx:xx:xx"); //アマゾンベーシック
const si = new DashButton("xx:xx:xx:xx:xx:xx"); //シーブリーズ
@takuya-andou
takuya-andou / byebyeSteve.py
Created December 13, 2016 10:47
Amazon Dash Button launches Steve
# coding: utf-8
from scapy.all import *
from picraft import World, Vector, Block
world = World("MineCraftServer IP")
def arp_display(pkt):
if pkt[ARP].op == 1:
if pkt[ARP].hwsrc == 'Your AmazonDashButton's Mac Address':
world.player.pos = Vector(0, 300, 0)