Skip to content

Instantly share code, notes, and snippets.

View namedgraph's full-sized avatar

Martynas Jusevičius namedgraph

View GitHub Profile
@bzerangue
bzerangue / rfc-date-to-iso-date.xsl
Created March 9, 2011 16:11
[XSLT] Convert RFC 2822 format to ISO date format
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Name: RSS feed date format to Symphony date format
Version: 1.0
Author: Brian Zerangue <brian.zerangue@gmail.com>
URL: http://symphony21.com/downloads/xslt/file/20457/
Description:
Convert RSS feed date format to Symphony date format
Convert RFC 2822 timestamp format to ISO date format minus the time info (Symphony CMS date format)
@gabetax
gabetax / example.html
Created January 30, 2012 05:42
XHTML to Markdown XSLT Translation
<html>
<body>
<h1>Our Navigation</h1>
<p>I'm writing an example xhtml document to get converted into markdown!</p>
<h2>Examples</h2>
<h3>Text formatting</h3>
<p>Sometimes with longer <em>paragraphs</em><br/>we just want a new line <strong>immediately</strong>.</p>
<div>Divs are block elements too, and people don't always put their text in p tags.</div>
@ijy
ijy / xhtml-to-markdown.xsl
Created July 21, 2013 14:29
XHTML to Markdown converter.
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- XHTML-to-Markdown converter by Andrew Green, Article Seven, http://www.article7.co.uk/ -->
<!-- This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. -->
<xsl:stylesheet version='1.0' xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='text' encoding='utf-8'/>
@nachoplaza
nachoplaza / dateTime_to_epoch.xml
Created November 12, 2013 14:18
Functions for XSLT conversion between dateTime format and Epoch format.
<xsl:call-template name="dateTimeToEpoch">
<xsl:with-param name="dateTimeValue" select="$value"/>
</xsl:call-template>
<xsl:template name="dateTimeToEpoch">
<xsl:param name="dateTimeValue"/>
<xsl:value-of select="( dateTime($dateTimeValue) - xsd:dateTime('1970-01-01T00:00:00') ) div xsd:dayTimeDuration('PT1S')"/>
</xsl:template>
<xsl:template name="epochToDateTime">
#!/usr/bin/env python
import networkx as nx
import matplotlib.pyplot as plt
import math
from random import random
from numpy import arange
N = 1000
K = 5
@cyrille-leclerc
cyrille-leclerc / pipeline.groovy
Last active March 9, 2022 23:41
Escape character & quotes in Jenkins Pipeline
docker.image('cloudbees/java-build-tools:0.0.6').inside {
sshagent(['github-ssh-credentials']) {
sh """
git version
git config --local user.email \\"cleclerc@cloudbees.com\\"
git config --local user.name \\"Cyrille Le Clerc\\"
git clone git@github.com:cyrille-leclerc/a-test-repo.git
date &> now.txt
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active June 17, 2024 15:05
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@destan
destan / ParseRSAKeys.java
Last active July 9, 2024 08:22
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@psamsotha
psamsotha / TestFrameworkStarter.java
Last active April 29, 2020 15:35
Starter for Jersey Test Framework
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;