Skip to content

Instantly share code, notes, and snippets.

loop_num = 100000
start_time = Time.now
str1 = ''
(1..loop_num).each do |_n|
str1 += 'a'
end
p "+=で#{loop_num}回結合するのにかかった時間は#{Time.now - start_time}秒"
start_time = Time.now
str2 = ''
@hatappi
hatappi / gist:92c27bd03ff282dbd731c0436876cb93
Last active June 10, 2021 12:00
airflow webserver init script
#!/bin/bash
EXEC_SCRIPT=/opt/local/bin/airflow
CMDNAME=`basename $0`
LOG_DIR=/var/log/airflow
PID_DIR=/var/run
PID_FILE="$PID_DIR"/airflow_webserver.pid
LOG_FILE="$LOG_DIR"/webserver.log
PORT=8888
RUN_USER=vagrant
@hatappi
hatappi / kuroko2-executor.service
Last active December 1, 2016 11:19
Kuroko2 scheduler, processor, executor service
[Unit]
Description=Kuroko2 executor
[Service]
Environment=LANG=ja_JP.UTF-8
Environment=RAILS_ENV=production
Environment=NUM_WORKERS=2
Environment=QUEUE=@default
User=<user_name>
WorkingDirectory=<kuroko2プロジェクトのディレクトリ>

test

  1. hoge
    • AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
#!/usr/bin/env ruby
require 'matrix'
CLASS_1 = 1
CLASS_2 = 2
data = Matrix.rows([
[ 1.0, CLASS_1],
[ 0.5, CLASS_1],
function main() {
const threads = GmailApp.search('label:gcsエクスポート-未処理');
for(var i = 0; i < threads.length; i++) {
const messages = GmailApp.getMessagesForThread(threads[i]);
/* 各メールから日時、送信元、件名、内容を取り出す*/
const message = messages[messages.length - 1];
const attachments = message.getAttachments();
for(var j = 0; j < attachments.length; j++) {
if (attachments[0].getName() == "書き出す.zip") {
// GmailAttachment
{
"variables": {
"docker_hub_login_email": "{{env `DOCKER_HUB_LOGIN_EMAIL`}}",
"docker_hub_login_password": "{{env `DOCKER_HUB_LOGIN_PASSWORD`}}"
},
"builders":[
{
"type": "docker",
"image": "ubuntu",
"export_path": "image.tar"
version: 2
jobs:
build:
docker:
- image: ruby:2.4.1
working_directory: ~/circleci-2.0
steps:
- checkout
- run: ruby -v
deploy:
require 'pycall/import'
include PyCall::Import
pyimport 'numpy', as: :np
x = np.matrix.([[1,2], [3, 4]])
# => matrix([[1, 2],
# [3, 4]])
y = np.matrix.([[5,6], [7, 8]])
# => matrix([[5, 6],
require 'arrow'
input = Arrow::MemoryMappedInputStream.open("/dev/shm/arrays.arrow")
reader = Arrow::RecordBatchFileReader.new(input)
reader.first.find_column('x').entries.map(&:to_a)
# => [[1, 2], [3, 4]]
reader.first.find_column('y').entries.map(&:to_a)
# => [[5, 6], [7, 8]]
reader.first.find_column('z').entries.map(&:to_a)
# => [[19, 22], [43, 50]]