Skip to content

Instantly share code, notes, and snippets.

View takahashilabo's full-sized avatar

Keiichi Takahashi takahashilabo

View GitHub Profile
#!/bin/bash
read -p "page no => " page
getwindowid "Kindlei Classic" --list
#brew install smokris/getwindowid/getwindowid でインストールする.
read -p "window id => " wid
osascript -e 'tell application "Kindle" to activate'
#!/bin/bash
#前提: cpdfをhttps://github.com/coherentgraphics/cpdf-binariesから取得してインストールしておく
if [ $# -ne 1 ];then
echo "Usage: $0 <pdf filename>";
exit 1
fi
w=$(cpdf -page-info $1 | grep MediaBox | awk -F' ' '{print $4}' | uniq)
require 'fileutils'
#使い方
#デスクトップ等でターミナルから「ruby pdf_downloder.rb」と入力してください。
#最初に大会Webページからhtmlをダウンロードし、html内を解析してリンクされたpdfファイルをダウンロードします(サーバ負荷で迷惑にならないようにsleepかけています)。
#最終的に、1〜8.htmlとpdfディレクトリがrubyを実行したディレクトリに生成されます。それぞれのhtmlファイルを開いてご利用ください。
#参加登録したらメールで送られてくる論文アクセス情報がありますので、それぞれuseridとpasswordに設定してください
base = 'https://onsite.gakkai-web.net/ipsj/onsite/html/program'
userid = '*****'
@takahashilabo
takahashilabo / gist:02342d1a1e83e9f830d24df96aa7f123
Last active January 27, 2023 01:47
Google ClassroomのClassroomフォルダから最新提出ファイルのみ取り出すスクリプト(ChatGPTの生成コードを改変しただけ)
//使い方:
// 1. Google Driveのトップにスクリプトを新規作成し以下のコピペする。
// 2. 抽出したいClassroomの課題フォルダのFOLDER_IDを取得して以下にコピペする
// 3. あとは1で作成したスクリプトを実行する(コード上の実行ボタンを押すだけ)。
// 4. Google DriveのトップにLatest Submissionsというフォルダができるのでその中に提出された最新ファイルだけがコピーされる。
function extractLatestSubmissions() {
// Define the folder containing the submissions
var folder = DriveApp.getFolderById("FOLDER_ID");
// Get all the files in the folder
#!/bin/bash
page=10 #Kindleのページ数をいれる
wid=7374 #brew install smokris/getwindowid/getwindowid でインストールして「getwindowid Kindle --list」を実行した書籍のウィンドウIDを取得していれる
osascript -e 'tell application "Kindle" to activate'
while (( page-- > 0)); do
/usr/sbin/screencapture -l$wid -x -r o/c_`ls o/*png | wc -w | sed 's/^[[:blank:]]*//'`.png
osascript -e 'tell application "System Events" to keystroke (ASCII character 29)'
class Entry:
def add():
pass
def getName():
pass
class File_(Entry):
def __init__(self, name):
self.__name = name
def add(self):
@takahashilabo
takahashilabo / gist:93c5886a6eead21939596756c1ffa99e
Created May 19, 2022 11:08
Mario and Kuribo on Factroy Method Pattern
class Chara:
def __init__(self):
self.__cs = []
def add(self, c):
self.__cs.append(c)
def draw(self) :
pass
@takahashilabo
takahashilabo / gist:28125871c0ef45832debf595bbf350f7
Last active May 19, 2022 11:06
Mario and Kuribo on Template Method Pattern
class Chara:
def __init__(self):
self.__cs = []
def add(self, c):
self.__cs.append(c)
def draw(self) :
pass
@takahashilabo
takahashilabo / gist:fa1881cf524376b2038e181320865a28
Last active May 19, 2022 10:54
Simple janken program on Strategy Pattern
import random
class Hand:
hand = ['GUU', 'CHO', 'PA']
@classmethod
def getHand(cls, i):
return cls.hand[i]
class Strategy:
def nextHand(self):
@takahashilabo
takahashilabo / gist:f1de55e37ee88083cd3e50f9a39b8ff8
Created April 23, 2021 10:10
Box Step by Sphero Mini using Spherov2.js
//see https://www.youtube.com/watch?v=SjjnBMIci2s
//spherov2.js at https://github.com/igbopie/spherov2.js
const { Scanner, Utils } = require('spherov2.js');
const makeItBlink = async () => {
const spheros = await Scanner.findAllSpheroMini();
if (!spheros || spheros.length == 0) return console.log('sphero mini not available!');