Skip to content

Instantly share code, notes, and snippets.

View cchitsiang's full-sized avatar
💭
continuous coding and debugging

Chew Chit Siang cchitsiang

💭
continuous coding and debugging
  • Kuala Lumpur, Malaysia
View GitHub Profile
@cchitsiang
cchitsiang / slmgr.bat
Created October 18, 2013 00:30
Reset Windows Activation to pre-key state
Open a command prompt as an Administrator.
Enter slmgr /upk and wait for this to complete. This will uninstall the current product key from Windows and put it into an unlicensed state.
Enter slmgr /cpky and wait for this to complete. This will remove the product key from the registry if it's still there.
Enter slmgr /rearm and wait for this to complete. This is to reset the Windows activation timers so the new users will be prompted to activate Windows when they put in the key
slmgr /ipk 7BNJT-PXJR8-J9G6D-DHJVQ-DV3KQ
slmgr /ato
@cchitsiang
cchitsiang / print.js
Created November 7, 2013 05:01
JavaScript Print: Bypass Printer Dialog in IE and Firefox
var OLECMDID = 6;
/* OLECMDID values: * 6 - print * 7 - print preview * 1 - open window * 4 - Save As */
if (navigator.appName == "Microsoft Internet Explorer")
{
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
if(PrintCommandObject)
{
try
{
@cchitsiang
cchitsiang / CopyLinkedContentFiles
Created November 1, 2013 10:38
Copying linked content files at each build using MSBuild
<!--http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx-->
<Target Name="CopyLinkedContentFiles" BeforeTargets="Build">
<Copy SourceFiles="%(Content.Identity)"
DestinationFiles="%(Content.Link)"
SkipUnchangedFiles='true'
OverwriteReadOnlyFiles='true'
Condition="'%(Content.Link)' != ''" />
</Target>
@cchitsiang
cchitsiang / star.py
Created December 13, 2018 02:55 — forked from arkokoley/star.py
Auto star repo in github
'''
Author: Gaurav Koley (arkokoley@live.in)
'''
import requests
import sys
from requests.auth import HTTPBasicAuth
username = raw_input("username: ")
password = raw_input("password: ")
@cchitsiang
cchitsiang / countries.sql
Created November 7, 2017 04:11 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@cchitsiang
cchitsiang / mongodb-s3-backup.sh
Created June 10, 2017 09:38 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh

WannaCry|WannaDecrypt0r NSA-Cyberweapon-Powered Ransomware Worm

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: All Windows versions before Windows 10 are vulnerable if not patched for MS-17-010. It uses EternalBlue MS17-010 to propagate.
  • Ransom: between $300 to $600. There is code to 'rm' (delete) files in the virus. Seems to reset if the virus crashes.
  • Backdooring: The worm loops through every RDP session on a system to run the ransomware as that user. It also installs the DOUBLEPULSAR backdoor. It corrupts shadow volumes to make recovery harder. (source: malwarebytes)
  • Kill switch: If the website www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com is up the virus exits instead of infecting the host. (source: malwarebytes). This domain has been sinkholed, stopping the spread of the worm. Will not work if proxied (source).

update: A minor variant of the viru

@cchitsiang
cchitsiang / convertEvalToFull.bat
Created October 18, 2013 01:16
Convert Windows Server Eval to Full
DISM /online /Get-TargetEditions
DISM /online /Set-Edition:ServerStandard /ProductKey:XC9B7-NBPP2-83J2H-RHMBY-92BT4 /AcceptEula

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

@cchitsiang
cchitsiang / httphandler-template.cs
Created April 17, 2016 09:46
HttpHandler sample code
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "html";
context.Response.Write("Hello World");
manaeform(context);
}
public void manaeform(HttpContext context)