This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERVICE_NAME=mongodb | |
if [ ! $1 ]; then | |
echo " Example of use: $0 database_name [dir_to_store]" | |
exit 1 | |
fi | |
db=$1 | |
out_dir=$2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# 参考: http://ktkrhr.hatenablog.com/entry/2013/03/27/002447 | |
import urllib | |
import urllib2 | |
import base64 | |
import json | |
oauth_consumer_key = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# プロキシを通すためメソッドを上書き | |
# 元のメソッドは https://github.com/Fullscreen/yt/blob/v0.32.1/lib/yt/request.rb#L170 | |
module Yt | |
class Request | |
private | |
def send_http_request | |
net_http_options = [uri.host, uri.port, :ENV, use_ssl: true] | |
ActiveSupport::Notifications.instrument 'request.yt' do |payload| | |
payload[:method] = @method | |
payload[:request_uri] = uri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encode(str) | |
str | |
.gsub(" ", "%20") | |
.gsub("\n", "%0d%0a") | |
end | |
cmd = "curl gopher://example.com:80/_" + encode(<<-EOD) | |
GET / HTTP/1.1 | |
Host: example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/https" | |
class Http | |
def self.get(url, header, params = {}) | |
uri = URI(url) | |
uri.query = URI.encode_www_form(params) | |
http = Net::HTTP.new(uri.hostname, uri.port) | |
# https.proxy_from_env = true | |
if uri.port == 443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'optparse' | |
require 'socket' | |
require 'openssl' | |
require 'http/2' | |
require 'uri' | |
DRAFT = 'h2'.freeze | |
class Logger | |
def initialize(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM weseek/crowi-plus:1.2.2 | |
ENV APP_DIR /opt/crowi-plus | |
# install dockerize | |
ENV DOCKERIZE_VERSION v0.3.0 | |
RUN apk add --no-cache --virtual .dl-deps curl \ | |
&& curl -SL https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | |
| tar -xz -C /usr/local/bin \ | |
&& apk del .dl-deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# バックアップスクリプト | |
# コンテナの外で実行します。docker-composeでmongoコンテナを起動中なのが前提 | |
set -o errexit | |
SRC_CONTAINER=$1 | |
SRC_VOLUME_DIR=$2 | |
OUTPUT_DIR=$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reposes = Dir.glob("git_repos/*") | |
reposes.each do |repos_path| | |
puts repos_path | |
repos = File.basename(repos_path, ".*") | |
system("curl --user nicklegr:PASSWORD https://api.bitbucket.org/1.0/repositories/ --data is_private='true' --data name=#{repos}") | |
Dir.chdir(repos_path) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
# カレントにauthors.txtを作る | |
# svnadminのヘルプを参照 | |
have_trunk = %w| | |
(trunkがあるリポジトリを列挙) | |
| | |
# 1. trunkがない |
NewerOlder