Skip to content

Instantly share code, notes, and snippets.

@flightonary
flightonary / z2f_history.rb
Created October 24, 2018 16:19
Convert zsh_history to fish_history (in case that zsh_history is old format)
# from https://qiita.com/troter/items/f011f3bf5afa72749731
require 'stringio'
require 'date'
File.open(File.expand_path('~/.zsh_history')) do |f|
escaped = StringIO.new
# .zsh_historyのデコード
f.to_enum(:each_byte).tap do |enum|
@flightonary
flightonary / docker-compose.yml
Created June 7, 2018 15:53
docker-compose of mongodb and rabbitmq
version: '2'
services:
mongodb:
image: mongo:latest
container_name: mongodb
environment:
- 'MONGODB_USER=user'
- 'MONGODB_PASS=password!'
volumes:
@flightonary
flightonary / fr24.rb
Last active June 4, 2023 20:03
Recording flight data from frightradar24
#!/usr/bin/ruby
# 参考URL
# http://www.mk-mode.com/octopress/2016/02/08/fr24-getting-flight-info/
require 'json'
require 'open-uri'
require 'timeout'
require 'csv'
@flightonary
flightonary / Application.scala
Created April 20, 2015 13:59
ByteContentResult in Play Framework
package controllers
import play.api.mvc._
import utilities._
object Application extends Controller with ResultUtility {
object DataStore {
val filename = "hoge.gif"
val contentType = "image/gif"
val blobdata = "data".getBytes
@flightonary
flightonary / sqrt.scala
Created March 30, 2015 15:03
BigDecimal Sqrt in Scala
import java.math.BigDecimal
import java.math.MathContext
def sqrt(a: BigDecimal, scale: Int): BigDecimal = {
var x = new BigDecimal( Math.sqrt(a.doubleValue()), MathContext.DECIMAL64 )
if (scale < 17) {
return x
}
@flightonary
flightonary / gem-native-compile.sh
Last active August 29, 2015 14:12
gem pre-compile script
#!/bin/bash
# commands
GEM=/usr/bin/gem
RAKE=/usr/bin/rake
# const params
TMP_DIR=/tmp/gem-native
usage()