Skip to content

Instantly share code, notes, and snippets.

Shinichi Okamoto okamos

Block or report user

Report or block okamos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bubble-sort.go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
View config.yml
version: 2
references:
workspace_root: &workspace
/tmp/workspace
jobs:
test_app:
working_directory: /go/src/github.com/loka-research/gostory
View transcode.sh
## sound
ffmpeg -y -i input.mp4 -f mp4 -acodec libfdk_aac -ar 44100 -b:a 64k -ac 2 -profile:a aac_he -afterburner 1 -vn output.m4a
## mp4 video
ffmpeg -y -i input.mp4 -f mp4 -vcodec libx264 -acodec libfdk_aac -s 1280x720 -b:v 3000k -r 29.97 -pix_fmt yuv420p -b:a 128k -ar 44100 -ac 2 -aspect 1280:720 output.mp4
## sprite animation webp / jpg
ffmpeg -loglevel verbose -i input.mp4 -s 400x400 -r 12 -crf 0 -b:v 100000k -an -f mpegts - 2>"ffmpeglog" |\
ffmpeg -i - -vcodec libwebp -vf tile=4x7 -qscale:v 60 "out/%05d.webp" 2>/dev/null
View monthly_imp_and_play.rb
_pry_.config.print = proc {}
campaigns = Campaign.includes(:customer).all
Time.zone = 'Asia/Tokyo'
start_at = (Time.zone.now - 1.month).beginning_of_month
end_at = (Time.zone.now - 1.month).end_of_month
campaign_data = campaigns.map do |cam|
imp_value = ReportBase.where(delivery_id: cam.deliveries.map(&:id), report_id: 1, report_at: start_at..end_at).sum(:value) || 0
play_value = ReportBase.where(delivery_id: cam.deliveries.map(&:id), report_id: 101, report_at: start_at..end_at).sum(:value) || 0
{ customer_name: cam.customer.customer_name, name: cam.name, imp: imp_value, play: play_value }
end
You can’t perform that action at this time.