Skip to content

Instantly share code, notes, and snippets.

View drewchapin's full-sized avatar

Drew Chapin drewchapin

View GitHub Profile
REM Change to DHCP setting
NETSH int ip set address name = "Local Area Connection" source = dhcp
REM Renew IP address
IPCONFIG /renew
REM Set proxy settings
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /V ProxyEnable /T REG_DWORD /D 0 /F
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v DefaultConnectionSettings /t REG_BINARY /d 46000000a1010000090000001200000031302e35392e3132352e3232353a383038301d00000031302e35382e32312e2a3b31302e35382e33392e2a3b3c6c6f63616c3e000000000100000000000000f0c1fb7723ccca0100000000000000000000000002000000020000000a3a273c000000000000000001008020010000000000000050b226000e0100000000000014001f6880531c87a0426910a2ea08002b30309df80061800000000068007400740070003a002f002f007700770077002e0067006f006f0067006c0065002e0063006f006d002f0000000000c00000001400efbe13ce2fdf17000000000000000000000000000000000000000000000100000000000000000000000000000000050000000b0000002e00000068007400740070003a002f002f007700770077002e0067006f00
@ECHO OFF
REM Get IP Address from user
SET IPADDR=
SET /P IPADDR=Enter IP Address (Default 10.58.39.242):
IF /I '%IPADDR%'=='' SET IPADDR="10.58.39.242"
ECHO Applying IP Address, Subnet Mask, and Default Gateway...
NETSH interface ip set address "Local Area Connection" static %IPADDR% 255.255.255.0 10.58.21.254 > nul
@drewchapin
drewchapin / dcFTP.cls
Created July 26, 2016 17:47
VB6 Class Module for FTP access.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' dcftp - Visual BASIC FTP class module based on WinInet API
''
'' Author: Drew Chapin
'' Date: 2012-10-29
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' WinInet API - Constants
@drewchapin
drewchapin / GetScreenRes.cpp
Created July 26, 2016 17:56
Gets the screen resolution and dock status of the system.
/**
* @File GetScreenRes.cpp
* @Author Drew Chapin <druciferre@gmail.com>
* @Date 2014-09-17
*
* Gets the screen resolution and dock status of the system.
*/
#include <iostream>
#include <Windows.h>
#include <WinUser.h>
@drewchapin
drewchapin / ADSI_passwd_expir.cpp
Created July 26, 2016 18:03
Lists all members of a group and how many days are left until their password expires.
/**
* @Author Drew Chapin <druciferre@gmail.com>
* @Date 2013-05-03
*
* Lists all members of a group and how many days are left until their password expires.
*/
#pragma comment(lib, "ActiveDS.lib")
#pragma comment(lib, "Oleaut32.lib")
#pragma comment(lib, "ADSIid.lib")
#include <Windows.h>
@drewchapin
drewchapin / FixPivotTableSources.bas
Created September 28, 2016 13:19
Replace pivot table source paths with current path.
Attribute VB_Name = "Module1"
Public Sub Update_Pivot_Tables()
On Error GoTo Exception
Dim sheet As Worksheet, table As PivotTable
For Each sheet In ThisWorkbook.Sheets
For Each table In sheet.PivotTables
Dim newSource As String, sourceType As XlPivotTableSourceType, version As Variant, i As Long
i = InStr(1, StrReverse(table.SourceData), "\", vbTextCompare)
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
namespace ActiveDirectoryExTest
{
@drewchapin
drewchapin / HTML Application.hta
Last active June 9, 2022 02:23
Template for an HTML Application file (.hta), add to C:\Windows\ShellNew, and add ShellNew\Filename="HTML Application.hta" to .hta HKCR key.
<html>
<head>
<!--
@tag hta:application
@attribute ApplicationName Sets the name of the HTA.
@attribute Border [Thick]|Thin|None
@attribute BorderStyle [Normal]|Raised|Sunken|Complex|Static
@attribute Caption [Yes]|No
#pragma comment(lib,"advapi32.lib")
#include <Windows.h>
#include <WinSvc.h>
#include <AccCtrl.h>
#include <AclAPI.h>
#include <stdio.h>
int main( int argc, char* argv[] )
{
#include <Windows.h>
#include <ShObjIdl.h>
#include <iostream>
int main(int argc, char* argv[])
{
HRESULT hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if( SUCCEEDED(hResult) )