Skip to content

Instantly share code, notes, and snippets.

View drewchapin's full-sized avatar

Drew Chapin drewchapin

View GitHub Profile
@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>
#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) )
@drewchapin
drewchapin / ShiftTextBoxHistory.cs
Last active July 12, 2017 21:55
Shift TextBox Values
private void ShiftTextBoxHistory( DataRow next )
{
TextBox[][] c = new TextBox[][]
{
new TextBox[]{lastLotNumber1TextBox, lastPartNumber1TextBox, lastBatchNumber1TextBox},
new TextBox[]{lastLotNumber2TextBox, lastPartNumber2TextBox, lastBatchNumber2TextBox},
new TextBox[]{lastLotNumber3TextBox, lastPartNumber3TextBox, lastBatchNumber3TextBox},
new TextBox[]{lastLotNumber4TextBox, lastPartNumber4TextBox, lastBatchNumber4TextBox},
new TextBox[]{lastLotNumber5TextBox, lastPartNumber5TextBox, lastBatchNumber5TextBox},
};
// Add this to pre-build event
// "%CommonProgramFiles(x86)%\microsoft shared\TextTemplating\$(VisualStudioVersion)\TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt"
//
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text.RegularExpressions" #>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#!/bin/bash
on_exit() {
echo "#Exited unexpectidly"
zenity --display=:0 --error --text="Program has exited unexpectidly!"
}
exec &> >(zenity --display=:0 --progress --title 'Redirection example' --text 'Running...' --auto-close)
trap "on_exit" EXIT
@drewchapin
drewchapin / listusers.sh
Created February 18, 2018 03:56
List users of a the specified group(s).
#!/bin/bash
for group in $@; do
echo "$group:"
users=$(awk -F: "/^$group/{print \$4}" /etc/group | tr , \\n | sort)
if [ "$users" != "" ]; then
for user in $users; do
echo " $user"
done
else
echo " <no users in this group>"
@drewchapin
drewchapin / likeHerOnTinder.js
Last active June 27, 2018 02:37
JavaScript you can paste in Firefox Scratchpad to Like everyone until you run out of likes. Obviously, you have to use this with the web-browser version of Tinder.
function outOfLikes() {
var h3 = document.getElementsByTagName("h3");
for( var i = 0; i < h3.length; i++ ) {
if( h3[i].innerText == "You're Out of Likes!" ) {
return true;
}
}
}
function likeHer() {
@drewchapin
drewchapin / FacebookFriends.js
Last active March 24, 2019 02:02
Go to a person's Facebook friends list. Scroll until all friends are loaded. Run script in Console and it will produce a log group of "Friend Name: <profile-link>"
var divs = document.getElementsByTagName("div");
var list = new Array();
for( var i = 0; i < divs.length; i++ ) {
if( divs[i].getAttribute("data-testid") == "friend_list_item") {
var friend = divs[i].getElementsByClassName("fwb")[0];
var profile = friend.getElementsByTagName("a")[0];
list.push(friend.innerText + ": " + profile.href);
}
}
console.log(list.length+" friends");