Skip to content

Instantly share code, notes, and snippets.

Avatar

Drew Chapin drewchapin

View GitHub Profile
@drewchapin
drewchapin / FacebookFriends.js
Last active Mar 24, 2019
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>"
View FacebookFriends.js
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 Sep 10, 2021
A shell script to update the public IP address of a Google DynDNS hostname. Intended to be used on DD-WRT routers.
View update-google-dyndns.sh
#!/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 Aug 1, 2018
List users with mismatches msRTCSIP-PrimaryUserAddress and proxyAddresses attributes.
View List-MismatchedSIP.ps1
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 Jul 3, 2018
VBScript to send an email without using Outlook
View SendEmail.vbs
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 Jul 2, 2018
List broken hyperlinks in Excel
View BrokenLinks.bas
@drewchapin
drewchapin / likeHerOnTinder.js
Last active Jun 27, 2018
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.
View likeHerOnTinder.js
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 Jul 6, 2018
IWin32Window implementation to allow VSTO addins to access Excel's main window.
View ThisAddin.cs
using System.Reflection;
using System.Windows.Forms;
namespace MyExcelAddin
{
public partial class ThisAddIn
{
public Win32Window MainWindow { get; set; }
@drewchapin
drewchapin / Template.nsi
Created Feb 20, 2018
Template for modern NSIS installation script
View Template.nsi
;-------------------------------------------------------------------------------
; Includes
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
;-------------------------------------------------------------------------------
; Constants
!define PRODUCT_NAME "My Application"
@drewchapin
drewchapin / listusers.sh
Created Feb 18, 2018
List users of a the specified group(s).
View listusers.sh
#!/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>"
View bash_background_redirection_example.sh
#!/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