Skip to content

Instantly share code, notes, and snippets.

View phillippelevidad's full-sized avatar

Phillippe Santana phillippelevidad

View GitHub Profile
@phillippelevidad
phillippelevidad / AwsCostExplorerHelper.cs
Created February 13, 2020 19:11
A quick-start class to pull sumarized costs from your AWS account.
namespace NameIt
{
public static class AwsCostExplorer
{
private const string metricType = "BlendedCost";
private static readonly RegionEndpoint regionEndpoint = RegionEndpoint.USEast1;
public static AwsCostStructure GetCostForAccount(string accessKey, string secretKey, Period period)
{
var client = new AmazonCostExplorerClient(
@jamesbar2
jamesbar2 / postal-codes.json
Last active June 27, 2024 09:30 — forked from matthewbednarski/postal-codes.json
Global postal codes regex formats
[{
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup",
"Country": "Afghanistan",
"ISO": "AF",
"Format": "NNNN",
"Regex": "^\\d{4}$"
}, {
"Note": "With Finland, first two numbers are 22.",
"Country": "Åland Islands",
"ISO": "AX",
@bjcull
bjcull / CustomRequireHttpsFilter.cs
Created May 15, 2015 06:50
An improved HTTPS redirection filter for ASP.NET MVC.
public class CustomRequireHttpsFilter : RequireHttpsAttribute
{
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext)
{
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
// The other requests will throw an exception to ensure the correct verbs are used.
// We fall back to the base method as the mvc exceptions are marked as internal.
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>