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
#!/usr/bin/env python3 | |
""" | |
baa + ba = abb | |
https://twitter.com/koujounodenki/status/1397188516044541955 | |
""" | |
for b in range(1, 10): | |
for a in range(0, 10): | |
x = b * 100 + a * 10 + a | |
y = b * 10 + a |
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
#!/usr/bin/bash -e | |
# for RHEL7 | |
sudo -i sh -c "\ | |
yum update --downloadonly -y\ | |
" | |
echo "Continue? (Enter or Ctrl+C)" ; read Wait | |
sudo -i sh -c "\ | |
yum update -y ;\ |
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 -e | |
sudo -i sh -c "\ | |
apt-get update ;\ | |
apt-get -uyd dist-upgrade\ | |
" | |
echo "Continue? (Enter or Ctrl+C)" ; read Wait | |
sudo -i sh -c "\ | |
apt-get -uy dist-upgrade ;\ |
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
@echo off | |
cd /d "%~dp0" | |
for /f "tokens=3 delims=\ " %%i in ('whoami /groups^|find "Mandatory"') do set LEVEL=%%i | |
if NOT "%LEVEL%"=="High" ( | |
powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -Command "Start-Process \"%~f0\" -Verb runas" | |
exit | |
) | |
rem これ以降に、実行したい処理を記述します |
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
# andibleのexpectモジュールの練習 | |
# r7のfoobarユーザのパスワードをpasswdコマンドで変えてみる | |
# - 事前にfoobarユーザは作ってあるものとする(useradd foobar) | |
# - テストが終わったらfoobarユーザは消すこと(userdel foobar) | |
# | |
# # passwd foobar | |
# Changing password for user foobar. | |
# New password: | |
# Retype new password: | |
# passwd: all authentication tokens updated successfully. |
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
- name: install pexpect to root locally on RHEL7 | |
hosts: linux | |
become: true | |
gather_facts: false | |
tasks: | |
- name: install pip2 package for python2 | |
yum: | |
name: python2-pip # pip2.7 version 8.1.2 | |
state: latest |
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
- name: do anything at first and at last | |
hosts: hosts1 | |
become: false | |
gather_facts: false | |
tasks: | |
- name: at 1st | |
debug: | |
msg: "run only on {{ inventory_hostname }} at first" | |
changed_when: true # notifyはchangedでないと発生しないので |
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
--- | |
- name: fetch /etc/*.conf | |
hosts: linux | |
become: false | |
gather_facts: false | |
vars: | |
outpath: "{{ playbook_dir }}/var/etc_conf/{{ inventory_hostname }}" | |
tasks: | |
- name: get list |
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
<%@ | |
page import="java.time.*" | |
contentType="text/html; charset=utf8" | |
%><!DOCTYPE html> | |
<html> | |
<head lang="en"> | |
<meta charset="utf-8"> | |
</head> | |
<title>Hello, Tomcat</title> | |
</head> |
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 | |
# see [Amazon Route 53: How to automatically update IP addresses without using Elastic IPs - DEV](https://dev.to/aws/amazon-route-53-how-to-automatically-update-ip-addresses-without-using-elastic-ips-h7o) | |
AWS=/usr/local/bin/aws | |
# Extract information about the Instance | |
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id/) | |
AZ=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/) | |
MY_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4/) | |
# Extract tags associated with instance |