Skip to content

Instantly share code, notes, and snippets.

Tatsuya Koishi pooza

Block or report user

Report or block pooza

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 growi.god
God.watch do |god|
god.name = 'growi'
god.env = {
'NODE_ENV' => 'production',
'MONGO_URI' => 'mongodb://localhost:27017/growi',
'PORT' => '3012',
}
god.dir = '/home/growi/growi'
god.uid = 'growi'
god.start = 'node /home/growi/growi/src/server/app.js'
View local.god
path = ENV['PATH'].split(':')
path.unshift('/sbin')
path.unshift('/usr/sbin')
path.unshift('/usr/local/sbin')
path.unshift('/bin')
path.unshift('/usr/bin')
path.unshift('/usr/local/bin')
path.uniq!
ENV['PATH'] = path.join(':')
View mongodb.conf
systemLog:
destination: syslog
storage:
dbPath: /var/db/mongodb
journal:
enabled: true
processManagement:
fork: true
View upload.rb
require 'rest-client'
response = RestClient.post(
'https://mstdn.example.com/api/v1/media',
{file: File.new(filepath, 'rb')},
{'Authorization' => "Bearer #{token}"},
)
media_id = JSON.parse(response.body)['id'].to_i
View image_url.rb
require 'amazon/ecs'
Amazon::Ecs.configure do |options|
options[:AWS_access_key_id] = AMAZON_ACCESS_KEY
options[:AWS_secret_key] = AMAZON_SECRET_KEY
options[:associate_tag] = AMAZON_ASSOCIATE_TAG
end
begin
response = Amazon::Ecs.item_lookup(asin, {country: 'jp', response_group: 'Images'})
@pooza
pooza / public_medias.sql
Last active Jul 30, 2018
公開トゥートに含まれる画像/動画を抜き出す。
View public_medias.sql
SELECT
attachments.id AS attachment_id,
toots.id AS toot_id,
attachments.file_content_type AS content_type,
attachments.file_file_name AS file_name,
attachments.file_file_size AS file_size,
attachments.file_meta AS meta,
attachments.updated_at
FROM media_attachments AS attachments
INNER JOIN statuses AS toots ON attachments.status_id=toots.id
View dovecot.conf
listen = *
login_access_sockets = tcpwrap
# auth
auth_verbose = yes
disable_plaintext_auth = no
auth_mechanisms = plain login
passdb {
driver = passwd
}
View encode_movie.rb
#!/usr/bin/env ruby
require 'shellwords'
DEST_DIR = '/usr/local/samba/movie'
OPTIONS = '-y -vf scale=720:-1'
unless ARGV.first
puts "usage: #{File.basename(__FILE__)} filename"
exit 1
@pooza
pooza / axios-post.js
Last active Mar 30, 2018
axiosからapplication/x-www-form-urlencodedなPOSTを行う。
View axios-post.js
const axios = require('axios');
const querystring = require('querystring')
/*
いろいろやる
*/
const createClientID = (id, secret) => {
const source = new Buffer([id, secret].join(':'));
return source.toString('base64');
@pooza
pooza / nowplaying.scpt
Last active Mar 24, 2018
Mac版SpotifyのNow Playing情報をクリップボードに貼るApple Script。
View nowplaying.scpt
set text item delimiters to ASCII character 10 --LF
tell application "Spotify"
set toot to {}
set end of toot to (name of current track) as string
set end of toot to (artist of current track) as string
set end of toot to "#nowplaying"
set the clipboard to toot as string
end tell
You can’t perform that action at this time.