Skip to content

Instantly share code, notes, and snippets.

@saitodev
saitodev / deep_MNIST_for_experts.py
Created November 6, 2016 09:39
Tensorflow tutorial "Deep MNIST for Experts"
from __future__ import print_function
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
// -*- coding: utf-8 -*-
#include <iostream>
#include <fstream>
#include <memory>
#include <vector>
#include <cassert>
#include <cstdint>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
@saitodev
saitodev / supervisord
Last active April 9, 2020 12:31 — forked from keimlink/gist:831633
supervisord init script for CentOS
#!/bin/sh
#
# Startup script for the Supervisor server
#
# chkconfig: - 90 10
# description: Supervisor is a client/server system that allows its users to \
# monitor and control a number of processes on UNIX-like \
# operating systems.
#
# processname: supervisord
#!/bin/bash -eu
# -*- coding: utf-8 -*-
HEADER_DIR=/tmp/tensorflow/include
if [ ! -e $HEADER_DIR ];
then
mkdir -p $HEADER_DIR
fi
@saitodev
saitodev / MNIST_for_ML_beginners.py
Created November 6, 2016 09:17
Tensorflow tutorial "MNIST For ML Beginners"
from __future__ import print_function
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
@saitodev
saitodev / setup_iptables.sh
Created August 13, 2013 03:45
iptables example
#!/bin/sh
# -*- coding: utf-8 -*-
IPTABLES=/sbin/iptables
SERVICE=/sbin/service
SSH_PORT=22
$IPTABLES -F # すべてのチェインの内容を削除
$IPTABLES -P INPUT ACCEPT # INPUTチェインのポリシーをACCEPTにする
from __future__ import print_function
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data/', one_hot=True)
import tensorflow as tf
from tensorflow.python.framework.graph_util import convert_variables_to_constants
def train_and_save():
x = tf.placeholder(tf.float32, [None, 784], name='x')
from __future__ import print_function
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
import tensorflow as tf
def import_graph_def():
with open('trained_graph.pb', 'rb') as f:
graph_def = tf.GraphDef()
@saitodev
saitodev / get_authkey.sh
Last active April 24, 2016 07:27
ネットラジオを聴くためのスクリプト。Python製
#!/bin/bash
# -*- coding: utf-8 -*-
PLAYER_URL='http://radiko.jp/player/swf/player_4.1.0.00.swf'
wget $PLAYER_URL -O player.swf
swfextract -b 14 -o authkey.png player.swf
rm -f player.swf
@saitodev
saitodev / start-ssh-agent.bat
Last active December 21, 2015 15:29
This batch file start 'ssh-agent' and set environment variables. Put this file to your startup folder.
C:\cygwin\bin\bash.exe -c "/usr/bin/ssh-agent | /usr/bin/sed -e '/echo/d' | /usr/bin/cut -f 1 -d ';' | /usr/bin/tr '=' ' ' | while read line; do setx.exe $line; done;"