Skip to content

Instantly share code, notes, and snippets.

View maxan's full-sized avatar
🙃

Anderson Marinho maxan

🙃
View GitHub Profile
@maxan
maxan / WSSoapClient.php
Created November 11, 2020 00:05 — forked from silasrm/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*
@maxan
maxan / CreateValidateJWT.cs
Created October 19, 2020 20:33 — forked from bschapendonk/CreateValidateJWT.cs
How to create and validate a JWT using System.IdentityModel.Tokens.Jwt
using System;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using System.Security.Cryptography;
namespace CreateValidateJWT
{
class Program
{
static void Main(string[] args)
@maxan
maxan / certificates.txt
Created December 4, 2017 15:47 — forked from jnwelzel/certificates.txt
Client authentication through SSL certificate in JBoss AS 7.1.1.Final. This configuration will make sure that only clients whose certificates are trusted by the server may have access to the application (standalone.xml line 272)
PASSWORD
changethis
SERVER KEYSTORE - used by the server to establish a secure connection (HTTPS)
c:\eclipse\jdk1.7.0_05\jre\bin\keytool.exe -genkey -keyalg RSA -alias localhost -keystore localhost.jks -validity 365 -keysize 2048
CLIENT KEYSTORE - used to generate ".cer" file that wil be used in the server's trustore and in the browser to identify the client with the server
c:\eclipse\jdk1.7.0_05\jre\bin\keytool.exe -genkey -keyalg RSA -alias jonwelzel -keystore jonwelzel.jks -validity 365 -keysize 2048
@maxan
maxan / web.config
Last active November 14, 2023 11:43
IIS Config to React Router App
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
@maxan
maxan / launch.json
Created March 31, 2017 00:03
Example launch.json file when it exists one .net core project and angular under the same root folder...
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"sourceMaps": true,
"webRoot": "${workspaceRoot}/my-own-app"
namespace YourNamespace
{
/// <summary>
/// Uses the Name value of the <see cref="ColumnAttribute"/> specified to determine
/// the association between the name of the column in the query results and the member to
/// which it will be extracted. If no column mapping is present all members are mapped as
/// usual.
/// </summary>
/// <typeparam name="T">The type of the object that this association between the mapper applies to.</typeparam>
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper
@maxan
maxan / municipios_brasileiros.js
Last active December 25, 2015 12:27
Municípios Brasileiros (da Wikipédia)
// Fonte dos municípios: https://pt.wikipedia.org/wiki/Lista_de_munic%C3%ADpios_do_Brasil
$('table tbody > tr > td > ul > li').each(function(index, element) {
pattern = /([\s\S]*)(\([A-Za-z]{2}\))/;
text = $(this).text();
result = text.match(pattern);
result.forEach(function (e, i, a) { a[i] = a[i].trim(); });
console.log('INSERT INTO Municipio (Nome, Estado) VALUES (\'' + result[1] + '\', \'' + result[2].replace(/(\()(\w+)(\))/, '$2') + '\');');
});
@maxan
maxan / bench.php
Created February 5, 2015 14:22
Zend bench.php (from php-src)
<?php
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("UTC");
}
function simple() {
$a = 0;
for ($i = 0; $i < 1000000; $i++)
$a++;
@maxan
maxan / bench.php
Last active August 29, 2015 14:14 — forked from ircmaxell/bench.php
<?php
use ReckiCT\Jit;
if (function_exists('class_alias')) {
// HippyVM doesn't have a class_alias, so this will break things.
require __DIR__ . '/../vendor/autoload.php';
}
define("IM", 139968);
<?php
/**
* CI3 flat file session driver used for testing with Codeception
*/
/**
* Class CI_Session_codeception
*/
class CI_Session_codeception extends CI_Session_driver