Skip to content

Instantly share code, notes, and snippets.

View juanonsoftware's full-sized avatar

Juan on Software juanonsoftware

  • Rabbit Software
  • Vietnam
View GitHub Profile
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active April 18, 2024 07:11
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
<#
.SYNOPSIS
Performs a SQL query and returns an array of PSObjects.
.NOTES
Author: Jourdan Templeton - hello@jourdant.me
.LINK
https://blog.jourdant.me/post/simple-sql-in-powershell
#>
function Invoke-SqlCommand() {
[cmdletbinding(DefaultParameterSetName="integrated")]Param (
@joeyslalom
joeyslalom / github-docker-artifact-registry.yaml
Created March 16, 2022 00:08
GitHub Action - docker build and push to Artifact Registry
# 1. Create service account
#. * Service Account Token Creator
#. * Artifact Registry Writer
# 2. Generate service account key
#. * In GitHub project -> Settings -> Secrets -> Actions -> New Repository Secret
#. Name: GCP_CREDENTIALS
#. Value: key.json contents
# 3. Create repo in artifact repository
#. * Name: $env.REPOSITORY below
#. * Region: $env.GAR_LOCATION below
@ifrahim
ifrahim / CreateIISSite
Created February 26, 2014 15:31
Create IIS Site using Powershell
# The following code will create an IIS site and it associated Application Pool.
# Please note that you will be required to run PS with elevated permissions.
# Visit http://ifrahimblog.wordpress.com/2014/02/26/run-powershell-elevated-permissions-import-iis-module/
# set-executionpolicy unrestricted
$SiteFolderPath = "C:\WebSite" # Website Folder
$SiteAppPool = "MyAppPool" # Application Pool Name
$SiteName = "MySite" # IIS Site Name
$SiteHostName = "www.MySite.com" # Host Header
@DavidDeSloovere
DavidDeSloovere / upload.cs
Created November 17, 2016 14:13
SFTP upload with SSH.NET
const string host = "domainna.me";
const string username = "chucknorris";
const string password = "norrischuck";
const string workingdirectory = "/highway/hell";
const string uploadfile = @"c:\yourfilegoeshere.txt";
Console.WriteLine("Creating client and connecting");
using (var client = new SftpClient(host, port, username, password))
{
client.Connect();
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@jawadatgithub
jawadatgithub / OIDC and OAuth2 Flows.md
Last active February 11, 2024 23:15
Enrich IdentityServer3 Documentation with OIDC (OpenID Connect) and OAuth2 Flows section
Note for community:

A. IdentityServer3 docs, samples and source code use OIDC & OAuth2 terms interchangeably to refer to same thing in many areas. I think that's make sense because OIDC introduced as complement & extension for OAuth2.

B. IdentityServer3, STS, OP, OIDC server, OAuth2 server, CSP, IDP and others: means same thing (software that provide/issue tokens to clients) as explained in [Terminology] (http://identityserver.github.io/Documentation/docs/overview/terminology.html).

C. Grants and flows mean same thing, grant was the common term in OAuth2 specs and flow is the common term in OIDC specs.

D. This document will not focus on custom flow/grant.

E. [Important] Choosing wrong flow leads to security threat.

@jbtule
jbtule / AESGCM.cs
Last active October 30, 2023 21:14
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@magnetikonline
magnetikonline / README.md
Last active February 17, 2023 09:40
PowerShell execute command (.exe) with arguments safely (e.g. with spaces).

PowerShell execute command with arguments safely

In my opinion this is the best way for executing external commands from PowerShell with arguments in a safe manner - via the use of an array to hold the arguments.

Consider this one a PowerShell gem to keep in the toolbox.

Note: the example below makes use of EchoArgs.exe - a small utility that simply echoes back arguments passed to it. Utility is part of the PowerShell Community Extensions, or the exe alone can be downloaded at http://ss64.com/ps/EchoArgs.exe.

Example

Running example.ps1 yields the following output: