Skip to content

Instantly share code, notes, and snippets.

Carlin Scott carlin-q-scott

View GitHub Profile
@carlin-q-scott
carlin-q-scott / regexes.txt
Created Jun 13, 2020
Localize ASP.NET views
View regexes.txt
(<a[^>]+>)([\w ]+)</a>
$1@Localizer["$2"]</a>
@carlin-q-scott
carlin-q-scott / regexes.txt
Last active Jun 3, 2020
Bootstrap 3 to 4 conversions
View regexes.txt
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 / README.md
Created Jun 1, 2020
AWS IAM Policies for CI/CD
View README.md

AWS IAM Policies for CI/CD

This gist contains AWS IAM policies for managing AWS resources through CD pipelines.

To use these policies, you should create an API only deployment user, and then add the policy to that user.

Elastic Beanstalk Policy

This AWS IAM policy has the permissions needed to create and deploy Elastic Beanstalk (EB) environments for a specific EB Application.

Before using this policy you need to replace:

  • {accountNumber} with the client account number
@carlin-q-scott
carlin-q-scott / HtmlHelper to tag-helper regexes.txt
Last active Jun 9, 2020
Files for converting from mvc views to razor pages
View HtmlHelper to tag-helper regexes.txt
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 = ("[^"]+") } }\)
View robots.txt.cshtml
@page
@{
Response.ContentType = "text/plain";
}
@using Microsoft.AspNetCore.Hosting
@inject IHostingEnvironment env
User-agent: *
@if (env.IsProduction())
{
@Html.Raw("Disallow: /hidden/path");
@carlin-q-scott
carlin-q-scott / gist:fbc4fa76b9e8fc5286101c1ef13e921b
Created Dec 10, 2019 — forked from Wysie/gist:03934b6a79a715772abd
Upload to Amazon S3 Instead of Server for Sendy Email Image Uploads
View gist:fbc4fa76b9e8fc5286101c1ef13e921b
//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 / save_facebook_group_photos.rb
Created Nov 11, 2019
Save Facebook group photos to Downloads folder using Firefox and Selenium WebDriver
View save_facebook_group_photos.rb
# 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 / query.bat
Last active Jul 10, 2019
Retrieve campsite availability by month for US Federal campgrounds
View query.bat
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
View CIDR4Domain.sh
whois `nslookup facebook.com | grep Address | cut -d$'\n' -f 2 | cut -d ' ' -f 2` | grep CIDR | grep -o
'[^ ]*$'
View list-additional-functions.js
/*
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){
You can’t perform that action at this time.