Skip to content

Instantly share code, notes, and snippets.

View akiraak's full-sized avatar

Akira Kozakai akiraak

View GitHub Profile
$ ./watch_rsync
---- watch_rsync ----
#!/bin/sh
fswatch --exclude="/.git/" --exclude="/target/" -x ../ | xargs -I "file_path" ./conv_rsync_path.py "file_path"
---- watch_rsync ----
---- conv_rsync_path.py ----
#!/usr/bin/python
# -*- coding: utf-8 -*-
@akiraak
akiraak / file0.txt
Last active March 15, 2016 12:40
高速化のため Slick2 で SQL に書きなおしたときの手法 ref: http://qiita.com/akiraak/items/b9b66ae66799720b16fd
import play.api.db.slick._
import scala.slick.jdbc.{StaticQuery => Q}
// 全てのユーザーの id を返す
def users(): List[Int] = {
DB withSession {
Q.queryNA[Int]("""
select id from users
""").list
}
@akiraak
akiraak / file0.sh
Last active April 22, 2016 07:27
TensorFlow 0.8 GPU 版を Ubuntu 14.04 にインストール ref: http://qiita.com/akiraak/items/1c7fb452fb7721292071
$ sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
$ sudo apt-get update
$ sudo apt-get install cuda
package main
import (
"fmt"
"github.com/DDRBoxman/go-amazon-product-api"
"github.com/PuerkitoBio/goquery"
"io/ioutil"
"os"
"strings"
"time"
# -*- coding:utf-8 -*-
import time
from lxml import objectify
class ImageInfo:
def __init__(self):
self.url = ''
self.width = ''
self.height = ''
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"io/ioutil"
"strconv"
"strings"
"time"
)
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"io/ioutil"
"strconv"
"strings"
"time"
)
type PageItem struct {
Page int
Str string
}
type Page struct {
Items []PageItem
MaxPage int
}
@akiraak
akiraak / base.html
Created June 18, 2017 03:40
Echoでtemplateを使う
{{define "base"}}
<html lang="en">
<head>
<title>{{template "title" .}}</title>
</head>
<body>
{{template "body" .}}
</body>
</html>
{{end}}
@akiraak
akiraak / thread.py
Last active October 1, 2017 23:39
Pythonでシンプルにステッド処理
import os
import concurrent.futures as confu
def target_func(x):
return x + 1
def main():
count = 10