Skip to content

Instantly share code, notes, and snippets.

View heri16's full-sized avatar

Heri Sim heri16

View GitHub Profile
@heri16
heri16 / Netwatch.rsc
Created April 10, 2017 07:43
Mikrotik RouterOS script for Ping-based Fast Failover with PPPoE uplinks.
/interface pppoe-client
set [find name="internet-speedy"] comment="PROVIDER1"
set [find name="internet-biznet"] comment="PROVIDER2"
/ip route
add comment="Force test pings through PROVIDER1" distance=1 dst-address=4.2.2.4/32 gateway=internet-speedy
add comment="Block test pings through other providers" distance=20 dst-address=4.2.2.4/32 type=blackhole
/tool netwatch
add comment=CheckCon down-script=":local \"p1\" [/interface pppoe-client find c\
@heri16
heri16 / AccurateXmlExportImport.ahk
Last active September 22, 2017 02:06
AutoHotKey Macro to Automate Export/Import of XML data into CPSsoft Accurate via CLI API.
#SingleInstance off
#Include .\LibCon.ahk-master\LibCon.ahk
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode, 3
; Enable Console-based Script
; LibConDebug := 1
FreeConsole()
SmartStartConsole()
@heri16
heri16 / win8_10_wannacry.ps1
Last active May 22, 2017 11:33
SMB Ransomware immunisation for Windows 8 and 10
# Source of Information: https://support.microsoft.com/en-in/help/2696547/how-to-enable-and-disable-smbv1,-smbv2,-and-smbv3-in-windows-vista,-windows-server-2008,-windows-7,-windows-server-2008-r2,-windows-8,-and-windows-server-2012
Set-NetFirewallProfile -Profile Public -Enabled True
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled False
Set-NetConnectionProfile -NetworkCategory Public
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
Set-SmbServerConfiguration -EnableSMB2Protocol $false -Force
# Source of Information: https://www.mcbsys.com/blog/2015/03/powershell-script-to-change-windows-update-settings/
$wus = (New-Object -ComObject "Microsoft.Update.AutoUpdate").Settings
$wus.NotificationLevel = 0x04
@heri16
heri16 / win7_wannacry.ps1
Last active May 22, 2017 11:33
SMB Ransomware immunisation for Windows 7 and Vista
# Source of Information: https://support.microsoft.com/en-in/help/2696547/how-to-enable-and-disable-smbv1,-smbv2,-and-smbv3-in-windows-vista,-windows-server-2008,-windows-7,-windows-server-2008-r2,-windows-8,-and-windows-server-2012
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB2 -Type DWORD -Value 0 -Force
# Source of Information: https://www.peppercrew.nl/index.php/2016/02/change-network-connection-category-using-powershell/
Set-NetFirewallProfile -Profile Public -Enabled True
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled False
$NLMType = [Type]::GetTypeFromCLSID('DCB00C01-570F-4A9B-8D69-199FDBA5723B')
$INetworkListManager = [Activator]::CreateInstance($NLMType)
@heri16
heri16 / install_choco.ps1
Last active May 3, 2021 02:41
Install Chocolatey Package Manager (and Enable WinRM)
# Install chocolatey.org & 7-zip
Set-ExecutionPolicy AllSigned -Force
$env:chocolateyDownloadUrl = 'https://chocolatey.org/api/v2/package/chocolatey/0.10.3'
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install 7zip virustotaluploader -y
# Enabling WinRM
Write-Host "***Enabling WinRM Feature...***"
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))
@heri16
heri16 / enable_win_guard.ps1
Last active October 29, 2020 00:40
Enable Windows Device Guard and Windows Credential Guard
# Enable Required Windows Features
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName:Microsoft-Hyper-V-Hypervisor -All
Disable-WindowsOptionalFeature -Online -NoRestart -FeatureName: Microsoft-Hyper-V-Tools-All, Microsoft-Hyper-V-Services
Get-WindowsOptionalFeature -Online -FeatureName "IsolatedUserMode" | Enable-WindowsOptionalFeature -Online -NoRestart
# Enable DeviceGuard Security Flags
#reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard" /v "EnableVirtualizationBasedSecurity" /t REG_DWORD /d 1 /f
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity" -PropertyType "DWORD" -Value 1 -Force
# Info Source: https://docs.microsoft.com/en-us/windows/device-security/device-guard/deploy-device-guard-enable-virtualization-based-security#use-registry-keys-to-enable-vbs-and-device-guard
@heri16
heri16 / disable_win_autorun.ps1
Last active May 22, 2017 11:06
Disable Autorun in Windows
# Disable Autoplay
Write-Host "***Disabling Autoplay...***"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1
# Disable Autorun for all drives
Write-Host "***Disabling Autorun for all drives...***"
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255
@heri16
heri16 / AccurateFormInputHelper.ahk
Last active June 13, 2021 14:11
AutoHotKey Helper Tool to Automate data entry into CPSSoft Accurate Forms. Usage: Clipboard -> Alt+v
#SingleInstance force
Hotkey, IfWinActive, ahk_class TfrmMain ahk_exe Accurate.exe
Hotkey, !v, HotkeyAutoInput
WinWait, ahk_class TfrmMain ahk_exe Accurate.exe
WinWaitClose, ahk_exe Accurate.exe
MsgBox "Accurate Exited."
ExitApp
return
@heri16
heri16 / ReneAdminHttpService.ahk
Last active June 5, 2018 03:51
AutoHotKey Server to Automate Export/Import of XML data into CPSSoft RENE Admin via HTTP API.
#Persistent
#NoEnv ; Avoids checking empty variables to see if they are environment variables
#KeyHistory 0 ; Disable key history
#SingleInstance force ; Skips the dialog box and replaces the old instance automatically
SetBatchLines, -1 ; Never sleep (i.e. have the script run at maximum speed)
SendMode, Input ; Use faster and more reliable send method
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
CoordMode, Mouse, Screen ; Make 0,0 the top-left of screen
SetTitleMatchMode, 3 ; Allow only exact window title matches
FileEncoding, UTF-8 ; Use UTF-8 file encoding
@heri16
heri16 / blockchain-impact.md
Created October 31, 2018 05:27
How will blockchain impact the world and affect us?

How will blockchain impact the world and affect us?

Blockchain is a way if keeping records in a collective fashion, and somehow many say that Blockchain will open up new possibilities, change the world, and affect us all.

Today, we use the internet without giving it a second thought. Explaining how blockchain would impact the world is similar to explaining how the internet would impact the world in its early days, say the early 90s, when few understood its importance.

As an example, the global economy depends on the exchange of goods and services, and the internet has indeed connected more people across cities and borders, and along the way reinvented the way we buy or sell things. Take the example of online-marketplaces or ride-sharing services (like Alibaba, eBay or Uber): Without the internet all these ways of conducting business would not be possible. In a world without the internet, we would have to go the the local traditional market or store if we wanted to get anything. The poor or unemployed