Skip to content

Instantly share code, notes, and snippets.

View dermeister0's full-sized avatar

Der_Meister dermeister0

View GitHub Profile
@rrharvey
rrharvey / CustomSwagger.js
Last active May 5, 2019 09:39
Add bearer token to Swagger UI using Swashbuckle
(function () {
$(function () {
$('#input_apiKey').attr('placeholder', 'JSON Web Token');
$('#input_apiKey').off();
$('#input_apiKey').on('change', function () {
var key = this.value;
console.info('Set bearer token to: ' + key);
if (key && key.trim() !== '') {
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer " + key, "header"));
}
@hayderimran7
hayderimran7 / groovy-create-user.md
Last active April 10, 2024 17:29
Jenkins Groovy enable security and create a user in groovy script

This is a snippet that will create a new user in jenkins and if security has been disabled , it will enable it :)

import jenkins.model.*
import hudson.security.*

def instance = Jenkins.getInstance()

def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("MyUSERNAME","MyPASSWORD")
instance.setSecurityRealm(hudsonRealm)
@ctaggart
ctaggart / ideuser-delete-VS2015.reg
Created March 3, 2015 06:08
remove the current logged in user for Visual Studio 2015 http://stackoverflow.com/a/20891677/23059
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\IdeUser]
@TemporaryJam
TemporaryJam / Howto convert a PFX to a seperate .key & .crt file
Last active April 4, 2024 10:52
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@Stasonix
Stasonix / Form1.cs
Created July 26, 2012 08:52
GLOBAL HOOK example C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO;
@chgeuer
chgeuer / SelfHostedAspNetWebApi.cs
Created February 28, 2012 18:28
Sample for self-hosting ASP.NET Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.SelfHost;
using System.Threading;