Skip to content

Instantly share code, notes, and snippets.

View ecoopnet's full-sized avatar

M.Inomata ecoopnet

View GitHub Profile
@ecoopnet
ecoopnet / convert_instagram_json.py
Created November 28, 2023 10:51
metaのアカウントセンターからダウンロードしたinstagramのjsonデータが変な形式なので、読める形に変換して書き出すやつ
#!/usr/bin/env python3
import json
# metaのアカウントセンターからダウンロードしたinstagramのjsonデータが変な形式なので、読める形に変換して書き出す。
# (なぜか非 ascii 文字列が \uxxx がバイトコードになってて普通には読めない…)
# 元jsonファイル
json_file = "~/Downloads/posts_1.json"
out_file = json_file + ".out.json"
@ecoopnet
ecoopnet / Dump.kt
Last active January 6, 2023 10:50
Dumps collections as String
// 任意のコレクション型に文字列を返す dump メソッドを追加する。
private fun Any.dump(): String {
if (this is Map<*, *>) {
return dump()
}
if (this is List<*>) {
return dump()
}
@ecoopnet
ecoopnet / download-arxiv-pdfs.sh
Last active March 5, 2022 19:06
AI勉強会用 arxiv のURLリストからpdfダウンロード
#!/bin/sh
# 導入:
# 1. download-arxiv-pdfs.sh (このファイル)をダウンロードする
# 2. chmod +x download-arxiv-pdfs.sh
# 使い方:
# ./download-arxiv-pdfs.sh 2022-02-18-recent.txt # 勉強会用の recent.txt または hype.txtを指定
top10txtfile="$1"
if [ '!' -s "$top10txtfile" -o $(basename "$top10txtfile" | sed -e 's/^[^\.]*\.//') != txt ]; then
echo "arxiv sanity の top hype か top recent のまとめtxtファイルを指定して下さい。" >&2
#!/bin/sh
# DB名や接続情報を元に、table名、カラム名の一覧CSVを生成する
# 例: mysql_dump_scheme.sh mydatabase > out.csv
# 例: mysql_dump_scheme.sh -u myuser -p 'xxx' mydatabase > out2.csv
dbname="$1"
@ecoopnet
ecoopnet / MoneyForward Utility
Created December 10, 2021 00:59
Violet Monkey Scripts
// ==UserScript==
// @name MoneyForwardユーティリティ
// @namespace Violentmonkey Scripts
// @match https://moneyforward.com/*
// @grant none
// @version 1.0
// @author ecoopnet
// @description 2020/9/11 11:21:36
// ==/UserScript==
$(function(){
@ecoopnet
ecoopnet / fetch_urls.sh
Last active April 4, 2024 02:34
指定したURLから再帰的にURLを取ってくるスクリプト
#!/bin/bash
# Usage: fetch_urls.sh "URL"
# Example: fetch_urls.sh "https://example.com/" | tee urls.txt
# https://example.com/ に再帰的にアクセスして、 urls.txt にURL一覧を書き出す
# Requirements: wget perl
# wget が入ってない場合、 brew install wget などでインストールして下さい。
_url="$1"
(
wget -nd -nH --spider --recursive --level=inf --no-verbose --execute robots=off "$_url" 2>&1
# Remove audio from video.
# Input: from.mov
# Output: to.mov
ffmpeg -i from.mov -c copy -an to.mov
@ecoopnet
ecoopnet / Kotlin graphics util
Created July 30, 2020 11:55
Android Kotlin Graphics Utility.
// python numpy の処理をRectに適用できても面白いかも。
// TODO:
// fun RectF().toInt(): Rect
// fun Rect().toFloat(): RectF
// fun Rect.scaleCenter(scaleX: Float, scaleY: Float): RectF
// fun Rect.scaleCenter(scaleXY: Float): RectF
/// Scale X and Y separately.
fun Rect.scale(scaleX: Float, scaleY): RectF
@ecoopnet
ecoopnet / MaBeeeSDK_code.podspec
Last active March 1, 2023 10:33
MaBeeeSDK_code
# https://gist.githubusercontent.com/syiss0257/ed30778981b134838063a10986baf61b/raw/066923c899e74b1d34bd4634d2de10ab69e35f49/MaBeeeSDK_code.podspec
Pod::Spec.new do |s|
s.name = 'MaBeeeSDK_code'
s.version = '0.1.0'
s.summary = 'MaBeee SDK_code for iOS.'
s.description = 'MaBeee SDK for iOS from code.'
s.homepage = 'https://guildworks.jp/'
s.license = {
:type => 'Copyright',
:text => 'Copyright GuildWorks.'
import Foundation
extension CGPoint {
// CGPoint -> Point<Double> に変換
func toPoint() -> Point<Double> {
return Point<Double>(x: Double(x), y: Double(y))
}
}
extension CGSize {