Skip to content

Instantly share code, notes, and snippets.

View okamos's full-sized avatar

Shinichi Okamoto okamos

  • Tokyo, Japan
View GitHub Profile
_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
@okamos
okamos / transcode.sh
Last active April 18, 2017 09:42
FFmpeg
## 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
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
@okamos
okamos / .goreleaser.yml
Created October 30, 2019 05:27
Multiple build using GoReleaser
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't need go generate
- go generate ./...
builds:
-
id: scene-build
main: ./bin/scene/main.go
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
$ScriptWebArchive = "https://github.com/parsec-cloud/Parsec-Cloud-Preparation-Tool/archive/master.zip"
$LocalArchivePath = "$ENV:UserProfile\Downloads\Parsec-Cloud-Preparation-Tool"
(New-Object System.Net.WebClient).DownloadFile($ScriptWebArchive, "$LocalArchivePath.zip")
Expand-Archive "$LocalArchivePath.zip" -DestinationPath $LocalArchivePath -Force
CD $LocalArchivePath\Parsec-Cloud-Preparation-Tool-master\ | powershell.exe .\Loader.ps1
# type of database. Run with -dbhelp for details
# if mssql doesn't work: try mssql08 in combination with sqljdbc_7.2, this combination has been tested
schemaspy.t=pgsql
# optional path to alternative jdbc drivers.
# schemaspy.dp=path/to/drivers
# database properties: host, port number, name user, password
schemaspy.host=localhost
schemaspy.port=5432
schemaspy.db=development
schemaspy.u=postgres