Skip to content

Instantly share code, notes, and snippets.

View adammendoza's full-sized avatar

Adam J. Mendoza adammendoza

  • San Francisco, Calif.
View GitHub Profile
@adammendoza
adammendoza / self-signed-certificate-with-custom-ca.md
Created October 27, 2022 17:27 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@adammendoza
adammendoza / markdown-details-collapsible.md
Created May 22, 2019 02:15 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section with markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@adammendoza
adammendoza / SecurityHeader.cs
Created May 16, 2019 05:55 — forked from martea/SecurityHeader.cs
Skoruba Identityserver, shared securityheader
using System.Collections.Generic;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
public static class SecurityHeader {
public static void UseSecurityHeaders (this IApplicationBuilder app) {
app.UseForwardedHeaders (new ForwardedHeadersOptions {
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
@adammendoza
adammendoza / DemoAreaRegistration.cs
Created May 10, 2019 04:52 — forked from johnnyreilly/DemoAreaRegistration.cs
What you need to unit test MVC controllers using MOQ.
using System.Web.Mvc;
namespace DemoApp.Areas.Demo
{
public class DemoAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
@adammendoza
adammendoza / function
Created May 10, 2019 04:48 — forked from manix/calculate geometric euclidean distance
Distance between points simplified
getDistanceFromLatLonInM(lat1, lon1, lat2, lon2) {
var a =
Math.pow(Math.sin(deg2rad(lat2 - lat1) / 2), 2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
Math.pow(Math.sin(deg2rad(lon2 - lon1) / 2), 2);
return 12742000 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
}
@adammendoza
adammendoza / PauseClass.cs
Created May 10, 2019 04:46
C# PauseClass
public class PauseClass
{
//(C) Michael Roberg
//Please feel free to distribute this class but include my credentials.
// usage: var p = new PauseClass(); p.Pause(1000); // pause for 1 second
System.Timers.Timer pauseTimer = null;
public void BreakPause()
@adammendoza
adammendoza / install-composer.sh
Created February 13, 2019 08:44 — forked from pjrobertson/install-composer.sh
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@adammendoza
adammendoza / HelloWorld.java
Created November 13, 2018 07:01 — forked from lolzballs/HelloWorld.java
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
import { TestBed, async, inject } from '@angular/core/testing';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
describe(`FakeHttpClientResponses`, () => {
beforeEach(() => {
// 0. set up the test environment
TestBed.configureTestingModule({
imports: [
@adammendoza
adammendoza / top_100_anime_movies.md
Created February 25, 2018 04:31 — forked from bomberstudios/top_100_anime_movies.md
Top 100 Anime Movies Of All Time (from http://imgur.com/a/k2vwE)
  1. Colorful (2010) [T]

    Probably not the title that most people expected to see in the #1 slot. I urge everyone to give it a shot though. No other film has ever brought me through a greater spectrum of emotions. It's a supernatural film, but the characters are so well fleshed out and developed that they feel real. I've probably seen a hundred films since, but none have compared.

  2. Time of Eve (2010) [T]

Director: Yasuhiro Yoshiura - "Sometime in future Japan, androids have been involved in every aspect of peoples lives. One day, upon checking his android's behavioral log, Rikuo, a student, noticed his android's returning times have been odd recently. With his friend Masaki, they found out the place where his android, Sammy, have been visiting: a small cafe called Eve no Jikan where an