Skip to content

Instantly share code, notes, and snippets.

View heri16's full-sized avatar

Heri Sim heri16

View GitHub Profile
@heri16
heri16 / registry.ex
Created July 7, 2016 06:14
Simple module that wraps the :syn erlang library, in order to conform to Elixir's send "via-module-tuple" schematics.
defmodule Syn.Registry do
@moduledoc ~S"""
Simple module that wraps the :syn erlang library, in order to conform to Elixir's send "via-module-tuple" schematics.
This wrapper is temporary until :sync erlang library supports the use from Elixir directly.
"""
# "Via" API
@spec whereis_name(any) :: pid | :undefined
@heri16
heri16 / mail_expired_del.php
Created September 16, 2016 10:27
Delete expired email from IMAP server
<?php
$server_spec = "{****-****.accessdomain.com:993/imap/ssl}";
$mbox = imap_open($server_spec, $argv[1], $argv[2], OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
echo "=================== Connected ===================\n";
echo "Getting list of mailboxes...\n";
$list = imap_getmailboxes($mbox, $server_spec, "*");

Keybase proof

I hereby claim:

  • I am heri16 on github.
  • I am heri16 (https://keybase.io/heri16) on keybase.
  • I have a public key ASDS0zp8Qln9AGbd6zPDOSNq3AsFlZLy-QjULDBiQ4TSqQo

To claim this, I am signing this object:

@heri16
heri16 / IdeReformasiPilkada.md
Last active March 13, 2017 03:00
Ide Reformasi Birokrasi Dan Tata Kelola Pilkada. Mohon masukan dan komentar nya...

logo KPU

Latar Belakang

Saat melihat banyak masalah yang terjadi sekian rupa di Pilkada DKI 2017 (dari masalah formulir C6 atau kertas suara yang tidak sampai ke tangan pemilih yang ingin mengikuti pesta demokrasi), tentu kami sebagai warga Jakarta menjadi sangat prihatin. Banyak video tersebar online seperti ini di mana pakar nya menyatakan "Bagaimanapun memilih itu adalah hak politik ya, kalau bisa dimudahkan ya... contoh yang tadi menunjukan, Mungkin si petugas tidak salah, si warga juga tidak salah. Ini kan akibat mekanisme yang mungkin tidak menfasilitasi atau belum memfasilitasi esensi dari kemudahan itu sendiri." Saat nya mulai bertanya: Kenapa kita sebagai bangsa kesatuan ini bisa masuk dalam kondisi seperti sekarang? Apa ada cara yang lebih baik dan tertip?

Buat apa ada sesuatu bentuk atau konsep e-KTP jika *teknologi di

@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 / 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 / thing_shadow.ex
Last active July 17, 2017 03:52
Elixir ThingShadow Client for AWS IoT based on emqttc
defmodule Aws.Iot.ThingShadow do
@moduledoc ~S"""
Implements the AWS IoT ThingShadow Data Flow behaviour.
Closely follows the logic from the official nodejs library, with minor deviations to adapt to Elixir Coding Conventions:
https://github.com/aws/aws-iot-device-sdk-js/blob/master/thing/index.js
Elixir/Erlang's GenEvent executes handlers sequentially in a single loop of the GenEvent.manager process.
To avoid this bottleneck, please ensure that each ThingShadow process has a different `GenEvent.manager`.
@heri16
heri16 / RenePrintLabelHelper.ahk
Last active September 22, 2017 02:06
AutoHotKey Helper Tool to Automate printing labels of multiple items in RENE Admin. Usage: Clipboard -> Alt+v
#NoEnv
#UseHook off
#KeyHistory 0
#SingleInstance force
SetBatchLines, -1
SetTitleMatchMode, 3
GroupAdd, wGroup, ahk_class TfrmDialog ahk_exe reneadmin.exe
GroupAdd, wGroup, ahk_class TfrmItemSearch ahk_exe reneadmin.exe
@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()