View devenv.sh
function devenv() {
cname=$(docker ps -a --format '{{.Image}} {{.Names}} {{.Status}}' | awk 'match($1, /devenv/) {print $2} ')
if [[ -n "$cname" ]]; then
status=$(docker ps -a --format '{{.Image}} {{.Names}} {{.Status}}' | awk 'match($1, /devenv/) {print $3} ')
echo "==> status: $status"
if [[ $status =~ ^Up.* ]]; then
echo "==> exec $cname"
docker exec -it $cname /bin/bash
else
echo "==> start and attach $cname"
View Caddyfile
proxy /gotty/mysql/ 127.0.0.1:8080 {
without /gotty/mysql
websocket
transparent
}
View fzf_docker_yml.sh
function parse_yaml () {
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("___")}
View show_create_table.py
#!/usr/bin/env python
# sqlalchemy
# https://github.com/zzzeek/sqlalchemy
# sqlalchemy engine
# http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html
# reflection
# http://docs.sqlalchemy.org/en/latest/core/reflection.html
View download_book_list_button.js
setTimeout(function(){
var $button =
$('<div id="__download_button" style="' +
' position: fixed;' +
' top: 5px;' +
' right: 200px;' +
' border-radius: 5px;' +
' background: gray;' +
' padding: 8px;' +
' border-top: 1px white solid;' +
View set_up_docker_machine.md
View scrape_shiftjis_page.go
package main
import (
"fmt"
"io"
"net/http"
gq "github.com/PuerkitoBio/goquery"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/transform"
View upload_ipa.sh
_usage() {
cat << _USAGE_
usage: upload_ipa <config_json> <version>
This program depends on the following commands
jq
ipa (shenzhen)
and needs config.json like this.
{
View resize_with_imagick.go
package main
import "github.com/gographics/imagick/imagick"
func main() {
imagick.Initialize()
defer imagick.Terminate()
mw := imagick.NewMagickWand()
defer mw.Destroy()
View XMPPFramework.podspec.json
{
"name": "XMPPFramework",
"version": "3.6.4",
"platforms": {
"ios": "5.0",
"osx": "10.7"
},
"license": {
"type": "BSD",
"file": "copying.txt"