Skip to content

Instantly share code, notes, and snippets.

View Ladicle's full-sized avatar
WFH

Aya (Igarashi) Ozawa Ladicle

WFH
View GitHub Profile
@Ladicle
Ladicle / multilogin
Last active August 29, 2015 14:10
tmuxで指定hostに一斉接続
#!/bin/bash
function usage() {
echo ""
echo "$(basename ${0}) is a tool to connect to multi servers on same time"
echo ""
echo "Usage:"
echo " $(basename ${0}) [<options>] hostname..."
echo "Options:"
echo " --window, -w [name] set window name"
@Ladicle
Ladicle / tailcolor
Last active August 29, 2015 14:10
tailに対してpipで渡せば色つくよ
perl -pe "s/INFO|DEBUG|^D|^I/\e[1;33m$&${DEFO}/g;s/Finish|[Ss]uccess|SUCCESS/\e[1;32m$&\e[0m/g;s/^F|ERROR|Error|FAIL|Fail/\e[1;31m$&\e[0m/g;s/Start|START|start[^=]/\e[1;36m$&\e[0m/g;s/ \[[^\]]*\]/\e[1;35m$&\e[0m/g"
@Ladicle
Ladicle / Hash
Last active August 29, 2015 14:21
Hashのキーをシンボルに変換する(全階層 & 途中配列が入っていてもok)
def deep_symbolize_keys
self.each_with_object({}) do |(key, val), memo|
if val.is_a?(Array)
val = val.map{|v| v.deep_symbolize_keys}
elsif val.is_a?(Hash)
val = val.deep_symbolize_keys
end
memo[key.to_s.to_sym] = val
end
end
@Ladicle
Ladicle / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Ladicle
Ladicle / private.xml
Last active August 29, 2015 14:23
Karabina用 Realforce JIS配列の英字変換
<?xml version="1.0"?>
<root>
<item>
<name>[Realforce] eiji mode</name>
<identifier>private.mode.realforce</identifier>
<autogen>
__KeyToKey__
KeyCode::KEY_0, ModifierFlag::NONE,
KeyCode::MINUS, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT
</autogen>
flake8 | awk -F : '{print "+"$2":"$3" "$1}'| xargs -n2 emacsclient -nw -a ""
#!/bin/bash -e
echo "1. Create temporary directory"
mkdir tmp && cd tmp
echo "2. Download install script"
wget https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install
wget https://gist.githubusercontent.com/Ladicle/c2dde654a4388aa347f2b575e2a17da1/raw/af963e4eabc5e77f252eccbacdc0eef9da3699f6/cloud-config.yml
echo "3. Install coreos to /dev/sda"
package main
import (
"bufio"
"io"
"log"
"net/http"
"os"
"path/filepath"
)
diff --git gojson/gojson.go gojson/gojson.go
index 567a416..fdb8acf 100644
--- gojson/gojson.go
+++ gojson/gojson.go
@@ -45,6 +45,7 @@ package main
import (
"flag"
"fmt"
+ "go/format"
"io"
@Ladicle
Ladicle / sound
Last active April 17, 2017 16:47
Sound command for OSX
#!/bin/bash -e
# Note:
# This script depends on "audiodevice" command.
# You need to install it in advance.
# http://whoshacks.blogspot.jp/2009/01/change-audio-devices-via-shell-script.html
function usage() {
cat <<EOF
Usage: $(basename $0) [options] [commands]