Skip to content

Instantly share code, notes, and snippets.

@moyashi
moyashi / AutoHotkey.ahk
Last active May 1, 2020 15:46
ドン・キホーテのNANOTE用AutoHotkeyスクリプト
; NANOTE用定義
#Include IME.ahk
; IME.ahkはここの089.zipから入手可能
; http://lukewarm.s101.xrea.com/up/index.php
;---------------------------
;左Shift+SpaceでIMEのトグル
<+Space::
@moyashi
moyashi / GoogleTranslate.applescript
Created February 26, 2020 04:55
Safariで見ているページをGoogle翻訳に渡して日本語表示するAppleScript
tell application "Safari"
tell document 1
set u to URL
set uu to "https://translate.google.com/translate?sl=auto&tl=ja&u=" & u
open location uu
end tell
end tell
@moyashi
moyashi / GoogleTranslate.js
Last active February 26, 2020 03:17
今見ているページをGoogle翻訳に渡して日本語翻訳表示するブックマークレット
javascript:var%20g%3D%22https%3A%2F%2Ftranslate.google.com%2Ftranslate%3Fsl%3Dauto%26tl%3Dja%26u%3D%22%3Bvar%20u%3DencodeURIComponent(location.href)%3Blocation.href%3Dg%20%2B%20u%3Bvoid(0);
@moyashi
moyashi / SharePlaceInTheRightWay.js
Last active February 21, 2020 03:13
Googleマップの共有機能は短縮URLしか共有できず不便なので、地点名、住所を追加するUserScript。(Tampermonkeyで動作確認)
// ==UserScript==
// @name SharePlaceInTheRightWay
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.google.com/maps/*
// @match https://maps.google.com/*
// @grant none
// @require https://code.jquery.com/jquery-3.4.1.slim.min.js
@moyashi
moyashi / amazonshare.js
Created February 16, 2020 11:32
AmazonからTwitterへのシェアの文面を整形するUserScript。Tampermonkeyで動作確認
// ==UserScript==
// @name AmazonShare
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fwww.amazon.co.jp*
// @grant none
// @require https://code.jquery.com/jquery-3.4.1.slim.min.js
// ==/UserScript==
@moyashi
moyashi / PrinterConnect.js
Last active February 7, 2020 05:58
OptoPrintでページ表示後に「Connect」ボタンを自動的に押すUserScript
// ==UserScript==
// @name PrinterConnect
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://192.168.1.33/
// @match http://192.168.1.32/
// @grant none
// ==/UserScript==
@moyashi
moyashi / BitBar-OctoPrint.rb
Last active February 5, 2020 01:52
OctoPrintを接続した3Dプリンターの動作状況をmacOS用アプリBitBarを使ってステータスバーに表示するRubyスクリプト
#!/usr/local/opt/ruby/bin/ruby
require 'open-uri'
require 'json'
require 'time'
OCTPRINT_IP = "192.168.1.33"
HEADER = "[C]"
begin
@moyashi
moyashi / eject_ms_dos_disk.applescript
Last active December 24, 2019 14:14
SDカード等のMS-DOSフォーマットのディスクをイジェクトするAppleScript
display notification "イジェクト処理開始"
set dl to {}
repeat with l in every paragraph of (do shell script "mount | grep -e 'msdos\\|exfat' | awk '{print $1}'")
set end of dl to (do shell script "diskutil info " & l & " | grep 'Volume Name:' | sed -e 's/Volume Name: //' | sed -e 's/^ *//'")
end repeat
if ((count of dl) is greater than 0) then
tell application "Finder"
toggleInstantHotspot = [[
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set menuBarItems to (every menu bar item whose description begins with "Wi-Fi")
if (count of menuBarItems) is greater than 0 then
set wifiMenuBarItem to item 1 of menuBarItems
click wifiMenuBarItem
--接続中か判定
set menuItemDisconnects to (every menu item of menu 1 of wifiMenuBarItem whose name ends with "との接続を解除")
;-------------------------------- 設定 ----------------------------------
TETHERING_SSIDS = {"iPhone 7 Plus", "iPhone 8 Plus"}
PASSWORD = "0000"
;--------------------------------------------------------------------------
DEBUG = true
;--------------------------------------------------------------------------
function setApplicationFirewall(arg)
hs.execute("echo " .. PASSWORD .. " | sudo -S /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate " .. arg)
end