Skip to content

Instantly share code, notes, and snippets.

View dany1468's full-sized avatar

Yoichi Dan dany1468

View GitHub Profile
import sys
import os
import datetime
import pyauto
from keyhac import *
def configure(keymap):
@dany1468
dany1468 / config.yml
Created July 4, 2018 13:41
Wiki.js を docker-compose で動かす ref: https://qiita.com/dany1468/items/74b06705e337a204796d
host: http://localhost
port: 3000
db: mongodb://wikidb:27017/wiki
sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz
public: false
auth:
defaultReadAccess: false
local:
@dany1468
dany1468 / App.config
Created May 31, 2018 08:22
Release Build 時に log4net のログ出力が行われない場合がある ref: https://qiita.com/dany1468/items/7ac230e6705aadd29211
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="ConsoleAppendar" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %message%newline" />
</layout>
</appender>
@dany1468
dany1468 / App.config
Last active May 24, 2018 01:10
AWS SDK for .NET で S3 の動作確認をローカルの fake サービスに向けて行う ref: https://qiita.com/dany1468/items/d895192b9f8e6450621d
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/>
</configSections>
<aws region="us-east-1" endpointDefinition="endpoints.json">
</aws>
<appSettings>
<add key="AWSAccessKey" value="foo"/>
<add key="AWSSecretKey" value="foo"/>
@dany1468
dany1468 / HogeTest.csproj
Created January 31, 2018 08:09
ASP.NET Core MVC 2.0 時点での xUnit と Microsoft.AspNetCore.TestHost を利用した Integration Test で気をつける点 ref: https://qiita.com/dany1468/items/ceffb14738342d296839
<Target Name="CopyAditionalFiles" AfterTargets="Build" Condition="'$(TargetFramework)'!=''">
<ItemGroup>
<DepsFilePaths Include="$([System.IO.Path]::ChangeExtension('%(_ResolvedProjectReferencePaths.FullPath)', '.deps.json'))" />
</ItemGroup>
<Copy SourceFiles="%(DepsFilePaths.FullPath)" DestinationFolder="$(OutputPath)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
</Target>
@dany1468
dany1468 / README.md
Last active November 16, 2017 14:15

Goodread Sample

i = 1
i + 2 # 3
i + 3 # 5
@dany1468
dany1468 / READMEの例
Created August 19, 2017 23:12
Rails でのバックグラウンドジョブの実行と transaction 利用について ref: http://qiita.com/dany1468/items/f9278b43d4ecb63c2920
ActiveRecord::Base.transaction do
ActiveRecord::Base.after_transaction_commit { run_some_background_job }
# run_some_background_job has not run yet
end
# now, it has run
# this one runs immediately, since we are outside a transaction
ActiveRecord::Base.after_transaction_commit { some_other_task }
@dany1468
dany1468 / check_collection.rb
Last active July 5, 2017 03:17
Rails で利用できる Health Check API 系の Gem である okcomputer について ref: http://qiita.com/dany1468/items/3b2f9c38d859d0fcd9b2
module OkComputer
class CheckCollection
def initialize(display)
self.display = display
self.collection = {}
end
# Public: Returns a check or collection if it's in the check collection
#
# key - a check or collection name
@dany1468
dany1468 / file0.txt
Created June 14, 2017 05:00
Sidekiq で最大回数リトライ後に失敗した場合出すログに例外のバックトレースを含める ref: http://qiita.com/dany1468/items/f3fcbfbee615074ced45
def perform(card_charge_id)
charge = CardCharge.find(card_charge_id)
charge.void_transaction
Emailer.charge_refunded(charge).deliver
end
@dany1468
dany1468 / engine.rb
Created May 24, 2017 09:28
Sidekiq 5 で変わった ActiveRecord のコネクション管理の方法と ActiveSupport::Executor/Reloader について ref: http://qiita.com/dany1468/items/dc133630b37d60ea6aa5
module ActionCable
class Engine < Rails::Engine
initializer "action_cable.set_work_hooks" do |app|
ActiveSupport.on_load(:action_cable) do
ActionCable::Server::Worker.set_callback :work, :around, prepend: true do |_, inner|
app.executor.wrap do
# If we took a while to get the lock, we may have been halted
# in the meantime. As we haven't started doing any real work
# yet, we should pretend that we never made it off the queue.
unless stopping?