This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
with tf.device('/cpu:0'): | |
a_c = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a-cpu') | |
b_c = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b-cpu') | |
c_c = tf.matmul(a_c, b_c, name='c-cpu') | |
with tf.device('/gpu:0'): | |
a_g = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a-gpu') | |
b_g = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b-gpu') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConvertSqliteBooleans < ActiveRecord::Migration[6.0] | |
BOOLEANS = [ | |
[ 'table_name', 'column_name' ], | |
[ 'table_name', 'column_name' ], | |
] | |
def up | |
BOOLEANS.each do |table, column| | |
execute "UPDATE #{table} SET #{column} = 1 WHERE #{column} = 't';" | |
execute "UPDATE #{table} SET #{column} = 0 WHERE #{column} = 'f' OR #{column} IS NULL;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
- name: Install prerequisites for Docker repository | |
apt: | |
name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2', 'software-properties-common'] | |
update_cache: yes | |
- name: Add Docker GPG key | |
apt_key: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/ | |
### | |
# Label definitions | |
### | |
declare -A LABELS | |
# Platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'data_mapper' | |
gem 'dm-sqlite-adapter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RDoc::Markup::Formatter | |
def parse_url url | |
case url | |
when /^rdoc-label:([^:]*)(?::(.*))?/ then | |
scheme = 'link' | |
path = "##{$1}" | |
id = " id=\"#{$2}\"" if $2 | |
when /([A-Za-z]+):(.*)/ then | |
scheme = $1.downcase | |
path = $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'sinatra' | |
get '/:animal' do | |
@all_animals = ['Cat', 'Dog'] | |
@animal = params[:animal] if @all_animals.include? params[:animal] | |
erb :index | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'rack/urlmap' | |
require File.join(File.dirname(__FILE__), 'app') | |
require File.join(File.dirname(__FILE__), 'api', 'v1') | |
routes = Rack::URLMap.new( | |
'/' => Sinatra::Application, | |
'/api/v1/' => ApiV1 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions: http://nokogiri.org/tutorials/installing_nokogiri.html | |
# See also: https://github.com/tenderlove/nokogiri/issues/243 | |
toast arm libxml libxslt && \ | |
gem install nokogiri -- \ | |
--with-xml2-lib=$HOME/.toast/armed/lib \ | |
--with-xml2-include=$HOME/.toast/armed/include/libxml2 \ | |
--with-xslt-dir=$HOME/.toast/armed | |
bundle config build.nokogiri \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/:name.css' do | |
content_type 'text/css', :charset => 'utf-8' | |
response.headers['Cache-Control'] = 'public, max-age=3600' | |
sass :"stylesheets/#{params[:name]}" | |
end |