Skip to content

Instantly share code, notes, and snippets.

Avatar

Tatsuya Koishi pooza

View GitHub Profile
View response.txt
HTTP/2 302
date: Tue, 06 Nov 2018 02:10:59 GMT
content-type: text/html; charset=utf-8
set-cookie: __cfduid=d262f6c61039be21a295d52376c4d7e0b1541470259; expires=Wed, 06-Nov-19 02:10:59 GMT; path=/; domain=.precure.ml; HttpOnly
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
location: https://precure.ml/@pooza/101021588761903393
vary: Accept-Encoding
cache-control: no-cache
View god
#!/bin/sh
# PROVIDE: god
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable the puppet agent:
#
# god_enable="YES"
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
You can’t perform that action at this time.