Skip to content

Instantly share code, notes, and snippets.

View giseongeom's full-sized avatar
💭
I may be slow to respond.

GiSeong Eom giseongeom

💭
I may be slow to respond.
View GitHub Profile
@giseongeom
giseongeom / mysql-contributor.json
Created January 17, 2020 06:41
(custom) Azure Database for MySQL contributor role
{
"Name": "mysqlContributor",
"IsCustom": true,
"Description": "Can operate Azure Database for MySQL.",
"Actions": [
"*/read",
"Microsoft.Network/virtualNetworks/*",
"Microsoft.Resources/subscriptions/*/read",
"Microsoft.DBforMySQL/*/read",
"Microsoft.DBforMySQL/register/*",
@giseongeom
giseongeom / ec2-export-csv.ps1
Last active December 13, 2019 07:58
Export EC2 status to .CSV across AWS region(s)
# prepare credential
Set-AWSCredential -ProfileName ****
$env:AWS_PROFILE='****'
$ts_begin = get-date
Function Get-EC2PeakCPU ($region, $instanceId) {
# Last 7 Days (1w)
$cw_data = Get-CWMetricStatistic -Region $region -MetricName CPUUtilization `
@giseongeom
giseongeom / Invoke-UpgradeGeoIpDatabase.ps1
Last active July 17, 2019 02:02
Update Maxmind GeoIPLite2 DB
Function Invoke-UpgradeGeoIpDatabase {
$local_path = 'c:\tools\maxmind\geoip2'
$tgz_format_list = @"
https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz
https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz
"@ -split "`n" -notmatch '^#.*' | ForEach-Object { $_.trim() }
$zip_format_list = @"
@giseongeom
giseongeom / New-PSCredential.ps1
Created July 9, 2019 09:47
Create PSCredential object using cleartext
function New-PSCredential([string]$User, [string]$Pass) {
$username = $User
$password = ConvertTo-SecureString $Pass -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)
return $psCred
}
@giseongeom
giseongeom / aks-scale-admin.json
Created May 29, 2019 10:42
AKS Scaling Administrator custom role
{
"Name": "AKS Scale Operator",
"IsCustom": true,
"Description": "Can monitor and scale AKS-enabled virtual machines.",
"Actions": [
"Microsoft.Resources/subscriptions/resourceGroups/write",
"Microsoft.Resources/subscriptions/resourceGroups/delete",
"Microsoft.Storage/checkNameAvailability/*",
"Microsoft.Storage/storageAccounts/*",
"Microsoft.ContainerService/*"
@giseongeom
giseongeom / Update-KakaoTalk.ps1
Created January 2, 2019 11:03
KakaoTalk Updater (Portable)
$kakao_talk_local_path = 'c:\tools\Kakao\KakaoTalk'
if (get-process -Name KakaoTalk -ErrorAction SilentlyContinue) {
get-process -Name KakaoTalk | Stop-Process -ErrorAction SilentlyContinue -Force
}
# Download latest version of kakao_talk
$kakao_talk_installer_url = 'http://app.pc.kakao.com/talk/win32/KakaoTalk_Setup.exe'
$kakao_talk_installer_path = $env:TEMP + '\' + (Get-Random) + '-' + "KakaoTalk_Setup.exe"
(New-Object Net.WebClient).DownloadFile($kakao_talk_installer_url, $kakao_talk_installer_path)
@giseongeom
giseongeom / Install-VS2017-Unattended.ps1
Last active July 26, 2018 10:30
Unattended-install Visual Studio 2017 community edition on Windows 10/Server 2016
# Visual Studio 2017 Enterprise
# https://aka.ms/vs/15/release/vs_enterprise.exe
# Visual Studio 2017 Professional
# https://aka.ms/vs/15/release/vs_professional.exe
# Visual Studio 2017 Community
# https://aka.ms/vs/15/release/vs_community.exe
# Visual Studio 2017 Community
@giseongeom
giseongeom / Enable-TLS12support.ps1
Last active June 5, 2018 15:11
Enable TLS 1.2 support on Powershell 5.1
# Enable tls1.2 from default (Ssl3, Tls)
# https://powershell.org/forums/topic/is-it-possible-to-enable-tls-1-2-as-default-in-powershell/
# https://www.codyhosterman.com/2016/06/force-the-invoke-restmethod-powershell-cmdlet-to-use-tls-1-2/
# https://developercommunity.visualstudio.com/content/problem/201457/unable-to-connect-to-github-due-to-tls-12-only-cha.html
# https://githubengineering.com/crypto-removal-notice/
[Net.ServicePointManager]::SecurityProtocol = `
[Net.SecurityProtocolType]::Ssl3 -bor `
[Net.SecurityProtocolType]::Tls -bor `
[Net.SecurityProtocolType]::Tls11 -bor `
@giseongeom
giseongeom / Enable-WinRmHTTPSListener.ps1
Last active June 1, 2018 09:59
Enable WinRM HTTPS Listener on Windows Server 2016
#Requires -version 5
#Requires -RunAsAdministrator
# Add firewall rule
New-NetFirewallRule -DisplayName WINRM-HTTPS-In-TCP `
-Name WINRM-HTTPS-In-TCP -Enabled True -Protocol TCP `
-Profile Any -Direction Inbound -RemoteAddress Any `
-LocalPort 5986
@giseongeom
giseongeom / logrotate-example
Created May 25, 2018 23:50
logrotate.d example
/var/www/web/log/*.log {
daily
dateext
dateyesterday
missingok
rotate 60
compress
delaycompress
notifempty
copytruncate