Skip to content

Instantly share code, notes, and snippets.

View samuelwilliams's full-sized avatar

Sam Williams samuelwilliams

View GitHub Profile
@samuelwilliams
samuelwilliams / example.php
Last active December 11, 2015 05:48
Example for samuelwilliams/Badcow-DNS-Zone-Library
<?php
require_once __DIR__ . '/../DNS/vendor/autoload.php';
use Badcow\DNS\Zone,
Badcow\DNS\ZoneFile,
Badcow\DNS\ResourceRecord,
Badcow\DNS\Rdata\SoaRdata,
Badcow\DNS\Rdata\NsRdata,
Badcow\DNS\Rdata\ARdata,
@samuelwilliams
samuelwilliams / wget
Last active December 19, 2015 13:39
Use wget to download an entire website
wget \
--recursive \
--convert-links \
--page-requisites \
--adjust-extension \
http://www.example.com
sh$ ffmpeg -i file.flac -b:a 256k file.mp3
sh$ for f in *.flac;do ffmpeg -i $f -b:a 256k $f.mp3;done
sh$ for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 256k "${f%.m4a}.mp3"; done
@samuelwilliams
samuelwilliams / batch_dload.bash
Created October 18, 2015 09:35
Simple script to batch download sequential files.
#!/usr/bin/env bash
PREFIX='http://example.com/gallery/pic_'
SUFFIX='.jpg'
START=1
END=25
FORMAT="%02d"
for i in `seq $START $END`;
do
@samuelwilliams
samuelwilliams / gist:b08bbdc978cce86582bd
Created February 15, 2016 07:43
Browser Bookmarklet to show passwords on a webpage
javascript:(function(){var a=document.getElementsByTagName('input');for(var i=0,e;e=a[i];i++)if(e.getAttribute('type')=='password')e.setAttribute('type', 'text');})()
@samuelwilliams
samuelwilliams / example.php
Created September 30, 2019 07:29
Badcow DNS Parse Comments
<?php
use Badcow\DNS\Parser\Parser;
use Badcow\DNS\ZoneBuilder;
require_once __DIR__ . '/../vendor/autoload.php';
$example = <<< 'DNS'
$ORIGIN example.com.
$TTL 1337
@samuelwilliams
samuelwilliams / less-cheatsheet.md
Created January 29, 2020 02:33 — forked from glnds/less-cheatsheet.md
Less Cheatsheet

Less Cheatsheet

less {filename}
Navigation
SPACE forward one window
b backward one window
d forward half window
Function Show-ProcessTree {
[CmdletBinding()]
Param($allprocess)
Begin {
# Identify top level processes
# They have either an identified processID that doesn't exist anymore
# Or they don't have a Parentprocess ID at all
#$allprocess = Get-WmiObject -Class Win32_process
$uniquetop = ($allprocess).ParentProcessID | Sort-Object -Unique
@samuelwilliams
samuelwilliams / UpdatePasswordsOnDC.ps1
Created September 9, 2020 02:57
Update user passwords on a domain controller.
#Small object to make the handling of credentials simpler.
class CredObject {
$Username
$Password
}
#Create the session to the domain controller.
$dcSession = Create-Session -Ip 10.0.0.10 -Username "Administrator" -Password "MyVerySecurePassword"
#Get all the users who aren't the Administrator
@samuelwilliams
samuelwilliams / HelperCommands.ps1
Created September 9, 2020 03:03
List of helpful powershell commands
#Get the local accounts on a machine
Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='$True'" | Select-Object Name, Disabled