Skip to content

Instantly share code, notes, and snippets.

@OdaShinsuke
OdaShinsuke / test.sql
Created May 21, 2020
T-SQL スキーマ(Schema)無しでの呼出しでどのスキーマのものが使われるのか
View test.sql
use [master]
create database [SchemaTest] containment=partial
go
use [SchemaTest]
go
-- スキーマ
create schema [S1]
go
create schema [S2]
@OdaShinsuke
OdaShinsuke / netcore_Program.cs
Last active Oct 12, 2019
.NET Core SqlConnection ConnectRetryCount not work?
View netcore_Program.cs
using System;
using System.Data.SqlClient;
using System.Diagnostics;
namespace NETCore
{
class Program
{
static string connstr = @"Data Source=localhost;Initial Catalog=master;Integrated Security=True;Connect Timeout=5;Encrypt=False;";
View Hello.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<Param>Default</Param>
</PropertyGroup>
<Target Name="Hello">
<Message Text="Hello $(Param) さん" />
</Target>
</Project>
@OdaShinsuke
OdaShinsuke / jenkins_job_update_jdk.groovy
Created Apr 17, 2015
Jenkins のスクリプトコンソールで、Job の JDK を一括変換
View jenkins_job_update_jdk.groovy
jobs = jenkins.model.Jenkins.instance.items
oldJDK = jenkins.model.Jenkins.instance.getJDK("JavaSE 8u40")
newJDK = jenkins.model.Jenkins.instance.getJDK("JavaSE 8u45")
jobs.each {
if (it.JDK == oldJDK) {
it.JDK = newJDK
it.save()
println "updated ${it.name}"
}
@OdaShinsuke
OdaShinsuke / DefatultParameterWithBeamParamExtensions.java
Last active Aug 29, 2015
Swagger JAX-RS BeanParam 用 Extensions
View DefatultParameterWithBeamParamExtensions.java
package com.wordnik.swagger.jaxrs;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@OdaShinsuke
OdaShinsuke / AutoCompleteBean.java
Created Mar 17, 2015
Primefaces AutoComplete 日本語入力
View AutoCompleteBean.java
package sample;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
@SuppressWarnings("serial")
@OdaShinsuke
OdaShinsuke / PreCondition.xtend
Last active Dec 19, 2015
Xtend ActiveAnnotation メソッドの事前条件埋めてみた
View PreCondition.xtend
package contracts
import java.lang.annotation.ElementType
import java.lang.annotation.Target
import org.eclipse.xtend.lib.macro.AbstractMethodProcessor
import org.eclipse.xtend.lib.macro.Active
import org.eclipse.xtend.lib.macro.TransformationContext
import org.eclipse.xtend.lib.macro.declaration.MutableMethodDeclaration
import org.eclipse.xtend.lib.macro.declaration.Visibility
@OdaShinsuke
OdaShinsuke / OutputStyleCopReport.proj
Created Nov 27, 2012
MSBuild StyleCop Output XML => Jenkins Violation Plugin
View OutputStyleCopReport.proj
<UsingTask TaskName="ReplaceStyleCopResult" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<PATH ParameterType="System.String" Required="true" />
<WORKSPACE ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs"><![CDATA[
var content = File.ReadAllText(PATH);
File.WriteAllText(PATH, content.Replace(WORKSPACE, "../"));
]]></Code>
View 自動販売機.cs
using System;
using System.Linq;
namespace TDDPre {
public class 自動販売機 {
private static int[] 正規のお金 = new int[] { 10, 50, 100, 500, 1000 };
public int 投入金額 { get; private set; }
/// <summary>
/// Command
/// </summary>
@OdaShinsuke
OdaShinsuke / Working.ps1
Created Apr 12, 2012
作業してる感
View Working.ps1
Write-Host "Backup!"
Write-Host "0% * * * * * * * * * * 100%"
while ($true) {
Get-ChildItem | % {
$path = $_.FullName
Write-Host "Backup File:$path starting ... "
for ($count = 1; $count -le 20; ++$count) {
$ran = Get-Random
sleep -m ($count * ($ran % 30))