Skip to content

Instantly share code, notes, and snippets.

@nikola
nikola / drives.py
Created Nov 4, 2014
Enumerate drives
View drives.py
# coding: utf-8
import re
from itertools import izip_longest
import win32com.client
from win32file import GetDriveType
from win32api import GetLogicalDriveStrings, GetVolumeInformation
@nikola
nikola / genchromeappid.py
Created Nov 11, 2014
Generate Chrome Application ID
View genchromeappid.py
import hashlib
def getChromeApplicationId(pathname):
if len(pathname) > 1 and pathname[0].islower() and pathname[1] == ":":
pathname = pathname[0].upper() + pathname[1:]
pathname = pathname.encode("utf-16le")
offset = ord("a")
applicationId = "".join([chr(int(digit, 16) + offset) for digit in hashlib.sha256(pathname).hexdigest()[:32]])
@nikola
nikola / getpywin32color.py
Created Nov 11, 2014
Get Win32 Color Brush
View getpywin32color.py
import ctypes
def getColorBrush(red=0, green=0, blue=0):
class _COLORREF(ctypes.Structure):
_fields_ = [
('byRed', ctypes.c_byte),
('byGreen', ctypes.c_byte),
('byBlue', ctypes.c_byte),
]
return ctypes.windll.gdi32.CreateSolidBrush(_COLORREF(red, green, blue))
@nikola
nikola / enum.js
Created Nov 19, 2014
Create enumeration
View enum.js
Array.apply(null, Array(1000)).map(Function.prototype.call.bind(Number))