Skip to content

Instantly share code, notes, and snippets.

wifi.setmode(wifi.STATION)
wifi.sta.config("network","password") -- Replace these two args with your own network
ip, nm, gw=wifi.sta.getip()
print("\nIP Info:\nIP Address: "..ip.." \nNetmask: "..nm.." \n")
led1 = 3
led2 = 4
gpio.mode(led1, gpio.OUTPUT)
gpio.mode(led2, gpio.OUTPUT)
srv=net.createServer(net.TCP)
@mprz
mprz / seek.py
Created November 16, 2015 23:04
from __future__ import print_function
import os, sys, msvcrt, webbrowser
# first arg = location, i.e. c:\myfiles
# second arg = file mask, i.e. *.py
# third arg and so on = strings to find
args = sys.argv
if len(args) < 4:
print("Usage:")
import sys
import ctypes
import ctypes.wintypes
#####################################################
#script to query windows 8.x OEM key from PC firmware
#ACPI -> table MSDM -> raw content -> byte offset 56 to end
#ck, 03-Jan-2014 (christian@korneck.de)
#####################################################
' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.
Set WshShell = WScript.CreateObject("WScript.Shell")
KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))
print ("List of PCI devices found in the system:")
print ("\nBUS DEV FUN VENID DEVID SDEVID SVENID Desc")
from os import path, access, R_OK # W_OK for write permission.
path_to_reg_exe_X = os.path.join('x:', os.sep, 'Windows', 'System32', 'reg.exe')
path_to_reg_exe_C = os.path.join('c:', os.sep, 'Windows', 'System32', 'reg.exe')
path_to_reg_exe_D = os.path.join('d:', os.sep, 'Windows', 'System32', 'reg.exe')
if path.exists(path_to_reg_exe_X) and path.isfile(path_to_reg_exe_X) and access(path_to_reg_exe_X, R_OK):
@mprz
mprz / gist:6336658
Created August 25, 2013 22:21
Singleton Pattern for PDO MySQL
<?php
class DB{
//variable to hold connection object.
protected static $db;
//private construct - class cannot be instatiated externally.
private function __construct() {
try {
// assign PDO object to db variable
self::$db = new PDO( 'mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS );
self::$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );