Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View konifar's full-sized avatar
💭
💯

Yusuke Konishi konifar

💭
💯
View GitHub Profile
# ja.lproj/Localizable.strings を正として、次のチェックを行います
# 1. jaのキーと同じキーが他言語にもあるか
# 2. jaのコメントと同じコメントが他言語にもあるか
# 3. jaのバリューに"%%", "%s", "%1$s", "%@", "%1$@", "%d", "%1$d", "\n" がある時、他言語にも同じ文字列が同じ個数含まれているか
# 4. バリューに"%"だけの文字が含まれていないか
# 実行例) ruby ./scripts/localization/localizable_strings_checker.rb Project/Languages Localizable.strings
# https://github.com/rylev/apfel
require 'apfel'
package main
import (
"flag"
"fmt"
"go/ast"
"go/parser"
"go/token"
"log"
"os"
package main
import (
"flag"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"path/filepath"
"regexp"
@konifar
konifar / all_chat_channels_message.py
Created January 13, 2023 15:46
Slackのchatチャネル一覧を取得してメッセージを生成
import json
import urllib.request
import urllib.parse
import urllib.error
def load_all_public_channels(token):
"""全チャネルの情報を取得する
:param token: (str) SlackのAPI Token
:return: (str) レスポンスのjsonオブジェクト
@konifar
konifar / slack_invite_all.py
Created August 12, 2021 13:09
特定のSlackチャネルに全メンバーを一括招待するCode by Zapier
import json
import urllib.request
import urllib.parse
import urllib.error
API_BASE_URL = 'https://slack.com/api'
ALL_MEMBER_CHANNEL_ID = 'xxxxxxxx' # #generalなど、全メンバーが入っている元となるチャネルのID
def load_channel_info(channel_id, token):
"""指定したチャネルの情報を取得する
@konifar
konifar / slack_public_channels_list.js
Created December 21, 2020 10:53
SlackのPublicチャネル一覧を書き出すGoogle Apps Script
const slackApiUrl = 'https://slack.com/api';
const slackToken = 'xoxp-hogehoge';
function execute() {
// 現在日時を取得
const currentDate = new Date();
// チャネル一覧を取得
let url = slackApiUrl + '/conversations.list';
url += '?token=' + slackToken;
@konifar
konifar / what_today_is.js
Created December 12, 2020 01:32
今日は何の日かをSlack通知するGoogle App Script
const webhookUrlForTest = 'https://hooks.slack.com/services/xxxxxxxx'
const webhookUrl = 'https://hooks.slack.com/services/xxxxxxxx'
function execute() {
// 今日の年月日を取得
const date = new Date();
const todayYear = date.getFullYear();
const todayMonth = date.getMonth() + 1;
const todayDay = date.getDate();
const dayOfWeek = ["日", "月", "火", "水", "木", "金", "土"][date.getDay()];
@konifar
konifar / skip_smart_lock.kt
Created August 21, 2018 08:08
skip smart lock
fun skipSmartLock() {
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
val noneButton = device.findObject(UiSelector().textMatches("(上記以外)|(NONE OF THE ABOVE)").className("android.widget.Button"))
if (noneButton.exists()) {
noneButton.click()
}
}
@konifar
konifar / auto_remove_unused_resources.sh
Last active May 15, 2018 15:18
auto_remove_unused_resources.sh
#!/bin/bash -xe
# Usage:
# ./auto_remove_unused_resources.sh {github token} master
readonly GITHUB_TOKEN=${1}
readonly BASE_BRANCH=${2}
readonly ROOT_DIR=$PWD
readonly SRC_DIR="app/src"
readonly COMPARE_BRANCH="remove_unused_resources"
@konifar
konifar / android_unused_resource_remover.py
Created April 20, 2018 04:31
android_unused_resource_remover.py
# -*- coding: utf-8 -*-
import commands
import glob
import os
import xml.etree.ElementTree as ElementTree
# http://stackoverflow.com/questions/33573807/faithfully-preserve-comments-in-parsed-xml-python-2-7
class CommentedTreeBuilder(ElementTree.TreeBuilder):
def __init__(self, *args, **kwargs):