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
$URL = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246808_424b9da4b48848379167015dcc250d8d" # 8u341 | |
#$URL = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246474_2dee051a5d0647d5be72a7c0abff270e" # 8u333 | |
#$URL = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245807_df5ad55fdd604472a86a45a217032c7d" # 8u321 | |
#$URL = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245479_4d5417147a92418ea8b615e228bb6935" # 8u311 | |
(New-Object System.Net.WebClient).DownloadFile($URL, "C:\jre8.exe") | |
cmd /C "C:\jre8.exe" /s | |
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jre1.8.0_341", "Machine") | |
Remove-Item "C:\jre8.exe" |
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
Param($Major='6.2', $Minor='2', $Manager='172.30.3.10') | |
$PackageZip = "hinemos-agent-${Major}.${Minor}-1.win.zip" | |
$DownloadUrl = "https://github.com/hinemos/hinemos/releases/download/v${Major}.${Minor}/${PackageZip}" | |
$PackageMsi = "C:\HinemosAgentInstaller-${Major}.${Minor}_win.msi" | |
$InstallPath = "C:\Program Files (x86)\Hinemos\Agent${Major}.${Minor}" | |
$ServiceName = "Hinemos_${Major}_Agent" | |
(New-Object System.Net.WebClient).DownloadFile(${DownloadUrl}, "C:\${PackageZip}") | |
Expand-Archive -Path "C:\${PackageZip}" -DestinationPath "C:\" |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import socket | |
import time | |
import datetime | |
import threading | |
import sys | |
from selectors import DefaultSelector, EVENT_WRITE, EVENT_READ | |
message = '%s ERROR %s:' % (datetime.datetime.now().time(), '-' * 100) |
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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.StringReader; | |
/** | |
* Javaソースのコメントを削除 | |
* 行コメントとブロックコメントがネストしているような場合はうまくいかない時があるので注意 | |
* 使用例: java CommentDelete < Test.java > Test.txt |
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
FILE_SIZE = 10485760 | |
LINE_TEXT = '1234567890' * 10 | |
write_size = 0 | |
while write_size < FILE_SIZE: | |
print(LINE_TEXT) | |
write_size += len(LINE_TEXT) + 1 |
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
import subprocess | |
for i in range(100000): | |
subprocess.check_call('touch dummyfile%08d.txt' % i, shell=True) |
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
-- psql -p 24001 -U hinemos -f create-trigger-sample.sql | |
CREATE OR REPLACE FUNCTION log_cc_cfg_facility_relation_delete() RETURNS TRIGGER AS $$ | |
BEGIN | |
RAISE LOG 'DELETE cc_cfg_facility_relation: % %', | |
OLD.parent_facility_id, OLD.child_facility_id; | |
RETURN NULL; | |
END | |
$$ LANGUAGE plpgsql; | |
CREATE TRIGGER trg_cc_cfg_facility_relation_delete |
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
[string]$FilePath = 'C:\work\dummy10m.txt' | |
[long]$FileSize = 10485760 | |
$ErrorActionPreference = 'Stop' | |
Add-type -AssemblyName System.Web | |
[long]$WriteSize = 0 | |
$file = New-Object System.IO.StreamWriter($FilePath, $false) | |
while($WriteSize -lt $FileSize){ | |
$String = "this is dummy row`r`n" |
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
// Command: java -Dsun.net.inetaddr.ttl=0 TestDnsQuotaByInetAddress 172.30.3.11 | |
// Metric: ethtool -S eth0 | grep linklocal_allowance_exceeded | |
public class TestDnsQuotaByInetAddress { | |
private static final int TRIALS = 10_000; | |
private static final int THREADS = 1_024; | |
private static final int LOG_THRESHOLD = 1_000; | |
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
final String host = args[0]; | |
final ExecutorService executor = Executors.newFixedThreadPool(THREADS); |
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
public class TestRaceConditionOfArrayList { | |
private static final int NUMBER_OF_TRIALS = 1_000_000; | |
private static final int NUMBER_OF_THREADS = 8; | |
private static final List<Integer> SOURCE_LIST = Arrays.asList(1, 2); | |
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
ExecutorService executor = Executors.newFixedThreadPool(NUMBER_OF_THREADS); | |
List<Future<String>> futures = new ArrayList<>(); | |
Testee testee = new Testee(); | |
for (int i = 0; i < NUMBER_OF_TRIALS; i++) { |