Skip to content

Instantly share code, notes, and snippets.

View drewchapin's full-sized avatar

Drew Chapin drewchapin

View GitHub Profile
@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");
@drewchapin
drewchapin / update-google-dyndns.sh
Last active April 13, 2024 04:06
A shell script to update the public IP address of a Google DynDNS hostname. Intended to be used on DD-WRT routers.
#!/bin/sh
HOSTNAME="host.yourdomain.com"
USERNAME="username"
PASSWORD="password"
LOG_FILE="/tmp/ddns/ddns.log"
while true; do
@drewchapin
drewchapin / List-MismatchedSIP.ps1
Created August 1, 2018 18:24
List users with mismatches msRTCSIP-PrimaryUserAddress and proxyAddresses attributes.
Import-Module ActiveDirectory
$users = Get-ADUser -Server dc01.drewchapin.com -Properties proxyAddresses,msRTCSIP-PrimaryUserAddress
# -Filter { physicalDeliveryOfficeName -eq "Location Name" }
ForEach( $user in $users )
{
$sip1 = $user.'msRTCSIP-PrimaryUserAddress'
$sip2 = $user.proxyAddresses | Where { $_ -like "SIP:*" }
@drewchapin
drewchapin / SendEmail.vbs
Created July 3, 2018 21:16
VBScript to send an email without using Outlook
Sub SendEmail( fromAddress, toAddress, subject, body )
On Error Resume Next
Dim Email
Set Email = CreateObject("CDO.Message")
Email.From = fromAddress
Email.To = toAddress
Email.Subject = subject
Email.TextBody = body
Email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.google.com"
@drewchapin
drewchapin / BrokenLinks.bas
Last active September 26, 2022 06:37
List broken hyperlinks in Excel
@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 / ThisAddin.cs
Last active September 26, 2022 06:38
IWin32Window implementation to allow VSTO addins to access Excel's main window.
using System.Reflection;
using System.Windows.Forms;
namespace MyExcelAddin
{
public partial class ThisAddIn
{
public Win32Window MainWindow { get; set; }
@drewchapin
drewchapin / Template.nsi
Created February 20, 2018 19:09
Template for modern NSIS installation script
;-------------------------------------------------------------------------------
; Includes
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
;-------------------------------------------------------------------------------
; Constants
!define PRODUCT_NAME "My Application"
@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>"
#!/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