This file contains hidden or 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 hidden or 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 hidden or 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++) { |
This file contains hidden or 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
Install-WindowsFeature SNMP-Service -IncludeAllSubFeature -IncludeManagementTools | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities" -Name "public" -Value 4 -type DWord | |
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers" | |
#Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers" -Name "1" -Value "localhost" -type String | |
#Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers" -Name "2" -Value "172.30.3.10" -type String | |
Restart-Service -Name SNMP | |
New-NetFirewallRule -DisplayName "SNMP Service" -Direction Inbound -Protocol UDP -LocalPort 161 -Action Allow |
This file contains hidden or 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 hidden or 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 re | |
with open('/content/drive/MyDrive/input.tsv') as file: | |
for line in file: | |
res = re.match('^([^\t]+)\t([^\t]+)\t.{3}([^\t]+)\t([^\t]+)$', line) | |
print('%s\t%s\t%s' % (res.group(2), res.group(4), bytes.fromhex(res.group(3)))) |
This file contains hidden or 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
set /P TEMPLATE_ID=Template ID: | |
aws ec2 run-instances ^ | |
--launch-template LaunchTemplateId=%TEMPLATE_ID% ^ | |
> ec2-run-instance.log | |
REM change instance type: --instance-type t3.nano ^ | |
aws ec2 describe-instances ^ | |
--filters ^ | |
"Name=tag:aws:ec2launchtemplate:id,Values=%TEMPLATE_ID%" ^ |
This file contains hidden or 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
#cloud-config | |
timezone: Asia/Tokyo | |
runcmd: | |
- cd /home/centos | |
- curl -L -o init-os.sh https://gist.github.com/froop/224549dad2a39c584b571ee16ca66142/raw/init-centos7-ec2.sh | |
- chmod +x init-os.sh | |
- ./init-os.sh | |
- rm init-os.sh |
This file contains hidden or 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 -eu | |
# locale | |
localectl set-locale LANG=ja_JP.UTF-8 | |
# timezone | |
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
rm -f /etc/localtime | |
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
This file contains hidden or 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 httplib | |
con = httplib.HTTPConnection('172.31.1.12', 80) | |
con.request('GET', '/') | |
res = con.getresponse() | |
print(res.status) |