Skip to content

Instantly share code, notes, and snippets.

View MacsInSpace's full-sized avatar

Craig Hair MacsInSpace

  • Department of Education
  • Melbourne
  • 10:17 (UTC +10:00)
View GitHub Profile
@exp0se
exp0se / powershell_eventlog_parsing.ps1
Last active March 30, 2025 18:43
Powershell log parsing
#Security log
#============
####
#4624 - Logon & Logoff events successful
#4625 - Logon unsucceful
####
# Get usernames
Get-WinEvent -path .\Security.evtx | Where {$_.id -eq "4624"} | Foreach {([xml]$_.ToXml()).GetElementsByTagName("Data").ItemOf(5)}| Select -ExpandProperty "#text" -Unique
# Get domains
@grahampugh
grahampugh / printer-template.sh
Last active November 25, 2019 04:35
SMB Printer Install Script Template
#!/bin/bash
### Variables. Edit these.
printername="Choose-A-Printer-Name-with-no-spaces"
location="Choose a location"
gui_display_name="Choose a descriptive printer name"
address="smb://server/printqueue"
# leave this empty if you wish to use the generic PS PPD print driver
# or make sure the file exists in the ../drivers directory
@Dani3lSun
Dani3lSun / adblock_hosts.sh
Last active April 20, 2023 11:49
Mac OS X adblock shell script using system hosts file (Block ads system wide)
#!/bin/sh
#
# Mac OSX Adblocker Script for IPv4
# Description: Blocks ads using system hosts file /private/etc/hosts, Ad-Domains would be redirected to 0.0.0.0
# Author: Daniel Hochleitner
# Created: 10.09.2015
# Use: sudo ./adblock_hosts.sh
# Get original hosts file from /private/etc/hosts
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadIdentifier</key>
<string>com.apple.mdm.moostophelees.talkingmoose.net.d8300e90-1b4b-0133-b2d5-38e856168efc.alacarte</string>
<key>PayloadRemovalDisallowed</key>
<true />
<key>PayloadScope</key>
<string>User</string>
@jacobsalmela
jacobsalmela / setFavServers.sh
Created March 9, 2015 16:17
Add unlimited servers to the Connect To... menu in OS X
#!/bin/bash
bud='/usr/libexec/Plistbuddy'
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist'
servers=('afp://servername'
'smb://servername'
'vnc://servername'
'ftp://servername')
killall cfprefsd
@MatthewSteeples
MatthewSteeples / mousemove.ps1
Created February 26, 2015 19:09
Powershell Script to keep the mouse moving
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X % 500) + 1
$y = ($pos.Y % 500) + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 10
}
@ferayebend
ferayebend / streaming.py
Created September 6, 2014 23:42
tweepy streaming
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#from tweepy.streaming import StreamListener
#from tweepy import OAuthHandler
#from tweepy import Stream
import tweepy
import json
import codecs
import os
import sys
@jaredhirsch
jaredhirsch / gist:c9be82b168c5c823b407
Last active October 1, 2024 15:18
how to delete your tweets just using your browser, no oauth required
// 1. go to your twitter feed with tweets and replies
// for example, mine was twitter.com/6a68/with_replies
// 2. scroll all the way down to the bottom of the page.
// I suppose you could automate this with JS, but I didn't.
// this function will delete tweets you can delete, i.e. not retweets:
function deleteTweets() {
// find the next delete button in the DOM (next deletable tweet)
// and click the delete button. I wanted to keep the first tweet,
// which is why the index here is 1.
if (!$('.js-actionDelete').length) {
@arikfr
arikfr / export_lists.py
Created August 19, 2014 04:57
Simple script to export Twitter lists to CSV
import twitter # python-twitter
import csv
import cStringIO
import codecs
from requests_oauthlib import OAuth1Session
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'
ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'
AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'
SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'
@cabal95
cabal95 / update_memberUid_to_member
Last active June 9, 2018 22:35
Give Apple Open Directory the member and memberOf attributes.
#!/bin/sh
#
LDAPURI="ldapi://%2Fvar%2Frun%2Fldapi"
BASEDN="dc=hdcnet,dc=org"
GROUPDN="cn=groups,$BASEDN"
USERDN="cn=users,$BASEDN"
#