Skip to content

Instantly share code, notes, and snippets.

View carlin-q-scott's full-sized avatar

Carlin Scott carlin-q-scott

View GitHub Profile
@carlin-q-scott
carlin-q-scott / list-additional-functions.js
Created January 30, 2019 18:40
DOM Inspection Scripts
/*
This function will list all of the functions on an HTML DOM Element that are non-standard.
temp0 is set by the Firefox Inspector when you right click on an element and choose "use in console";
You need to do that before running this script.
*/
var functionList = "";
var element = document.createElement('div');
for(var p in temp0){
@carlin-q-scott
carlin-q-scott / CIDR4Domain.sh
Created March 26, 2019 01:33
CIDR for Domain
whois `nslookup facebook.com | grep Address | cut -d$'\n' -f 2 | cut -d ' ' -f 2` | grep CIDR | grep -o
'[^ ]*$'
@carlin-q-scott
carlin-q-scott / query.bat
Last active July 10, 2019 01:04
Retrieve campsite availability by month for US Federal campgrounds
curl "https://www.recreation.gov/api/camps/availability/campground/234485/month?start_date=2019-07-01T00"%"3A00"%"3A00.000Z" -H "Accept: application/json, text/plain, */*" --compressed
@carlin-q-scott
carlin-q-scott / save_facebook_group_photos.rb
Created November 11, 2019 05:18
Save Facebook group photos to Downloads folder using Firefox and Selenium WebDriver
# This script will download all the photos owned by a group from Facebook.
require 'json'
require 'selenium-webdriver'
if ARGV.length != 3
print "please provide all the command arguments: {facebook group id} {first photo to download, often '1'} {last photo to download}"
exit 1
end
@carlin-q-scott
carlin-q-scott / gist:fbc4fa76b9e8fc5286101c1ef13e921b
Created December 10, 2019 20:01 — forked from Wysie/gist:03934b6a79a715772abd
Upload to Amazon S3 Instead of Server for Sendy Email Image Uploads
//Using S3.php from https://github.com/tpyo/amazon-s3-php-class. Place it in includes/helpers
//Replaces Sendy's includes/create/upload.php
<?php
include('../functions.php');
include('../login/auth.php');
require_once('../helpers/S3.php');
//Init
$file = $_FILES['file']['tmp_name'];
@carlin-q-scott
carlin-q-scott / regexes.txt
Last active June 3, 2020 21:31
Bootstrap 3 to 4 conversions
Regular Expression
Replacement
col-(\w\w)-(pull|push)-(\d+)
order-$1-$3
col-(\w\w)-offset-(\d+)
offset-$1-$2
hidden-xs
@carlin-q-scott
carlin-q-scott / HtmlHelper to tag-helper regexes.txt
Last active June 9, 2020 23:13
Files for converting from mvc views to razor pages
These are regular expressions for finding and replacing ASP.NET HTML Helpers with tag-helpers.
This could probably be combined with the pagify.py script to run all of these automatically.
@Html.LabelFor\(model => model.([\w_]+), htmlAttributes: new { @class = ("[^"]+") }\)
<label asp-for="$1" class=$2></label>
@Html.LabelFor\(model => model.([\w_]+), "([^"]+)", htmlAttributes: new { @class = ("[^"]+") }\)
<label asp-for="$1" class=$3>$2</label>
@Html.EditorFor\(model => model.([\w_]+), new { htmlAttributes = new { @class = ("[^"]+") } }\)
@carlin-q-scott
carlin-q-scott / regexes.txt
Created June 13, 2020 00:46
Localize ASP.NET views
(<a[^>]+>)([\w ]+)</a>
$1@Localizer["$2"]</a>
@carlin-q-scott
carlin-q-scott / Connect to OpenVPN.xml
Last active November 6, 2020 16:16
OpenVPN Connection Management
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-12-20T17:30:53.9213074</Date>
<Author>Carlin Scott</Author>
<URI>https://gist.github.com/carlin-q-scott</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
@carlin-q-scott
carlin-q-scott / LoremIpsum.cs
Created January 7, 2021 00:54
Lorem Ipsum generator that generates the specified number of words
const string LoremIpsum = @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
private static readonly Regex WordRegex = new Regex(@"\w+\W+");
private static readonly string[] LoremIpsumWords = WordRegex.Matches(LoremIpsum).Select(m => m.Value).ToArray();
private string LoregmIpsum(int count)
{
var output = new StringBuilder();
if (count > LoremIpsumWords.Length) output.AppendJoin(" ", Enumerable.Repeat(LoremIpsum, count / LoremIpsumWords.Length));
output.Append(" ");
output.AppendJoin(null, LoremIpsumWords.Take(count % LoremIpsumWo