Skip to content

Instantly share code, notes, and snippets.

View Qijiang60's full-sized avatar

Qi Jiang Qijiang60

  • Nanchang, Jiangxi
View GitHub Profile
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
@BaseScript CustomEndpointDelegate delegate
@Qijiang60
Qijiang60 / gist:25ef1e45e4991944b9189ff60b2b2c88
Created April 25, 2017 19:45 — forked from ilguzin/gist:6606011
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@Qijiang60
Qijiang60 / how_to_gen_ssl_cert.md
Created April 21, 2017 18:04 — forked from iansheridan/how_to_gen_ssl_cert.md
How to generate an SSL CSR or self signed SSL certificate

How to generate an SSL CSR or self signed SSL certificate

Overview

The following is an extremely simplified view of how SSL is implemented and what part the certificate plays in the entire process.

Normal web traffic is sent unencrypted over the Internet. That is, anyone with access to the right tools can snoop all of that traffic. Obviously, this can lead to problems, especially where security and privacy is necessary, such as in credit card data and bank transactions. The Secure Socket Layer is used to encrypt the data stream between the web server and the web client (the browser).

SSL makes use of what is known as asymmetric cryptography, commonly referred to as public key cryptography (PKI). With public key cryptography, two keys are created, one public, one private. Anything encrypted with either key can only be decrypted with its corresponding key. Thus if a message or data stream were encrypted with the server's private key, it can be decrypted only using its corresponding public key, ensuring

@Qijiang60
Qijiang60 / gist:f00ca07e7e78ed040077cd3d6784fc7c
Created April 11, 2017 17:40 — forked from alexschwartz/gist:912787
Ask Jenkins via json using jquery
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Seitenr?nder - marginwidth, marginheight, topmargin, leftmargin</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var baseUrl;
@Qijiang60
Qijiang60 / jsonp
Created March 3, 2017 18:57 — forked from malsup/jsonp
$.getJSONP
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
// figure out what the callback fn is
var $script = $(document.getElementsByTagName('head')[0].firstChild);
var url = $script.attr('src') || '';
var cb = (url.match(/callback=(\w+)/)||[])[1];
@Qijiang60
Qijiang60 / authentication-request-token-jquery.js
Created February 23, 2017 15:56 — forked from boomtrain-support/authentication-request-token-jquery.js
API Authentication - An example to request an OAuth token using jQuery
$.ajax({
url: 'https://api.boomtrain.com/tokens',
headers: {
'x-app-id': '{app_id}',
'Authentication': 'Basic ' + btoa('{username}:{password}')
},
...
});
@Qijiang60
Qijiang60 / services.md
Created January 31, 2017 14:34 — forked from shipstar/services.md
GitHub + Kanban

Spent a couple minutes poking around at kanban-like alternatives/supplements to labeling:

GitHub uses this and Huboard internally for some projects. Supported by Rally, so probably not going away anytime soon.

GitHub uses this and Waffle internally for some projects.

Looks interesting. (Marking issues from the command-line? Sweet!) It's also pricey.

@Qijiang60
Qijiang60 / 00-notes.md
Created January 20, 2017 17:04 — forked from gibson042/00-notes.md
jQuery.xhr

AJAX Examples

jQuery.xhr will be an asynchronous HTTP request API returning standards-compliant thenables. We have identified two possible approaches:

  • Autosend: control by options parameter; advanced functionality via beforeSend (similar to jQuery.ajax)
  • Chainable: control by options and/or chainable setters; advanced functionality via send: false and a chainable send method

This gist compares the approaches by imagining their use for current jQuery.ajax examples. To better highlight differences, chaining methods will be used instead of options more heavily than is likely in actual practice (assuming that options is available in the "Chainable" solution).

<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>Github API Webapp using jQuery - Treehouse Demo</title>
<meta name="author" content="Jake Rocheleau">
<link rel="shortcut icon" href="http://d15dxvojnvxp1x.cloudfront.net/assets/favicon.ico">
<link rel="icon" href="http://d15dxvojnvxp1x.cloudfront.net/assets/favicon.ico">
<link rel="stylesheet" type="text/css" media="all" href="css/styles.css">
package com.atlassian.stash.plugin.webook;
import com.atlassian.stash.event.pull.PullRequestRescopedEvent;
import com.atlassian.stash.hook.repository.AsyncPostReceiveRepositoryHook;
import com.atlassian.stash.hook.repository.RepositoryHookContext;
import com.atlassian.stash.nav.NavBuilder;
import com.atlassian.stash.pull.PullRequestRef;
import com.atlassian.stash.repository.RefChange;
import com.atlassian.stash.repository.RefChangeType;
import com.atlassian.stash.repository.Repository;