Skip to content

Instantly share code, notes, and snippets.

View sonsongithub's full-sized avatar

Yuichi Yoshida sonsongithub

View GitHub Profile
@sonsongithub
sonsongithub / .atom styles.less
Created September 7, 2017 11:23
atomのMarkdownのスタイルをいじるときの例
.markdown-preview.markdown-preview {
& { font-size: 1.0em; }
h1 { font-size: 2.0em; }
h2 { font-size: 2.0em; }
h3 { font-size: 1.6em; }
h4 { font-size: 1.2em; }
h5 { font-size: 1.2em; }
h6 { font-size: 1.2em; }
}
@sonsongithub
sonsongithub / line.swift
Created August 20, 2017 13:41
Get lines from a binary data of strings.
extension Data {
/**
生のテキストデータをバイナリのまま改行コードを探し,改行コードごとにバイトストリームを切り分けて,テキストにデコードする.
戻り値はテキストのArrayになる.
- returns: 文字列のArray.
*/
func lines() throws -> [String] {
return try self.withUnsafeBytes({ (pointer: UnsafePointer<UInt8>) -> [String] in
let buffer = [UInt8](UnsafeBufferPointer(start: pointer, count: self.count))
var lines: [String] = []
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
#!/usr/bin/env ruby
require 'json'
lines = $stdin.map {|line| line }.reverse
titles = lines.pop.split(",")
results = Array.new
func read(handle: UnsafeMutablePointer<FILE>) throws -> Int {
var buffer: [Int] = [Int](repeating: 0, count: 1)
guard fread(&buffer, Int(MemoryLayout<Int>.size), 1, handle) == 1 else {
throw NSError(domain: "com.sonson.2tch", code: 0, userInfo: ["message": "An error occurred during writing to the handle (errno: \(errno))"])
}
return buffer[0]
}
func write(value: Int, handle: UnsafeMutablePointer<FILE>) throws {
do {
@sonsongithub
sonsongithub / rider.ipynb
Last active January 15, 2017 09:03
仮面ライダーのレベルがおかしい
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sonsongithub
sonsongithub / remove_library.sh
Created January 10, 2017 23:47
cmakeでインストールしたライブラリの削除/How to uninstall library which is installed with cmake.
xargs rm < install_manifest.txt
@sonsongithub
sonsongithub / Demitasse_run_example.sh
Created January 7, 2017 08:40
Script for running example.
(cd ./Demitasse/data/vgg_16/; bash ./fetch_data.sh)
(cd ./Demitasse/data/ilsvrc/; bash ./fetch_data.sh)
./build_Demitasse/tools/caffe2demitasse \
./Demitasse/data/vgg_16/VGG_ILSVRC_16_layers_deploy.prototxt \
./Demitasse/data/vgg_16/VGG_ILSVRC_16_layers.caffemodel \
./converted.bin
(cd build_Demitasse/examples; ./vgg_bench ../../converted.bin)
docker rm $(docker ps -aq)
@sonsongithub
sonsongithub / gist:6a5e78ebb4671f7284fb6e606a25e262
Created December 31, 2016 22:35
Delete containers that have exited.
docker rm $(docker ps -f status=exited -q)