Skip to content

Instantly share code, notes, and snippets.

View ujiro99's full-sized avatar

ujiro99 ujiro99

  • japan
View GitHub Profile
@ujiro99
ujiro99 / charset.coffee
Created May 18, 2013 06:50
Node.jsで、取得したWebページをUTF-8へ自動変換する ref: http://qiita.com/items/648a9400e8b25d717b1e
{Iconv} = require "iconv"
{Buffer} = require "buffer"
# エンコーディングの判別
getCharset = (body) ->
bin = body.toString('binary')
re = bin.match(/<meta\b[^>]*charset=["']?([\w\-]+)/i)
if re
charset = re[1]
# 現在のユーザー名とホスト名をタイトルに
$global:currentuser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$user_and_host = ($currentuser.name -replace "(.*?)\\(.*?)$", "`$2@`$1")
$Host.UI.RawUI.WindowTitle = $user_and_host + " - Windows PowerShell"
# プロンプトのカスタマイズ
function prompt {
write-host ""
# ディレクトリの表示 (バックスラッシュをスラッシュに変換)
@ujiro99
ujiro99 / analytics.coffee
Last active January 1, 2016 22:19
AngularJSでGoogle Analyticsを使うためのシンプルなServiceとDirective.
angular.module('analytics', [])
.factory 'Analytics', ['$log', ($log) ->
_service = null
_tracker = null
return {
###*
Set parameter, and initialize.
angular.module('jobFoundryDirectives').directive 'spy', ($location) ->
restrict: "A"
require: "^scrollSpy"
link: (scope, elem, attrs, scrollSpy) ->
attrs.spyClass ?= "current"
elem.click ->
scope.$apply ->
$location.hash(attrs.spy)
@ujiro99
ujiro99 / designer.html
Created September 6, 2014 08:28
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@ujiro99
ujiro99 / bumpUp.coffee
Created February 22, 2015 02:07
選択したファイルのリビジョン番号をインクリメントし、元のファイルのバックアップを行う、秀丸ファイラ用のスクリプト
class FileOperator
# constant
BACKUP_DIR_NAME = "bak"
NO_OVERWRITE = "false"
PATH_SEPARATOR = "/"
EXTENSION_SEPARATOR = "."
REVISION_INIT = 2
# fields
@ujiro99
ujiro99 / itunes.sh
Last active August 29, 2015 14:26 — forked from rkumar/itunes.sh
control iTunes from command line
#!/bin/bash
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 rahul kumar
####################################
showHelp () {
(function() {
RTT.addPlugin("emptyPlugin", {
onSendTimeEntry: function(RTT, params) {
return console.log("onSendTimeEntry");
},
onSendedTimeEntry: function(RTT, params) {
return console.log("onSendedTimeEntry");
@ujiro99
ujiro99 / change-key-repeat.bat
Last active January 27, 2023 16:20
Windows10のキーリピートの速さを変える
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response" /v AutoRepeatDelay /d 200 /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response" /v AutoRepeatRate /d 10 /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response" /v BounceTime /d 0 /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response" /v DelayBeforeAcceptance /d 0 /f
reg add "HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response" /v Flags /d 59 /f
@ujiro99
ujiro99 / bootlocal.sh
Created August 16, 2017 17:38
docker-machine起動時にHostOS(Windows)のDirectoryをマウントするスクリプト
# /var/lib/boot2docker/に格納するとdocker-machine起動時に実行される
ip addr add 172.29.32.2/20 dev eth0 # HostOSと同じサブネット内で固定IPアドレスを設定する
uid=1000 # dockerユーザ
gid=50 # staffグループ
user=share # HostOSで共有を許可したユーザ名
password=xxxxxxxxxxxx # 共有を許可したユーザのパスワード
host_ip=//172.29.32.1 # HostOSのIPアドレス