Skip to content

Instantly share code, notes, and snippets.

# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
@iseebi
iseebi / switchapi.py
Created June 27, 2020 06:05
SwitchBotをHTTP経由で叩けるようにする
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler
import SimpleHTTPServer
import SocketServer
import binascii
from bluepy.btle import Peripheral, ADDR_TYPE_RANDOM
SWITCHBOT_BLE_ADDR = "00:00:00:00:00:00" # Set your SwitchBot BLE Address
PORT = 8121
Day1 曲名に色の名前がついた好きな曲
Day2 曲名に数字が入っている好きな曲
Day3 夏を思い出させる曲
Day4 忘れたい人を思い出させる曲
Day5 大音量で聴きたくなる曲
Day6 踊りたくなる曲
Day7 ドライブで聴きたい曲
Day8 ドラッグかお酒について書かれている曲
Day9 幸せな気分になる曲
@iseebi
iseebi / authenticator.ts
Created January 9, 2020 13:46
コマンドラインでGoogle APIのOAuthを通すクラス
/* tslint:disable:no-console */
import * as fs from "fs";
import {Credentials, OAuth2Client} from "google-auth-library"
import {google} from "googleapis";
import * as path from "path";
import {createInterface} from "readline";
import {ReadLine} from "readline";
interface IClientID {
client_id: string
@iseebi
iseebi / README.md
Last active September 22, 2019 15:45
技術書典かんたん後払いのデータをスクレイピング

使い方

  1. 頒布物支払状況 のページを開く
  2. Webインスペクター(DevTools)等を開き、<div class="app-conatiner"> の中身をコピー(<h3>頒布物支払状況</h3>の直上の要素)
  3. <html><body>(2.でコピーした内容)</body></html> の内容で atobarai.html に保存。parse_atobarai.rb と同じ位置に配置する
  4. parse_atobarai.rb のあるところをカレントディレクトリにして、ruby parse_atobarai.rb を実行。JSONで出力される。

あとはjqとかシェル芸とかでなんとでも。例えばこんな感じ。

@iseebi
iseebi / reverse_assemble_localizable.rb
Last active August 21, 2019 02:06
Localizable.strings / strings.xml を CSV にする
#!/usr/bin/env ruby
LANGS = ['ja', 'en', 'zh-Hant']
def put_row(items)
puts '"' + items.join('","') + '"'
end
values = Hash.new
LANGS.each do |lang|
@iseebi
iseebi / FcmMock.csx
Created September 16, 2018 03:36
FCM(Firebase Cloud Messaging) Mock with Azure Functions
#r "Newtonsoft.Json"
using System.Net;
using System.Text;
using Newtonsoft.Json;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
var pairs = req.GetQueryNameValuePairs();
var notRegistered = int.Parse(pairs.FirstOrDefault(q => string.Compare(q.Key, "notregistered", true) == 0)
.Value ?? "0");
@iseebi
iseebi / HtmlInputValidation.php
Created August 20, 2018 04:13
[PHP] 入力されたHTMLにscriptタグが入っていないか検証する
<?php
namespace App\Model\Validation;
use Cake\Validation\Validation;
use DOMDocument;
class HtmlInputValidation extends Validation
{
/**
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'cakebox' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'cakebox' (v0) for provider: virtualbox
default: Downloading: https://alt3-aee.kxcdn.com/cakebox.box
==> default: Box download is resuming from prior download progress
default: Progress: 0% (Rate: 0*/s, Estimated time remaining: --:--:--)#<URI::Generic jptk>
"use strict";
console.log("AWS Lambda SES Forwarder - domain forward // modified by @iseebi, Rev.2 // Original: @arithmetric, Version 2.3.0 ");
// Configure the S3 bucket and key prefix for stored raw emails, and the
// mapping of email addresses to forward from and to.
//
// Expected keys/values:
// - fromEmail: Forwarded emails will come from this verified address
// - emailBucket: S3 bucket name where SES stores emails.