text:
{% extends "rdec/root.html" %}

{% block body %}
        {% if form.errors %}

{{ form.errors }}

        {% endif %}

Reset Password

                <form method="post">
                    {% csrf_token %}

                        E-mail Address
                        <input class="form-control" id="{{ form.email.id_for_label }}" maxlength="30"
                               name="{{ form.email.html_name }}" placeholder="bigwhoop@hellfire-harlots.co.uk" type="email"/>

                    <button class="btn btn-default" type="submit">Submit</button>
                </form>

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Model for the materials used in a course
 */
class Materials extends CI_Model
{

	protected $xml; // root element of our data structure

	/**
	 * Constructor.
	 */

	public function __construct()
	{
		parent::__construct();

		$this->xml = simplexml_load_file(DATAPATH.'materials.xml');
	}

	/**
	 * Load & return the materials provided, converted to standard types.
	 */
	public function all()
	{
		$result = array ();

		// Build the material groups
		foreach ($this->xml->group as $group)
		{
			$bundle = array ();
			$name = (string) $group['name'];

			foreach ($group->item as $item)
			{
				$bundle[(string) $item['type']] = (string) $item;
			}
			$result[$name] = $bundle;
		}

		// All done
		return $result;
	}

}


text:
package com.zlab.datFM;

import android.os.AsyncTask;
import android.view.View;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;

public class datFM_Properties_MD5 extends AsyncTask<String, Void, String> {

    protected void onPreExecute() {
        datFM_Properties.prop_md5_progress.setVisibility(View.VISIBLE);
        datFM_Properties.prop_btn_calc_md5.setEnabled(false);
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(String... files) {
        String hex="";
        try{
            MessageDigest digest = MessageDigest.getInstance("MD5");
            String f = files[0];
            InputStream is = new BufferedInputStream(new datFM_IO(f,datFM.curPanel).getInput());
            byte[] buffer = new byte[8192];
            int read = 0;
            try {
                while( (read = is.read(buffer)) > 0) {
                    digest.update(buffer, 0, read);
                }
                byte[] md5sum = digest.digest();
                BigInteger bigInt = new BigInteger(1, md5sum);
                String output = bigInt.toString(16);
                hex = output;
            }
            catch(IOException e) {
                throw new RuntimeException("Unable to process file for MD5", e);
            }
            finally {
                try {
                    is.close();
                }
                catch(IOException e) {
                    throw new RuntimeException("Unable to close input stream for MD5 calculation", e);
                }
            }
        } catch (Exception e){}

        return hex;
    }

    protected void onPostExecute(String result) {
        datFM_Properties.prop_md5sum.setText(result);
        if(!datFM_Properties.prop_md5sum_check.getText().toString().equals("")){
            datFM_Properties.prop_icon_md5_check.setVisibility(View.VISIBLE);
            if(datFM_Properties.prop_md5sum.getText().toString().equals(result)){
                datFM_Properties.prop_icon_md5_check.setImageResource(android.R.drawable.checkbox_on_background);
            } else {
                datFM_Properties.prop_icon_md5_check.setImageResource(android.R.drawable.presence_busy);
            }
        }
        datFM_Properties.prop_md5_progress.setVisibility(View.GONE);
        datFM_Properties.prop_icon_md5_check.setVisibility(View.VISIBLE);
        super.onPostExecute(result);
    }

}


text:
require 'test_helper'

###
# This class tests Data Manipulation Operarions.
class TestDmo < Test::Unit::TestCase
  include Orientdb4r::Utils

  CLASS = 'testing'
  DB = 'temp'

  def setup
    @client = Orientdb4r.client
    @client.connect :database => DB, :user => 'admin', :password => 'admin'
    @client.drop_class(CLASS) # just to be sure if the previous test failed
    @client.create_class(CLASS) do |c|
      c.property 'prop1', :integer
      c.property 'prop2', :string, :mandatory => true, :notnull => :true, :min => 1, :max => 99
      c.link     'friends',  :linkset, 'OUser', :mandatory => true
    end
    @admin = @client.query("SELECT FROM OUser WHERE name = 'admin'")[0]
  end

  def teardown
    # remove the testing class after each test
    @client.drop_class(CLASS)
    @client.disconnect
  end

  ###
  # INSERT INTO
  def test_insert
    assert_nothing_thrown do
      1.upto(10) do |i|
        @client.command "INSERT INTO #{CLASS} (prop1, prop2, friends) VALUES (#{i}, '#{random_string}', [#{@admin['@rid']}])"
      end
    end

    entries = @client.query("SELECT FROM #{CLASS}")
    assert_equal 10, entries.size
    assert_equal 10, entries.select { |e| e if e['prop1'] <= 10 }.size
    assert_equal 10, entries.select { |e| e if e['friends'].size == 1 }.size

    # insert more users into LINKSET
    urids = @client.query('SELECT FROM OUser').collect { |u| u['@rid'] }
    assert_nothing_thrown do
      @client.command "INSERT INTO #{CLASS} (prop1, prop2, friends) VALUES (1, 'linkset', [#{urids.join(',')}])"
    end
    assert_equal urids.size, @client.query("SELECT FROM #{CLASS} WHERE prop2 = 'linkset'")[0]['friends'].size

    # table doesn't exist
    assert_raise Orientdb4r::ServerError do
      @client.command "INSERT INTO #{CLASS}x (prop1, prop2, friends) VALUES (1, 'linkset', [#{urids.join(',')}])"
    end
    # bad syntax
    assert_raise Orientdb4r::ServerError do
      @client.command 'xxx'
    end

    # used for SELECT
    assert_equal @client.query('SELECT FROM OUser'), @client.command('SELECT FROM OUser')['result']
  end

  ###
  # SELECT
  def test_query
    1.upto(25) do |i|
      @client.command "INSERT INTO #{CLASS} (prop1, prop2, friends) VALUES (#{i}, 'string#{i}', [#{@admin['@rid']}])"
    end

    entries = @client.query("SELECT FROM #{CLASS}")
    assert_not_nil entries
    assert_instance_of Array, entries
    assert_equal 20, entries.size # 20 is default limit
    entries.each { |doc| assert doc.kind_of? Orientdb4r::DocumentMetadata }
    entries.each { |doc| assert_instance_of Orientdb4r::Rid, doc.doc_rid }
    # limit
    assert_equal 5, @client.query("SELECT FROM #{CLASS} LIMIT 5").size
    entries = @client.query "SELECT FROM #{CLASS}", :limit => 100
    assert_equal 25, entries.size
    assert_raise ArgumentError do @client.query "SELECT FROM #{CLASS}", :unknown => 100; end

    assert_equal 1, @client.query("SELECT FROM #{CLASS} WHERE prop1 = 1").size
    assert_equal 0, @client.query("SELECT FROM #{CLASS} WHERE prop1 = -1").size
    # graph
    rid = @client.query("SELECT FROM #{CLASS} WHERE prop1 = 1")[0]['@rid']
    gr = @client.query("SELECT FROM (TRAVERSE * FROM #{rid})")
    assert_equal 3, gr.size # entries: testing, OUser, ORole
    assert_equal 1, gr.select { |e| e if e['@class'] == CLASS }.size
    assert_equal 1, gr.select { |e| e if e['@class'] == 'OUser' }.size
    assert_equal 1, gr.select { |e| e if e['@class'] == 'ORole' }.size

    # table doesn't exist
    assert_raise Orientdb4r::ServerError do
      @client.query 'SELECT FROM OUserX'
    end
    # bad syntax
    assert_raise Orientdb4r::ServerError do
      @client.query 'xxx'
    end
    # record not found in existing cluster
    entries = @client.query 'SELECT FROM #0:1111'
    assert_not_nil entries
    assert_instance_of Array, entries
    assert entries.empty?
    # try to find entry in a non-existing cluster
    assert_raise Orientdb4r::ServerError do @client.query 'SELECT FROM #111:1111'; end
    # used for INSERT
    assert_raise Orientdb4r::ServerError do
      @client.query "INSERT INTO #{CLASS} (prop1, prop2, friends) VALUES (0, 'string0', [])"
    end
  end

end


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>BabyKeySmash - Fun for the crazy baby!</title>
        <meta name="description" content="A baby friendly web app where every key press makes something exciting happen on the screen!">
        <meta name="viewport" content="width=device-width">

        <link rel="stylesheet" href="css/normalize.min.css" />
        <link rel="stylesheet" href="css/main.css" />
        <link rel="stylesheet" href="css/bootstrap.min.css" />

     Settings

    <audio id="sound_one">
	    <source src="audio/one.ogg" type="audio/ogg">
    </audio>

    <audio id="sound_two">
	    <source src="audio/two.ogg" type="audio/ogg">
    </audio>

    <audio id="sound_three">
	    <source src="audio/three.ogg" type="audio/ogg">
    </audio>

    <audio id="sound_four">
	    <source src="audio/four.ogg" type="audio/ogg">
    </audio>

© 2013 Sharproot Media

Blog

About

Contact

    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Settings

    <FORM>

        <input type="checkbox" value="1" name="record" id="record">
            Record
            Keep track of your all time record!

        <input type="checkbox" value="1" name="auto" id="auto">
           Auto Mode
           Makes something happen every second!

        </FORM>

    Close


text:
goog.provide('lf.backstore.IndexedDBTx');

goog.require('lf.backstore.BaseTx');
goog.require('lf.backstore.BundledObjectStore');
goog.require('lf.backstore.ObjectStore');
goog.require('lf.backstore.TableType');

/**
 * Wrapper for IDBTransaction object obtained from IndexedDB.
 * @constructor
 * @struct
 * @extends {lf.backstore.BaseTx}
 *
 * @param {!lf.Global} global
 * @param {!IDBTransaction} transaction
 * @param {!lf.TransactionType} txType
 * @param {boolean} bundleMode If the containing DB is in bundle mode.
 * @param {!lf.cache.Journal=} opt_journal
 */
lf.backstore.IndexedDBTx = function(
    global, transaction, txType, bundleMode, opt_journal) {
  lf.backstore.IndexedDBTx.base(this, 'constructor', txType, opt_journal);

  /** @private {!lf.Global} */
  this.global_ = global;

  /** @private {!IDBTransaction} */
  this.tx_ = transaction;

  /** @private {boolean} */
  this.bundleMode_ = bundleMode;

  this.tx_.oncomplete = this.resolver.resolve.bind(this.resolver);
  this.tx_.onabort = this.resolver.reject.bind(this.resolver);
};
goog.inherits(lf.backstore.IndexedDBTx, lf.backstore.BaseTx);

/** @override */
lf.backstore.IndexedDBTx.prototype.getTable = function(
    tableName, deserializeFn, opt_tableType) {
  if (this.bundleMode_) {
    var tableType =
        opt_tableType != null ? opt_tableType : lf.backstore.TableType.DATA;
    return lf.backstore.BundledObjectStore.forTableType(
        this.global_, this.tx_.objectStore(tableName),
        deserializeFn, tableType);
  } else {
    return new lf.backstore.ObjectStore(
        this.tx_.objectStore(tableName), deserializeFn);
  }
};

/** @override */
lf.backstore.IndexedDBTx.prototype.abort = function() {
  this.tx_.abort();
};

/** @override */
lf.backstore.IndexedDBTx.prototype.commitInternal = function() {
  return this.resolver.promise;
};


text:
class GraderConfig
  def initialize(filename)
    @filename = filename
    @values = nil
  end

  def load
    grader_conf = YAML.load_file(Rails.root.join(filename))
    puts "Reading configuration for env #{Rails.env}"
    if !grader_conf[Rails.env]
      puts "Cannot find configuration for #{Rails.env}. Check your #{filename}"
      return false
    end

    @values = grader_conf[Rails.env].with_indifferent_access
    true
  end

  def value(key)
    raise KeyError, "Key #{key} not found in config file. Check the #{Rails.env} section of #{filename}." if !values.has_key?(key)
    values[key]
  end

  def supported_language?(lang)
    values[:languages].split(';').select{ |lang| lang.strip.length > 0 }.include?(lang)
  end

  def compiled_language?(lang)
    values[:compiled_languages].split(';').select{ |lang| lang.strip.length > 0 }.include?(lang)
  end

  def has_key?(key)
    values.has_key?(key)
  end

  protected

  attr_reader :filename, :values
end


text:
'''
@author: sheng
@license:
'''

import unittest
from meridian.acupoints import renying22

class TestRenying22Functions(unittest.TestCase):
    def setUp(self):
        pass

    def test_xxx(self):
        pass

if __name__ == '__main__':
    unittest.main()


text:
package com.paulvarry.intra42.api.model;

import com.google.gson.annotations.SerializedName;
import com.paulvarry.intra42.AppClass;
import com.paulvarry.intra42.utils.AppSettings;

import java.util.Date;
import java.util.List;

import androidx.annotation.Nullable;

public class ProjectsSessions {

    private static final String API_ID = "id";
    private static final String API_SOLO = "solo";
    private static final String API_BEGIN_AT = "begin_at";
    private static final String API_END_AT = "end_at";
    private static final String API_ESTIMATE_TIME = "estimate_time";
    private static final String API_DURATION_DAYS = "duration_days";
    private static final String API_TERMINATING_AFTER = "terminating_after";
    private static final String API_PROJECT_ID = "project_id";
    private static final String API_CAMPUS_ID = "campus_id";
    private static final String API_CURSUS_ID = "cursus_id";
    private static final String API_CREATED_AT = "created_at";
    private static final String API_UPDATED_AT = "updated_at";
    private static final String API_MAX_PEOPLE = "max_people";
    private static final String API_IS_SUBSCRIPTABLE = "is_subscriptable";
    private static final String API_SCALES = "scales";
    private static final String API_UPLOADS = "uploads";
    private static final String API_TEAM_BEHAVIOUR = "team_behaviour";

    @SerializedName(API_ID)
    public int id;
    @SerializedName(API_SOLO)
    public boolean solo;
    @SerializedName(API_BEGIN_AT)
    public Date beginAt;
    @SerializedName(API_END_AT)
    public Date endAt;
    @SerializedName(API_ESTIMATE_TIME)
    public long estimateTime;
    @SerializedName(API_PROJECT_ID)
    public int projectId;
    @Nullable
    @SerializedName(API_CAMPUS_ID)
    public Integer campusId;
    @Nullable
    @SerializedName(API_CURSUS_ID)
    public Integer cursusId;
    @SerializedName(API_CREATED_AT)
    public Date createdAt;
    @SerializedName(API_UPDATED_AT)
    public Date updatedAt;
    @Nullable
    @SerializedName(API_MAX_PEOPLE)
    public Integer maxPeople;
    @SerializedName(API_IS_SUBSCRIPTABLE)
    public boolean isSubscribable;
    @SerializedName(API_SCALES)
    public List<Scales> scales;
    @SerializedName(API_UPLOADS)
    public List<Uploads> uploads;
    @SerializedName(API_TEAM_BEHAVIOUR)
    public String teamBehaviour;

    static public ProjectsSessions getSessionSubscribable(List<ProjectsSessions> sessionses) {
        for (ProjectsSessions item : sessionses) {
            if (item.isSubscribable)
                return item;
        }
        return null;
    }

    public static ProjectsSessions getScaleForMe(AppClass app, List<ProjectsSessions> sessions) {
        if (sessions == null)
            return null;
        int campus = AppSettings.getUserCampus(app);
        int cursus = AppSettings.getUserCursus(app);

        for (ProjectsSessions s : sessions) {
            if (campus != 0 && campus != -1 && s.campusId != null && s.campusId != campus)
                continue;
            if (cursus != 0 && cursus != -1 && s.cursusId != null && s.cursusId != cursus)
                continue;
            if (!s.isSubscribable)
                continue;
            return s;
        }
        return null;
    }

    public static class Scales {
        private static final String API_ID = "id";
        private static final String API_CORRECTION_NUMBER = "correction_number";
        private static final String API_IS_PRIMARY = "is_primary";

        @SerializedName(API_ID)
        public int id;
        @SerializedName(API_CORRECTION_NUMBER)
        public int correctionNumber;
        @SerializedName(API_IS_PRIMARY)
        public boolean isPrimary;

        static public Scales getPrimary(List<Scales> scales) {
            if (scales != null)
                for (Scales s : scales) {
                    if (s.isPrimary)
                        return s;
                }
            return null;
        }
    }

    public static class Uploads {
        private static final String API_ID = "id";
        private static final String API_NAME = "name";

        @SerializedName(API_ID)
        public int id;
        @SerializedName(API_NAME)
        public String name;
    }
}


text:
package org.innovateuk.ifs.fundingdecision.transactional;

import org.innovateuk.ifs.application.resource.Decision;
import org.innovateuk.ifs.application.resource.FundingNotificationResource;
import org.innovateuk.ifs.commons.security.SecuredBySpring;
import org.innovateuk.ifs.commons.service.ServiceResult;
import org.springframework.security.access.prepost.PreAuthorize;

/**
 * Transactional and secure service for making the decision of what applications to fund for a given competition.
 */
public interface ApplicationFundingNotificationBulkService {

	@PreAuthorize("hasAnyAuthority('comp_admin' , 'project_finance')")
	@SecuredBySpring(value = "SEND_FUNDING_DECISION_EMAILS", securedType = Decision.class, description = "Comp Admins should be able to send emails to Lead Applicants confirming the Funding Panel's decisions on their Applications")
	ServiceResult<Void> sendBulkFundingNotifications(FundingNotificationResource fundingNotificationResource);
}


text:
<?php

Class delete_taskController Extends baseController {

public function index() {
    if (isset($_SESSION['user'])) {
        $user = new User($this->registry->db, $_SESSION['user']);
    } else {
        header("Location: login");
        exit();
    }

    $this->registry->template->error = '';

    if (isset($_GET['id']) && !empty($_GET['id'])) {

        $task = Task::getTaskById($this->registry->db, $_GET['id']);
        if (Project::getProjectByID($this->registry->db, $task->project)->portal != $user->getPortal()) {
            header("Location: 404");
            exit();
        }

            $task = Task::getTaskByIdAndPortal($this->registry->db, $_GET['id'], $user->getPortal());
            $this->registry->template->task = $task;

                if (isset($_GET['delete-task'])) {
                    Task::deleteTaskById($this->registry->db, $_GET['id']);
                        header("Location: board");
                        exit();
                    }

        } else {
            $this->registry->template->error = "
That task doesn't exist.
";
        }

        $this->registry->template->userImage = $user->getImage();
        $this->registry->template->userImageThumb = 'thumb_' . $user->getImage();
        $this->registry->template->user = $user->getFirstName() . ' ' . $user->getLastName();
    /*** set a template variable ***/
        $this->registry->template->title = 'Delete task "' . $task->title . '"?';
    /*** load the register template ***/
        $this->registry->template->show('delete-task');
}

}

?>


text:
#ifndef MALIIT_KEYBOARD_TEXTEDITOR_H
#define MALIIT_KEYBOARD_TEXTEDITOR_H

#include "models/key.h"
#include "models/wordcandidate.h"
#include "models/text.h"
#include "logic/abstractwordengine.h"
#include "logic/abstractlanguagefeatures.h"

#include <QtCore>
#include <QtGui/QKeyEvent>

namespace MaliitKeyboard {

struct EditorOptions
{
    EditorOptions();
    // all delays are in milliseconds
    int backspace_auto_repeat_delay; // delay before first automatically repeated key
    int backspace_auto_repeat_interval; // interval between automatically repeated keys
};

class AbstractTextEditorPrivate;

class AbstractTextEditor
    : public QObject
{
    Q_OBJECT
    Q_DISABLE_COPY(AbstractTextEditor)
    Q_DECLARE_PRIVATE(AbstractTextEditor)
    Q_PROPERTY(bool preeditEnabled READ isPreeditEnabled
                                   WRITE setPreeditEnabled
                                   NOTIFY preeditEnabledChanged)
    Q_PROPERTY(bool autoCorrectEnabled READ isAutoCorrectEnabled
                                       WRITE setAutoCorrectEnabled
                                       NOTIFY autoCorrectEnabledChanged)
    Q_PROPERTY(bool autoCapsEnabled READ isAutoCapsEnabled
                                    WRITE setAutoCapsEnabled
                                    NOTIFY autoCapsEnabledChanged)

public:
    struct Replacement
    {
        Replacement()
            : start(0)
            , length(0)
            , cursor_position(-1)
        {}

        Replacement(int position)
            : start(0)
            , length(0)
            , cursor_position(position)
        {}

        Replacement(int r_start,
                    int r_length,
                    int position)
            : start(r_start)
            , length(r_length)
            , cursor_position(position)
        {}

        int start;
        int length;
        int cursor_position;
    };

    explicit AbstractTextEditor(const EditorOptions &options,
                                Model::Text *text,
                                Logic::AbstractWordEngine *word_engine,
                                Logic::AbstractLanguageFeatures *language_features,
                                QObject *parent = 0);
    virtual ~AbstractTextEditor() = 0;

    Model::Text * text() const;
    Logic::AbstractWordEngine * wordEngine() const;
    Logic::AbstractLanguageFeatures * languageFeatures() const;

    Q_SLOT void onKeyPressed(const Key &key);
    Q_SLOT void onKeyReleased(const Key &key);
    Q_SLOT void onKeyEntered(const Key &key);
    Q_SLOT void onKeyExited(const Key &key);
    Q_SLOT void onCursorPositionChanged(int cursor_position,
                                        const QString &surrounding_text);
    Q_SLOT void replacePreedit(const QString &replacement);
    Q_SLOT void replaceAndCommitPreedit(const QString &replacement);
    Q_SLOT void clearPreedit();

    bool isPreeditEnabled() const;
    Q_SLOT void setPreeditEnabled(bool enabled);
    Q_SIGNAL void preeditEnabledChanged(bool enabled);

    bool isAutoCorrectEnabled() const;
    Q_SLOT void setAutoCorrectEnabled(bool enabled);
    Q_SIGNAL void autoCorrectEnabledChanged(bool enabled);

    bool isAutoCapsEnabled() const;
    Q_SLOT void setAutoCapsEnabled(bool enabled);
    Q_SIGNAL void autoCapsEnabledChanged(bool enabled);

    Q_SIGNAL void keyboardClosed();
    Q_SIGNAL void leftLayoutSelected();
    Q_SIGNAL void rightLayoutSelected();
    Q_SIGNAL void wordCandidatesChanged(const WordCandidateList &word_candidates);
    Q_SIGNAL void autoCapsActivated();

    Q_SLOT void showUserCandidate();
    Q_SLOT void addToUserDictionary(const QString &word);

private:
    const QScopedPointer<AbstractTextEditorPrivate> d_ptr;

    void sendPreeditString(const QString &preedit,
                           Model::Text::PreeditFace face);

    virtual void sendPreeditString(const QString &preedit,
                                   Model::Text::PreeditFace face,
                                   const Replacement &replacement) = 0;
    virtual void sendCommitString(const QString &commit) = 0;
    virtual void sendKeyEvent(const QKeyEvent &ev) = 0;
    virtual void invokeAction(const QString &action, const QKeySequence &sequence) = 0;

    void commitPreedit();
    Q_SLOT void autoRepeatBackspace();
};

} // namespace MaliitKeyboard

#endif // MALIIT_KEYBOARD_ABSTRACTTEXTEDITOR_H


text:
.toolbar-container {
   background-color: #333;
   color: #bcbcbc;
   text-shadow: 0 -1px 0 #000;
   border-top: 1px solid #4f4f4f;
}

.toolbar-container .btn {
   background-color: #fafafa;
   background-image: -webkit-linear-gradient(top,#fff,#f2f2f2);
   background-image: -moz-linear-gradient(top,#fff,#f2f2f2);
   background-image: linear-gradient(top,#fff,#f2f2f2);
   background-repeat: repeat-x;
   border: 1px solid #d4d4d4;
   color: #333;
   text-shadow: none;
   border-top: none;
}

.toolbar-container label,
.toolbar-container output {
   font-size: .8em;
}

.toolbar-container label {
   margin-left: 10px;
}

.toolbar-container input[type="range"] {
   width: 80px;
   text-shadow: 0 -1px 0 #000;
   color: #ddd;
   box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1),0px 0 0 1px rgba(255,255,255,0.1);
   border: 1px solid black;
   background: transparent;
   height: 1px;
   vertical-align: middle;
}

.toolbar-container .panel {
    width: 40px;
    display: inline-block;
    text-align: center;
    font-size: .8em;
}

@media screen and (min-width:0\0) {
    /* IE9 & IE10 */
    .toolbar-container input[type="range"] {
	height: 20px;
	text-align: right;
    }

    #output-gridsize {
	display: none;
    }
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE10 only */
    .toolbar-container input[type="range"] {
	height: 5px;
	border-style: hidden;
	box-shadow: none;
	position: absolute;
    }

    #output-gridsize {
	margin-left: 90px;
	display: inline;
    }

    .toolbar-container input[type="range"]::-ms-fill-lower {
	background-color: lightgray;
    }

    .toolbar-container input[type="range"]::-ms-fill-upper {
	background-color: white;
    }

    .toolbar-container input[type="range"]::-ms-track {
	color: transparent;
    }

    .toolbar-container input[type="range"]::-ms-thumb {
	background-color:  #242424;
	border-style: hidden;
    }

    .toolbar-container input[type="range"]::-ms-tooltip {
	display: none;
    }
}


text:
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".support.MainActivity"
        tools:ignore="MissingPrefix"
        android:padding="16dp">

    <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">

        <TextView
                android:id="@+id/activity_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:textSize="20sp"
                tools:text="title"
                binding="{ Text @= ListViewActivityTitle }"/>

        <Button
                android:id="@+id/open_main_activity_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_below="@+id/activity_title"
                android:textSize="16sp"
                android:layout_margin="16dp"
                tools:text="open main activity"
                binding="{ Text @= OpenMainActivityText }; { Click @- OpenMainActivity }"/>

        <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerview_staggered"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/open_main_activity_button"
                android:nestedScrollingEnabled="false"
                layoutManager="staggered"
                layoutManagerOrientation="vertical"
                layoutManagerSpanCount="2"
                binding="{ItemsSource @= ExampleListStaggered}; {TemplatesForObjects @- StaggeredTemplatesForObjects}; {OnItemClickListener @- OnItemClickListenerView}"/>

    </RelativeLayout>

</ScrollView>


text:
using System.Collections.Generic;

namespace IdentityModel.Client;

/// <summary>
/// Request for token using refresh_token
/// </summary>
/// <seealso cref="TokenRequest" />
public class RefreshTokenRequest : TokenRequest
{
    /// <summary>
    /// Gets or sets the refresh token.
    /// </summary>
    /// <value>
    /// The refresh token.
    /// </value>
    public string RefreshToken { get; set; } = default!;

    /// <summary>
    /// Space separated list of the requested scopes.  The Scope attribute cannot be used to extend the scopes granted by the resource owner
    /// </summary>
    /// <remarks>
    /// See https://datatracker.ietf.org/doc/html/rfc6749#section-6 for further detail on restrictions
    /// </remarks>
    /// <value>
    /// The scope.
    /// </value>
    public string? Scope { get; set; }

    /// <summary>
    /// List of requested resources
    /// </summary>
    /// <value>
    /// The resources.
    /// </value>
    public ICollection<string> Resource { get; set; } = new HashSet<string>();
}


text:
@import UIKit;

FOUNDATION_EXPORT double UIWebViewCommonMarkVersionNumber;
FOUNDATION_EXPORT const unsigned char UIWebViewCommonMarkVersionString[];

#import <UIWebViewCommonMark/UIWebView+CommonMark.h>


text:
"""
A simple turing machine simulator for ECS631U - Computability module on QMUL.

Input file defininiton on the file input-format.md
"""

import argparse
import csv
import sys

class TuringMachine(object):
    """ Turing Machine Class """
    def __init__(self, tm_def, start, tape):
        self.head = 0
        self.tape = tape
        self.state = start
        self.definition = tm_def

    def __str__(self):
        string = 'state: ' + self.state + '\n'
        string = string + 'tape: ' + self.tape_string() + '\n'
        string = string + '      ' + self.head_string() + '\n'
        string = string + 'seq: ' + self.computed_sequence() + '\n'
        return string

    def tape_string(self):
        """ Convert list of chars to a string """
        string = ''
        for cur in self.tape:
            string = string + cur
        return string

    def head_string(self):
        """ Create a string in which the '^' will mark the machine's head
        position when printed below the tape string """
        string = ''
        for _ in range(self.head):
            string = string + ' '
        string = string + '^'
        return string

    def exec_step(self):
        """ Execute a step on the Turing Machine """
        sym = self.tape[self.head]

        # Get operation and next state from machine definition
        ops = self.definition.get((self.state, sym))
        if ops is None:
            print('No operation defined! Circular Machine', file=sys.stderr)
            sys.exit(1)

        if args.verbose:
            print('operations: ' + ops[0])
        # There may be multiple operations separated by comma
        for cur in ops[0].split(','):
            if args.verbose:
                print('current operation: ' + cur)
            # Check which operation (also check for 'no operation' - empty
            # string)
            if cur == '':
                continue
            elif cur == 'L':
                # Check if going out of the tape
                if self.head == 0:
                    print('L op when head position is 0', file=sys.stderr)
                    sys.exit(1)
                # Move head left
                self.head = self.head - 1
            elif cur == 'R':
                # Check if tape needs to be increased
                if len(self.tape) == self.head + 1:
                    self.tape.append('-')
                # Move head right
                self.head = self.head + 1
            elif cur == 'E':
                # Erase
                self.tape[self.head] = '-'
            elif cur[0] == 'P':
                # Print
                self.tape[self.head] = cur[1]
            else:
                # Something wrong!
                print('undefined operation', file=sys.stderr)
                sys.exit(1)

        # Update state
        self.state = ops[1]

    def computed_sequence(self):
        """ Generate the computed sequence of a Turing Machine """
        seq = ''
        for i in [elem for elem in self.tape if elem == '0' or elem == '1']:
            seq = seq + i
        return seq

def main():
    """ Script starting point """

    # Read Turing Machine definition
    tm_file = csv.reader(open(args.tm, 'r'), delimiter=';')

    tm_def = dict()
    for line_aux in tm_file:
        # Remove all spaces from strings
        line = [s.replace(' ', '') for s in line_aux]

        st_config = line[0]
        syms = line[1].split(',')
        ops = line[2]
        fn_config = line[3]

        # Build a dictionary
        for sym in syms:
            tm_def[(st_config, sym)] = (ops, fn_config)

    if args.verbose:
        for k in tm_def.keys():
            print(k, tm_def[k])

    # Start Turing Machine
    # For now, convention is to start at state 'b' with tape containg "e" at
    # initial position
    mach = TuringMachine(tm_def, args.start_state, ['e'])

    print('Starting turing machine execution')
    print('type \'stop\' to stop or press enter for next step')
    print(mach)

    # Execution cycle
    while input() != 'stop':
        mach.exec_step()
        print(mach)

# Create argument parser
parser = argparse.ArgumentParser(description='Simple turing machine simulator\
                                 for Turings own machine definition.')
# parser.add_argument('-t', '--tape', default=['e']) # TODO
parser.add_argument('-s', '--start-state', default='b')
parser.add_argument('-v', '--verbose', action='store_const', const=True,
                    default=False)
parser.add_argument('tm')

args = parser.parse_args()

# Check if is running as script
if __name__ == '__main__':
    main()


text:
package org.antlr.intellij.plugin.configdialogs;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class ANTLRv4GrammarPropertiesTest {

    private static final String QUAL_FILE_NAME = "file";
    private static final String FILE_VALUE = "fileValue";
    private static final String PROJECT_VALUE = "projectValue";
    private static final String DEFAULT_VALUE = "";

    private ANTLRv4GrammarPropertiesStore propertiesStore;

    @Before
    public void setUp() {
        propertiesStore = new ANTLRv4GrammarPropertiesStore();
    }

    @Test
    public void shouldGetPropertyFromFileSettingsWhenDefined() {
        // given:
        ANTLRv4GrammarProperties fileProps = new ANTLRv4GrammarProperties();
        fileProps.fileName = QUAL_FILE_NAME;
        fileProps.language = FILE_VALUE;
        propertiesStore.add(fileProps);

        ANTLRv4GrammarProperties projectProps = new ANTLRv4GrammarProperties();
        projectProps.fileName = "*";
        projectProps.language = PROJECT_VALUE;
        propertiesStore.add(projectProps);

        // when:
        String propertyValueForFile = propertiesStore.getGrammarProperties(QUAL_FILE_NAME).getLanguage();

        // then:
        Assert.assertEquals(FILE_VALUE, propertyValueForFile);
    }

    @Test
    public void shouldGetPropertyProjectSettingsValueWhenNotSetForFile() {
        // given:
        ANTLRv4GrammarProperties projectProps = new ANTLRv4GrammarProperties();
        projectProps.fileName = "*";
        projectProps.language = PROJECT_VALUE;
        propertiesStore.add(projectProps);

        // when:
        String propertyValueForFile = propertiesStore.getGrammarProperties(QUAL_FILE_NAME).getLanguage();

        // then:
        Assert.assertEquals(PROJECT_VALUE, propertyValueForFile);
    }

    @Test
    public void shouldGetPropertyDefaultValueWhenNotSetForFileNorProject() {
        // when:
        String propertyValueForFile = propertiesStore.getGrammarProperties(QUAL_FILE_NAME).getLanguage();

        // then:
        Assert.assertEquals(DEFAULT_VALUE, propertyValueForFile);
    }

}


text:
package org.apache.beam.runners.dataflow.worker;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem;

import com.google.auto.service.AutoService;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import org.apache.beam.runners.core.metrics.ExecutionStateTracker;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests for ContextActivationObserverRegistry. */
@RunWith(JUnit4.class)
public class ContextActivationObserverRegistryTest {

  /** This type is used for testing the automatic registration mechanism. */
  private static class AutoRegistrationClass implements ContextActivationObserver {
    @Override
    public void close() throws IOException {}

    @Override
    public Closeable activate(ExecutionStateTracker e) {
      return this;
    }
  }

  /**
   * A {@link ContextActivationObserver.Registrar} to demonstrate default {@link
   * ContextActivationObserver} registration.
   */
  @AutoService(ContextActivationObserver.Registrar.class)
  public static class RegisteredTestContextActivationObserverRegistrar
      implements ContextActivationObserver.Registrar {

    @Override
    public boolean isEnabled() {
      return true;
    }

    @Override
    public ContextActivationObserver getContextActivationObserver() {
      return new AutoRegistrationClass();
    }
  }

  @Test
  public void testContextActivationObserverAll() throws Exception {
    ContextActivationObserverRegistry registry = ContextActivationObserverRegistry.createDefault();
    List<ContextActivationObserver> contextActivationObservers =
        registry.getContextActivationObservers();

    // Check that the registry contains AutoRegistrationClass.
    assertThat(contextActivationObservers, hasItem(instanceOf(AutoRegistrationClass.class)));
  }
}


text:
(function() {
  var MarkdownPreviewView, fs, renderer, url,
    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

  url = require('url');

  fs = require('fs-plus');

  MarkdownPreviewView = require('./markdown-preview-view');

  renderer = null;

  module.exports = {
    configDefaults: {
      breakOnSingleNewline: false,
      grammars: ['source.gfm', 'source.litcoffee', 'text.plain', 'text.plain.null-grammar']
    },
    activate: function() {
      atom.workspaceView.command('markdown-preview:toggle', (function(_this) {
        return function() {
          return _this.toggle();
        };
      })(this));
      atom.workspaceView.command('markdown-preview:copy-html', (function(_this) {
        return function() {
          return _this.copyHtml();
        };
      })(this));
      atom.workspaceView.command('markdown-preview:toggle-break-on-single-newline', function() {
        return atom.config.toggle('markdown-preview.breakOnSingleNewline');
      });
      return atom.workspace.registerOpener(function(uriToOpen) {
        var error, host, pathname, protocol, _ref;
        try {
          _ref = url.parse(uriToOpen), protocol = _ref.protocol, host = _ref.host, pathname = _ref.pathname;
        } catch (_error) {
          error = _error;
          return;
        }
        if (protocol !== 'markdown-preview:') {
          return;
        }
        try {
          if (pathname) {
            pathname = decodeURI(pathname);
          }
        } catch (_error) {
          error = _error;
          return;
        }
        if (host === 'editor') {
          return new MarkdownPreviewView({
            editorId: pathname.substring(1)
          });
        } else {
          return new MarkdownPreviewView({
            filePath: pathname
          });
        }
      });
    },
    toggle: function() {
      var editor, grammars, previewPane, previousActivePane, uri, _ref, _ref1;
      editor = atom.workspace.getActiveEditor();
      if (editor == null) {
        return;
      }
      grammars = (_ref = atom.config.get('markdown-preview.grammars')) != null ? _ref : [];
      if (_ref1 = editor.getGrammar().scopeName, __indexOf.call(grammars, _ref1) < 0) {
        return;
      }
      uri = "markdown-preview://editor/" + editor.id;
      previewPane = atom.workspace.paneForUri(uri);
      if (previewPane) {
        previewPane.destroyItem(previewPane.itemForUri(uri));
        return;
      }
      previousActivePane = atom.workspace.getActivePane();
      return atom.workspace.open(uri, {
        split: 'right',
        searchAllPanes: true
      }).done(function(markdownPreviewView) {
        if (markdownPreviewView instanceof MarkdownPreviewView) {
          markdownPreviewView.renderMarkdown();
          return previousActivePane.activate();
        }
      });
    },
    copyHtml: function() {
      var editor, text;
      editor = atom.workspace.getActiveEditor();
      if (editor == null) {
        return;
      }
      if (renderer == null) {
        renderer = require('./renderer');
      }
      text = editor.getSelectedText() || editor.getText();
      return renderer.toText(text, editor.getPath(), (function(_this) {
        return function(error, html) {
          if (error) {
            return console.warn('Copying Markdown as HTML failed', error);
          } else {
            return atom.clipboard.write(html);
          }
        };
      })(this));
    }
  };

}).call(this);


text:
'use strict';

const chai = require('chai');
const expect = chai.expect;

const SkipablePromise = require('../index');

describe('General usage:', function() {
	it('Skips an awaited long running promise', async function() {
		const longRunPromise = new Promise((resolve, reject) => {
			setTimeout(() => {
				resolve();
				expect(true).to.equal(false);
			}, 1500);
		});

		const skipable = SkipablePromise.create(longRunPromise);

		setTimeout(() => {
			skipable.skip();
		}, 500);

		await skipable.promise;
		expect(true).to.equal(true);
	});
});


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/rl_vertical_list_container"
                android:layout_width="match_parent"
                android:layout_height="48dp"
                android:background="@android:color/white">
    <View
        android:id="@+id/view_line"
        android:visibility="invisible"
        android:layout_width="3dp"
        android:layout_height="match_parent"/>

    <android.support.v7.widget.AppCompatTextView
        android:layout_centerInParent="true"
        android:layout_toRightOf="@id/view_line"
        android:id="@+id/tv_vertical_item_name"
        android:textColor="@android:color/black"
        android:layout_marginRight="8dp"
        android:layout_marginLeft="8dp"
        android:text="Suck it"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:ignore="HardcodedText,RtlHardcoded"/>

    <View
        android:background="#c9c9c9"
        android:layout_width="match_parent"
        android:layout_height="0.3dp"
        />

</RelativeLayout>


text:
package org.apache.causeway.commons.internal.base;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URI;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Scanner;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.springframework.lang.Nullable;

import org.apache.causeway.commons.internal._Constants;
import org.apache.causeway.commons.internal.base._Bytes.BytesOperator;
import org.apache.causeway.commons.internal.functions._Predicates;

import static org.apache.causeway.commons.internal.base._NullSafe.size;
import static org.apache.causeway.commons.internal.base._Strings_SplitIterator.splitIterator;
import static org.apache.causeway.commons.internal.base._With.mapIfPresentElse;
import static org.apache.causeway.commons.internal.base._With.requiresNotEmpty;
import static org.apache.causeway.commons.internal.functions._Predicates.not;

import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.val;

/**
 *
- internal use only -

 *

 * Provides String related algorithms.
 *

 * Keep the public methods simple, these are basic building blocks for more complex composites.
 * Composites are provided as static fields.
 *

 *

 * WARNING: Do NOT use any of the classes provided by this package!

 * These may be changed or removed without notice!
 *

 *
 * @since 2.0
 */
public final class _Strings {

    private _Strings() {}

    // -- CONSTANTS

    /**
     * Convenient e.g. for toArray conversions
     * (a duplicate of in {@link _Constants#emptyStringArray} )
     */
    public static final String[] emptyArray = new String[0];

    // -- PAIR OF STRINGS

    public static interface KeyValuePair extends Map.Entry<String, String> {
    }

    public static KeyValuePair pair(final String key, final String value){
        return _Strings_KeyValuePair.of(key, value);
    }

    /**
     * Parses a string assumed to be of the form key[separator]value into its parts.
     * @param keyValueLiteral
     * @param separator
     * @return a non-empty Optional, if (and only if) the {@code keyValueLiteral}
     * does contain at least one {@code separator}
     */
    public static Optional<KeyValuePair> parseKeyValuePair(final @Nullable String keyValueLiteral, final char separator) {
        return _Strings_KeyValuePair.parse(keyValueLiteral, separator);
    }

    // -- FILLING

    public static String of(final int length, final char c) {
        if(length<=0) {
            return "";
        }
        final char[] chars = new char[length];
        Arrays.fill(chars, c);
        return String.valueOf(chars);
    }

    // -- COMPARE

    /**
     * Compares two strings lexicographically (and nulls-frist).
     * @apiNote consider using {@link Comparator#naturalOrder()} combined with
     * {@link Comparator#nullsFirst(Comparator)}.
     * @implNote this utility method does not produce objects on the heap
     * @param a
     * @param b
     * @return {@code -1} if {@code a  b} else {@code 0}
     * @see String#compareTo(String)
     */
    public static int compareNullsFirst(final @Nullable String a, final @Nullable String b) {
        if(Objects.equals(a, b)) {
            return 0;
        }
        // at this point not both can be null, so which ever is null wins
        if(a==null) {
            return -1;
        }
        if(b==null) {
            return 1;
        }
        // at this point neither can be null
        return a.compareTo(b);
    }

    /**
     * Compares two strings lexicographically (and nulls-last).
     * @apiNote consider using {@link Comparator#naturalOrder()} combined with
     * {@link Comparator#nullsFirst(Comparator)}.
     * @implNote this utility method does not produce objects on the heap
     * @param a
     * @param b
     * @return {@code -1} if {@code a  b} else {@code 0}
     * @see String#compareTo(String)
     */
    public static int compareNullsLast(final @Nullable String a, final @Nullable String b) {
        if(Objects.equals(a, b)) {
            return 0;
        }
        // at this point not both can be null, so which ever is null wins
        if(a==null) {
            return 1;
        }
        if(b==null) {
            return -1;
        }
        // at this point neither can be null
        return a.compareTo(b);
    }

    // -- BASIC PREDICATES

    /**
     * Same as {@link #isNullOrEmpty(CharSequence)}
     * @param x
     * @return true only if string is of zero length or null.
     */
    public static boolean isEmpty(final @Nullable CharSequence x){
        return x==null || x.length()==0;
    }
    /**
     * Same as {@link #isEmpty(CharSequence)}
     * @param x
     * @return true only if string is of zero length or null.
     */
    public static boolean isNullOrEmpty(final @Nullable CharSequence x){
        return x==null || x.length()==0;
    }

    /**
     *
     * @param x
     * @return inverse of isEmpty(CharSequence).
     */
    public static boolean isNotEmpty(final @Nullable CharSequence x){
        return x!=null && x.length()!=0;
    }

    // -- OPTIONAL

    /**
     * @param x - input string
     * @return optionally the input string based on whether the input is not empty
     */
    public static Optional<String> nonEmpty(final @Nullable CharSequence x) {
        return isEmpty(x) ? Optional.empty() : Optional.of(x.toString());
    }

    // -- BASIC UNARY OPERATORS

    /**
     * @param input
     * @return null if the {@code input} is null or empty, the {@code input} otherwise
     */
    public static @Nullable String emptyToNull(final @Nullable String input) {
        if(isEmpty(input)) {
            return null;
        }
        return input;
    }

    /**
     * @param input
     * @return null if the {@code input} is null or blank, the trimmed {@code input} otherwise
     */
    public static @Nullable String blankToNullOrTrim(final @Nullable String input) {
        if(isEmpty(input)) {
            return null;
        }
        return input.isBlank()
                ? null
                : input.trim();
    }

    /**
     * @param input
     * @return the empty string if the {@code input} is null, the {@code input} otherwise
     */
    public static String nullToEmpty(final @Nullable String input) {
        if(input==null) {
            return "";
        }
        return input;
    }

    /**
     * Trims the input.
     * @param input
     * @return null if the {@code input} is null
     */
    public static String trim(final @Nullable String input) {
        return mapIfPresentElse(input, String::trim, null);
    }

    /**
     * Converts all of the characters in {@code input} to lower case using the rules of the default locale.
     * @param input
     * @return null if {@code input} is null
     */
    public static String lower(final @Nullable String input) {
        return mapIfPresentElse(input, String::toLowerCase, null);
    }

    /**
     * Converts all of the characters in {@code input} to upper case using the rules of the default locale.
     * @param input
     * @return null if {@code input} is null
     */
    public static String upper(final @Nullable String input) {
        return mapIfPresentElse(input, String::toUpperCase, null);
    }

    /**
     * Converts the first character in {@code input} to upper case using the rules of the default locale.
     * @param input
     * @return null if {@code input} is null
     */
    public static @Nullable String capitalize(final @Nullable String input) {
        if(input==null) {
            return null;
        }
        if (input.length() == 0) {
            return input;
        }
        if (input.length() == 1) {
            return input.toUpperCase();
        }
        return Character.toUpperCase(input.charAt(0)) + input.substring(1);
    }

    /**
     * Converts the first character in {@code input} to lower case using the rules of the default locale.
     * @param input
     * @return null if {@code input} is null
     */
    public static @Nullable String decapitalize(final @Nullable String input) {
        if(input==null) {
            return null;
        }
        if (input.length() == 0) {
            return input;
        }
        if (input.length() == 1) {
            return input.toLowerCase();
        }
        return Character.toLowerCase(input.charAt(0)) + input.substring(1);
    }

    // -- SPECIAL UNARY OPERATORS

    public static @Nullable String htmlEscape(final @Nullable String source) {
        return _Strings_HtmlEscaper.htmlEscape(source);
    }

    // -- URL-SAFETY

    /**
     * @see "https://stackoverflow.com/a/4571518/9269480"
     */
    public static boolean isUrlSafe(final @Nullable String input) {
        if(_Strings.isEmpty(input)) {
            return true;
        }
        try {
            val testDummyUri = new URI("http://localhost/?" + input);
            val asQuery = testDummyUri.getQuery();
            return input.equals(asQuery);
        } catch (Exception e) {
            // ignore
        }
        return false;
    }

    // -- PREFIX/SUFFIX

    /**
     * If {@code input} does not start with {@code prefix} prepends {@code prefix} to the input.
     * @param input
     * @param prefix
     * @return null if {@code input} is null
     */
    public static @Nullable String prefix(final @Nullable String input, final @NonNull String prefix) {
        if(input==null) {
            return null;
        }
        if(input.startsWith(prefix)) {
            return input;
        }
        return prefix + input;
    }

    /**
     * If {@code input} does not end with {@code suffix} appends {@code suffix} to the input.
     * @param input
     * @param suffix
     * @return null if {@code input} is null
     */
    public static @Nullable String suffix(final @Nullable String input, final @NonNull String suffix) {
        if(input==null) {
            return null;
        }
        if(input.endsWith(suffix)) {
            return input;
        }
        return input + suffix;
    }

    // -- REDUCTION (BINARY OPERATIOR)

    /**
     * Combines 2 strings {@code left} and {@code right} into a single string, such that left
     * and right are delimited by the {@code delimiter} and such that
     * the result does not introduce a sequence of delimiters, like for example when building file-system
     * paths from chunks.
     *
     * @param left
     * @param right
     * @param delimiter
     * @return non-null
     */
    public static String combineWithDelimiter(
            final @Nullable String left, final @Nullable String right, final String delimiter) {

        requiresNotEmpty(delimiter, "pathDelimiter");

        if (isNullOrEmpty(left) && isNullOrEmpty(right)) {
            return "";
        }
        if (isNullOrEmpty(left)) {
            return right;
        }
        if (isNullOrEmpty(right)) {
            return left;
        }
        if (left.endsWith(delimiter) || right.startsWith(delimiter)) {
            return left + right;
        }
        return left + delimiter + right;
    }

    // -- PADDING

    /**
     * Returns a string, of length at least minLength, consisting of string prepended with as many copies
     * of padChar as are necessary to reach that length.
     * @param str
     * @param minLength
     * @param c
     */
    public static String padStart(final @Nullable String str, final int minLength, final char c) {
        if(minLength<=0) {
            return str;
        }
        final int len = size(str);
        if(len>=minLength) {
            return str;
        }

        final int fillCount = minLength - len;

        return of(fillCount, c) + nullToEmpty(str);
    }

    /**
     * Returns a string, of length at least minLength, consisting of string appended with as many copies
     * of padChar as are necessary to reach that length.
     * @param str
     * @param minLength
     * @param c
     */
    public static String padEnd(final @Nullable String str, final int minLength, final char c) {
        if(minLength<=0) {
            return str;
        }
        final int len = size(str);
        if(len>=minLength) {
            return str;
        }

        final int fillCount = minLength - len;

        return nullToEmpty(str) + of(fillCount, c);
    }

    /**
     * Returns a string that is a substring of given {@code str}.
     * The substring begins at the specified beginIndex and extends to the character at index endIndex - 1.
     * Thus the length of the substring is endIndex-beginIndex.
     *

     * Supports negative {@code endIndex}, as well as index overflow.
     * If the endIndex is negative, it is understood as being relative to the end of the given {@code str}.
     */
    public static String substring(final @Nullable String str, final int beginIndex, final int endIndex) {
        if(isEmpty(str)) {
            return str;
        }
        final int maxIndex = str.length()-1; // >= 0

        final int i0 = beginIndex>0
                ? Math.min(beginIndex, maxIndex)
                : 0;

        final int i1 = Math.min(
                maxIndex+1,
                endIndex<0
                    ? str.length() + endIndex
                    : endIndex
                );

        return i0<i1
                ? str.substring(i0, i1)
                : "";
    }

    // -- SPLITTING

    /**
     * Splits the {@code input} into chunks separated by {@code separator},
     * then puts all chunks on the returned stream.
     *

     * Corner cases:
     *

     *
{@code input} starts with {@code separator}: an empty string is the first chunk put on the stream

     *
{@code input} ends with {@code separator}: an empty string is the last chunk put on the stream

     *
a {@code separator} is followed by another: an empty string is put on the stream

     *

     * @param input
     * @param separator non-empty string
     * @return empty stream if {@code input} is null
     * @throws IllegalArgumentException if {@code separator} is empty
     */
    public static Stream<String> splitThenStream(final @Nullable String input, final String separator) {
        if(isEmpty(separator)) {
            throw new IllegalArgumentException("a non empty separator is required");
        }
        if(isEmpty(input)) {
            return Stream.of();
        }
        if(!input.contains(separator)) {
            return Stream.of(input);
        }

        return StreamSupport.stream(
                Spliterators.spliteratorUnknownSize(splitIterator(input, separator), Spliterator.ORDERED),
                false); // not parallel
    }

    /**
     * Creates a stream from the given input sequence around matches of {@code delimiterPattern}.
     * @param input
     * @param delimiterPattern
     */
    public static Stream<String> splitThenStream(final @Nullable CharSequence input, final @NonNull Pattern delimiterPattern) {
        if(isEmpty(input)) {
            return Stream.of();
        }
        return delimiterPattern.splitAsStream(input);
    }

    /**
     * Optionally applies {@code onNonEmptySplit} function, based on whether both split parts
     * lhs and rhs are non empty Strings.
     * @param <T>
     * @param input
     * @param separator
     * @param onNonEmptySplit
     */
    public static <T> Optional<T> splitThenApplyRequireNonEmpty(
            final @Nullable String input,
            final String separator,
            final BiFunction<String, String, T> onNonEmptySplit) {

        if(isEmpty(input)) {
            return Optional.empty();
        }
        // we have a non-empty string
        final int p = input.indexOf(separator);
        if(p<1){
            // separator not found or
            // empty lhs in string
            return Optional.empty();
        }
        final int q = p + separator.length();
        if(q==input.length()) {
            // empty rhs
            return Optional.empty();
        }
        return Optional.ofNullable(onNonEmptySplit.apply(input.substring(0, p), input.substring(q)));
    }

    public static void splitThenAccept(
            final @Nullable String input,
            final String separator,
            final BiConsumer<String, String> onNonEmptySplit,
            final Consumer<String> onNonEmptyLhs,
            final Consumer<String> onNonEmptyRhs) {

        _Strings_FastSplit.splitThenAccept(input, separator, onNonEmptySplit, onNonEmptyLhs, onNonEmptyRhs);
    }

    public static void splitThenAcceptEmptyAsNull(
            final @Nullable String input,
            final String separator,
            final BiConsumer<String, String> onSplit) {

        _Strings_FastSplit.splitThenAccept(input, separator, onSplit,
                lhs->onSplit.accept(lhs, null),
                rhs->onSplit.accept(null, rhs));
    }

    public static Stream<String> grep(final @Nullable String input, @Nullable Predicate<String> matcher){
        matcher = matcher!=null ? matcher : _Predicates.alwaysTrue();
        return splitThenStream(input, "\n")
                .filter(_Strings::isNotEmpty)
                .filter(matcher)
                .map(s->s.replace("\r", ""));
    }

    public static Stream<String> grep(final @Nullable String input, final @Nullable String contains){
        final Predicate<String> matcher = contains!=null ? line->line.contains(contains) : _Predicates.alwaysTrue();
        return grep(input, matcher);
    }

    // -- REPLACEMENT OPERATORS

    /**
     * Condenses any whitespace to the given {@code replacement}
     *
     * @param input
     * @param replacement
     * @return null if {@code input} is null
     */
    public static String condenseWhitespaces(final @Nullable String input, final @NonNull String replacement) {
        return mapIfPresentElse(input, __->input.replaceAll("\\s+", replacement), null);
    }

    /**
     * ...xyz
     * @param input
     * @param maxLength
     * @param ellipsis
     * @return (non-null), ellipsified version of {@code input}, if {@code input} exceeds length {@code maxLength}
     */
    public static String ellipsifyAtStart(
            final @Nullable CharSequence input,
            final int maxLength,
            final @NonNull CharSequence ellipsis) {

        if(input==null) {
            return "";
        }
        if(input.length()<=maxLength) {
            return input.toString();
        }
        final int trimmedLength = maxLength - ellipsis.length();
        final int end = input.length();
        final int start = end - trimmedLength;
        return String.join("", ellipsis, input.subSequence(start, end));
    }

    /**
     * abc...
     * @param input
     * @param maxLength
     * @param ellipsis
     * @return (non-null), ellipsified version of {@code input}, if {@code input} exceeds length {@code maxLength}
     */
    public static String ellipsifyAtEnd(
            final @Nullable CharSequence input,
            final int maxLength,
            final @NonNull CharSequence ellipsis) {

        if(input==null) {
            return "";
        }
        if(input.length()<=maxLength) {
            return input.toString();
        }
        final int trimmedLength = maxLength - ellipsis.length();
        return String.join("", input.subSequence(0, trimmedLength), ellipsis);
    }

    // -- READ FROM INPUT STREAM

    public static String read(final @Nullable InputStream input, final @NonNull Charset charset) {
        if(input==null) {
            return "";
        }
        // see https://stackoverflow.com/questions/309424/how-to-read-convert-an-inputstream-into-a-string-in-java
        try(Scanner scanner = new Scanner(input, charset.name())){
            scanner.useDelimiter("\\A");
            return scanner.hasNext() ? scanner.next() : "";
        }
    }

    @SneakyThrows
    public static String readFromResource(
            final @NonNull Class<?> resourceLocation,
            final @NonNull String resourceName,
            final @NonNull Charset charset) {
        try(InputStream input = resourceLocation.getResourceAsStream(resourceName)){
            return read(input, charset);
        }
    }

    // -- PRINTING

    /**
     * Returns the {@link String} as printed into by the given {@code printer}
     * @param printer - consumes the generated PrintStream to print to
     * @param charset
     * @see PrintStream
     * @see Charset
     */
    @SneakyThrows
    public static String print(
            final @NonNull Consumer<PrintStream> printer,
            final @NonNull Charset charset) {
        val baos = new ByteArrayOutputStream();
        try (PrintStream ps = new PrintStream(baos, true, charset)) {
            printer.accept(ps);
        }
        return baos.toString(charset);
    }

    /**
     * Shortcut to {@link #print(Consumer, Charset)} using {@code UTF8}.
     */
    public static String printUtf8(
            final @NonNull Consumer<PrintStream> printer) {
        return print(printer, StandardCharsets.UTF_8);
    }

    // -- BYTE ARRAY CONVERSION

    /**
     * Encodes {@code str} into a sequence of bytes using the given {@code charset}.
     * @param str
     * @param charset
     * @return null if {@code str} is null
     */
    public static final byte[] toBytes(final @Nullable String str, final @NonNull Charset charset) {
        return mapIfPresentElse(str, __->str.getBytes(charset), null);
    }

    /**
     * Constructs a new String by decoding the specified array of bytes using the specified {@code charset}.
     * @param bytes
     * @param charset
     * @return null if {@code bytes} is null
     */
    public static final String ofBytes(final @Nullable byte[] bytes, final @NonNull Charset charset) {
        return mapIfPresentElse(bytes, __->new String(bytes, charset), null);
    }

    /**
     * Converts the {@code input} to a byte array using the specified {@code charset},
     * then applies the byte manipulation operator {@code converter},
     * then converts the (manipulated) byte array back to a string, again using the specified {@code charset}.
     * @param input
     * @param converter
     * @param charset
     * @return null if {@code input} is null
     */
    public static final String convert(final @Nullable String input, final @NonNull BytesOperator converter, final @NonNull Charset charset) {
        return mapIfPresentElse(input, __->ofBytes(converter.apply(toBytes(input, charset)), charset), null);
    }

    // -- UNARY OPERATOR COMPOSITION

    /**
     * Monadic StringOperator that allows composition of unary string operators.
     */
    public static final class StringOperator {

        private final UnaryOperator<String> operator;

        private StringOperator(final @NonNull UnaryOperator<String> operator) {
            this.operator = operator;
        }

        public String apply(final String input) {
            return operator.apply(input);
        }

        public StringOperator andThen(final UnaryOperator<String> andThen) {
            return new StringOperator(s->andThen.apply(operator.apply(s)));
        }

    }

    /**
     * Returns a StringOperator that allows composition of unary string operators
     */
    public static StringOperator operator() {
        return new StringOperator(UnaryOperator.identity());
    }

    // -- SPECIAL COMPOSITES

    // using naming convention asXxx...

    public static final StringOperator asLowerDashed = operator()
            .andThen(_Strings::lower)
            .andThen(s->_Strings.condenseWhitespaces(s, "-"));

    public static final StringOperator asNormalized = operator()
            .andThen(s->_Strings.condenseWhitespaces(s, " "));

    public static final StringOperator asNaturalName2 = operator()
            .andThen(s->_Strings_NaturalNames.naturalName2(s, true));

    public static final String asFileNameWithExtension(final @NonNull String fileName, final @NonNull String fileExtension) {
        return suffix(fileName, prefix(fileExtension, "."));
    }

    /**
     * A prefix is defined
     * as the first set of lower-case letters and the name is characters from,
     * and including, the first upper case letter. If no upper case letter is
     * found then an empty string is returned.
     *

     * Calling this method with the following Java names will produce these
     * results:
     *

     * getCarRegistration  -> CarRegistration
     * CityMayor           -> CityMayor
     * isReady             -> Ready
     *

     */
    public static final String asPrefixDropped(final @Nullable String name) {
        return isNotEmpty(name)
                ? _Strings
                    .streamCharacters(name)
                    .dropWhile(c->c != '_' && Character.isLowerCase(c))
                    .collect(_Strings.joiningCharacters())
                : name;
    }

    // -- SHORTCUTS

    /**
     * Like {@link _Strings#splitThenStream(String, String)} but also trimming each junk, then discarding
     * empty chunks.
     * @return empty stream if {@code input} is null
     */
    public static Stream<String> splitThenStreamTrimmed(final @Nullable String input, final String separator) {
        return splitThenStream(input, separator)
                .map(String::trim)
                .filter(not(String::isEmpty));
    }

    /**
     * Like {@link _Strings#splitThenStream(CharSequence, Pattern)} but also trimming each junk,
     * then discarding empty chunks.
     * @return empty stream if {@code input} is null
     */
    public static Stream<String> splitThenStreamTrimmed(final @Nullable CharSequence input, final Pattern delimiterPattern) {
        return splitThenStream(input, delimiterPattern)
                .map(String::trim)
                .filter(not(String::isEmpty));
    }

    public static String base64UrlDecode(final @Nullable String str) {
        return _Strings.convert(str, _Bytes.ofUrlBase64, StandardCharsets.UTF_8);
    }

    public static String base64UrlEncode(final @Nullable String str) {
        return _Strings.convert(str, _Bytes.asUrlBase64, StandardCharsets.UTF_8);
    }

    // -- CHARACTER PROCESSING

    public static Stream<Character> streamCharacters(final @Nullable String str) {
        return isNotEmpty(str)
                ? str.codePoints().mapToObj(c -> (char) c)
                : Stream.empty();
    }

    public static Collector<Character, StringBuilder, String> joiningCharacters() {
        return Collector.of(
                StringBuilder::new,
                StringBuilder::append,
                StringBuilder::append,
                StringBuilder::toString);
    }

    // -- TRUNCATION

    public static String trimmed(final String str, final int lengthOfField) {
        if (str == null) {
            return null;
        }
        if (str.length() > lengthOfField) {
            return str.substring(0, lengthOfField - 3) + "...";
        }
        return str;
    }

    /**
     * for example, so that a DB type converter can return null if the string wouldn't fit into a target column.
     */
    public static String nullIfExceeds(final String str, final int maxLength) {
        return str == null || str.length() > maxLength
                    ? null
                    : str;
    }

}


text:
import sys
from xmlrpclib import ServerProxy

file_to_read = sys.argv[1]

s = ServerProxy('http://paste.openstack.org/xmlrpc/')
with open(file_to_read, 'r') as f:
    read_data = f.read()
    paste_id = s.pastes.newPaste('', read_data)
paste_url = "http://paste.openstack.org/show/" + str(paste_id)
print(paste_url)