text:
package influxql

import (
	"encoding/json"
	"errors"
	"fmt"

	"github.com/archsaber/influxdb/models"
)

const (
	// WarningLevel is the message level for a warning.
	WarningLevel = "warning"
)

// TagSet is a fundamental concept within the query system. It represents a composite series,
// composed of multiple individual series that share a set of tag attributes.
type TagSet struct {
	Tags       map[string]string
	Filters    []Expr
	SeriesKeys []string
	Key        []byte
}

// AddFilter adds a series-level filter to the Tagset.
func (t *TagSet) AddFilter(key string, filter Expr) {
	t.SeriesKeys = append(t.SeriesKeys, key)
	t.Filters = append(t.Filters, filter)
}

func (t *TagSet) Len() int           { return len(t.SeriesKeys) }
func (t *TagSet) Less(i, j int) bool { return t.SeriesKeys[i] < t.SeriesKeys[j] }
func (t *TagSet) Swap(i, j int) {
	t.SeriesKeys[i], t.SeriesKeys[j] = t.SeriesKeys[j], t.SeriesKeys[i]
	t.Filters[i], t.Filters[j] = t.Filters[j], t.Filters[i]
}

// Reverse reverses the order of series keys and filters in the TagSet.
func (t *TagSet) Reverse() {
	for i, j := 0, len(t.Filters)-1; i < j; i, j = i+1, j-1 {
		t.Filters[i], t.Filters[j] = t.Filters[j], t.Filters[i]
		t.SeriesKeys[i], t.SeriesKeys[j] = t.SeriesKeys[j], t.SeriesKeys[i]
	}
}

// Message represents a user-facing message to be included with the result.
type Message struct {
	Level string `json:"level"`
	Text  string `json:"text"`
}

// ReadOnlyWarning generates a warning message that tells the user the command
// they are using is being used for writing in a read only context.
//
// This is a temporary method while to be used while transitioning to read only
// operations for issue #6290.
func ReadOnlyWarning(stmt string) *Message {
	return &Message{
		Level: WarningLevel,
		Text:  fmt.Sprintf("deprecated use of '%s' in a read only context, please use a POST request instead", stmt),
	}
}

// Result represents a resultset returned from a single statement.
// Rows represents a list of rows that can be sorted consistently by name/tag.
type Result struct {
	// StatementID is just the statement's position in the query. It's used
	// to combine statement results if they're being buffered in memory.
	StatementID int
	Series      models.Rows
	Messages    []*Message
	Partial     bool
	Err         error
}

// MarshalJSON encodes the result into JSON.
func (r *Result) MarshalJSON() ([]byte, error) {
	// Define a struct that outputs "error" as a string.
	var o struct {
		StatementID int           `json:"statement_id"`
		Series      []*models.Row `json:"series,omitempty"`
		Messages    []*Message    `json:"messages,omitempty"`
		Partial     bool          `json:"partial,omitempty"`
		Err         string        `json:"error,omitempty"`
	}

	// Copy fields to output struct.
	o.StatementID = r.StatementID
	o.Series = r.Series
	o.Messages = r.Messages
	o.Partial = r.Partial
	if r.Err != nil {
		o.Err = r.Err.Error()
	}

	return json.Marshal(&o)
}

// UnmarshalJSON decodes the data into the Result struct
func (r *Result) UnmarshalJSON(b []byte) error {
	var o struct {
		StatementID int           `json:"statement_id"`
		Series      []*models.Row `json:"series,omitempty"`
		Messages    []*Message    `json:"messages,omitempty"`
		Partial     bool          `json:"partial,omitempty"`
		Err         string        `json:"error,omitempty"`
	}

	err := json.Unmarshal(b, &o)
	if err != nil {
		return err
	}
	r.StatementID = o.StatementID
	r.Series = o.Series
	r.Messages = o.Messages
	r.Partial = o.Partial
	if o.Err != "" {
		r.Err = errors.New(o.Err)
	}
	return nil
}


text:
package org.apereo.cas.oidc.services;

import org.apereo.cas.oidc.OidcConstants;
import org.apereo.cas.oidc.claims.BaseOidcScopeAttributeReleasePolicy;
import org.apereo.cas.oidc.claims.OidcRegisteredServiceAttributeReleasePolicy;
import org.apereo.cas.oidc.scopes.OidcAttributeReleasePolicyFactory;
import org.apereo.cas.services.ChainingAttributeReleasePolicy;
import org.apereo.cas.services.DenyAllAttributeReleasePolicy;
import org.apereo.cas.services.OidcRegisteredService;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.RegisteredServiceAttributeReleasePolicy;
import org.apereo.cas.services.RegisteredServiceChainingAttributeReleasePolicy;
import org.apereo.cas.services.ServiceRegistryListener;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * This is {@link OidcServiceRegistryListener}.
 *
 * @author Misagh Moayyed
 * @since 6.1.0
 */
@Slf4j
@RequiredArgsConstructor
public class OidcServiceRegistryListener implements ServiceRegistryListener {
    @Serial
    private static final long serialVersionUID = -2492163812728091841L;

    private final OidcAttributeReleasePolicyFactory attributeReleasePolicyFactory;

    private static void addAttributeReleasePolicy(
        final RegisteredServiceChainingAttributeReleasePolicy chain,
        final BaseOidcScopeAttributeReleasePolicy policyToAdd,
        final String givenScope,
        final OidcRegisteredService registeredService) {
        LOGGER.debug("Mapped [{}] to attribute release policy [{}]",
            givenScope, policyToAdd.getClass().getSimpleName());

        val policy = registeredService.getAttributeReleasePolicy();
        val matchingPolicies = new ArrayList<RegisteredServiceAttributeReleasePolicy>();

        if (policy instanceof RegisteredServiceChainingAttributeReleasePolicy chainedPolicy) {
            matchingPolicies.addAll(chainedPolicy.getPolicies()
                .stream()
                .filter(p -> p instanceof OidcRegisteredServiceAttributeReleasePolicy)
                .map(OidcRegisteredServiceAttributeReleasePolicy.class::cast)
                .filter(p -> p.getScopeType().equalsIgnoreCase(givenScope)).toList());
        } else if (policy instanceof OidcRegisteredServiceAttributeReleasePolicy oidcPolicy) {
            if (oidcPolicy.getScopeType().equalsIgnoreCase(givenScope)) {
                matchingPolicies.add(oidcPolicy);
            }
        }

        if (matchingPolicies.isEmpty()) {
            policyToAdd.setConsentPolicy(policy.getConsentPolicy());
            policyToAdd.setPrincipalAttributesRepository(policy.getPrincipalAttributesRepository());
            chain.addPolicies(policyToAdd);
        } else {
            chain.addPolicies(matchingPolicies);
        }
    }

    @Override
    public RegisteredService postLoad(final RegisteredService registeredService) {
        if (registeredService instanceof OidcRegisteredService) {
            return reconcile((OidcRegisteredService) registeredService);
        }
        return registeredService;
    }

    protected RegisteredService reconcile(final OidcRegisteredService oidcService) {
        LOGGER.trace("Reconciling OpenId Connect scopes and claims for [{}]", oidcService.getServiceId());

        val definedServiceScopes = oidcService.getScopes();
        if (definedServiceScopes.isEmpty()) {
            LOGGER.trace("Registered service [{}] does not define any scopes to control attribute release policies. "
                         + "CAS will allow the existing attribute release policies assigned to the service to operate without a scope.",
                oidcService.getServiceId());
            return oidcService;
        }

        val userScopes = attributeReleasePolicyFactory.getUserDefinedScopes();
        val customClaims = new ArrayList<String>();
        val policyChain = new ChainingAttributeReleasePolicy();

        definedServiceScopes.forEach(givenScope -> {
            LOGGER.trace("Reviewing scope [{}] for [{}]", givenScope, oidcService.getServiceId());

            val userDefinedScope = Arrays.stream(OidcConstants.StandardScopes.values())
                .noneMatch(scope -> scope.getScope().trim().equalsIgnoreCase(givenScope.trim()));
            if (userDefinedScope) {
                LOGGER.debug("[{}] appears to be a user-defined scope and does not match any of the predefined standard scopes. "
                             + "Checking [{}] against user-defined scopes provided as [{}]", givenScope, givenScope, userScopes);
                userScopes
                    .stream()
                    .filter(t -> t.getScopeName().equals(givenScope.trim()))
                    .findFirst()
                    .ifPresentOrElse(
                        userPolicy -> addAttributeReleasePolicy(policyChain, userPolicy, givenScope, oidcService),
                        () -> customClaims.add(givenScope.trim()));
            } else {
                val scope = OidcConstants.StandardScopes.valueOf(givenScope.trim().toUpperCase());
                switch (scope) {
                    case EMAIL, ADDRESS, PROFILE, PHONE -> {
                        val policyToAdd = attributeReleasePolicyFactory.get(scope);
                        addAttributeReleasePolicy(policyChain, policyToAdd, givenScope, oidcService);
                    }
                    case OPENID -> LOGGER.debug("Scope [{}] is found for service [{}]", givenScope, oidcService.getId());
                    case OFFLINE_ACCESS -> {
                        LOGGER.debug("Given scope [{}], service [{}] is marked to generate refresh tokens", givenScope, oidcService.getId());
                        oidcService.setGenerateRefreshToken(true);
                    }
                }
            }
        });
        if (!customClaims.isEmpty()) {
            val userPolicy = attributeReleasePolicyFactory.custom(OidcConstants.CUSTOM_SCOPE_TYPE, customClaims);
            addAttributeReleasePolicy(policyChain, userPolicy, userPolicy.getScopeName(), oidcService);
        }

        val scopeFree = definedServiceScopes.isEmpty() || (definedServiceScopes.size() == 1
                                                           && definedServiceScopes.contains(OidcConstants.StandardScopes.OPENID.getScope()));
        if (scopeFree) {
            LOGGER.trace("Service definition [{}] will use the assigned attribute release policy without scopes", oidcService.getName());

            if (oidcService.getAttributeReleasePolicy() instanceof RegisteredServiceChainingAttributeReleasePolicy chain) {
                policyChain.addPolicies(chain.getPolicies().toArray(new RegisteredServiceAttributeReleasePolicy[0]));
            } else {
                policyChain.addPolicies(oidcService.getAttributeReleasePolicy());
            }
        }

        if (policyChain.getPolicies().isEmpty()) {
            LOGGER.debug("No attribute release policy could be determined based on given scopes. "
                         + "No claims/attributes will be released to [{}]", oidcService.getServiceId());
            oidcService.setAttributeReleasePolicy(new DenyAllAttributeReleasePolicy());
        } else {
            if (policyChain.size() == 1) {
                oidcService.setAttributeReleasePolicy(policyChain.getPolicies().get(0));
            } else {
                oidcService.setAttributeReleasePolicy(policyChain);
            }
        }

        LOGGER.trace("Scope/claim reconciliation for service [{}] resulted in the following attribute release policy [{}]",
            oidcService.getServiceId(), oidcService.getAttributeReleasePolicy());

        return oidcService;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.github.ambry.router;

import com.github.ambry.network.RequestInfo;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * The callback to be used when requests are created or dropped and needs to be sent out or closed. The operation
 * manager passes this callback to the associated operation class and the operation uses this callback when requests are
 * created and need to be sent out. The callback will then update data structures common to all of the different
 * "Manager" classes. The updates to these data structures are not thread safe and this callback should only be called
 * from the main event loop thread.
 */
class RequestRegistrationCallback<T> {
  private final Map<Integer, T> correlationIdToOperation;
  private List<RequestInfo> requestsToSend = null;
  private Set<Integer> requestsToDrop = null;

  /**
   * @param correlationIdToOperation used to keep a mapping from correlation ID to the operation that the request
   *                                 corresponds to.
   */
  RequestRegistrationCallback(Map<Integer, T> correlationIdToOperation) {
    this.correlationIdToOperation = correlationIdToOperation;
  }

  /**
   * @return the list where new requests to send are added.
   */
  List<RequestInfo> getRequestsToSend() {
    return requestsToSend;
  }

  /**
   * @return the list where the correlation IDs of requests to drop are added.
   */
  Set<Integer> getRequestsToDrop() {
    return requestsToDrop;
  }

  /**
   * @param requestsToSend the list to add {@link RequestInfo} for requests to send to.
   */
  void setRequestsToSend(List<RequestInfo> requestsToSend) {
    this.requestsToSend = requestsToSend;
  }

  /**
   * @param requestsToDrop the list to add the correlation IDs of requests to drop to.
   */
  void setRequestsToDrop(Set<Integer> requestsToDrop) {
    this.requestsToDrop = requestsToDrop;
  }

  /**
   * @param routerOperation the operation that the request corresponds to.
   * @param requestInfo the request to send out.
   */
  void registerRequestToSend(T routerOperation, RequestInfo requestInfo) {
    // TODO: netty send here>?
    if (requestsToSend != null) {
      requestsToSend.add(requestInfo);
    }
    correlationIdToOperation.put(requestInfo.getRequest().getCorrelationId(), routerOperation);
  }

  /**
   * Register a request to "drop". The current default networking layer drops requests by closing connections.
   * @param correlationId the correlation ID of the request to drop.
   */
  void registerRequestToDrop(int correlationId) {
    if (requestsToDrop != null) {
      requestsToDrop.add(correlationId);
    }
    // do not remove from correlationIdToOperation here because it will be handled by manager classes when they receive
    // a ResponseInfo.
  }
}


text: git clone VS. git pull and file structure


text:
size_t fwrite_check(const void *ptr, size_t size, size_t nitems, FILE *stream, const char *fname);

void serialize_int(FILE *out, int n, long long *fpos, const char *fname);
void serialize_long_long(FILE *out, long long n, long long *fpos, const char *fname);
void serialize_ulong_long(FILE *out, unsigned long long n, long long *fpos, const char *fname);
void serialize_byte(FILE *out, signed char n, long long *fpos, const char *fname);
void serialize_uint(FILE *out, unsigned n, long long *fpos, const char *fname);
void serialize_string(FILE *out, const char *s, long long *fpos, const char *fname);

void deserialize_int(char **f, int *n);
void deserialize_long_long(char **f, long long *n);
void deserialize_ulong_long(char **f, unsigned long long *n);
void deserialize_uint(char **f, unsigned *n);
void deserialize_byte(char **f, signed char *n);

int deserialize_int_io(FILE *f, int *n, long long *geompos);
int deserialize_long_long_io(FILE *f, long long *n, long long *geompos);
int deserialize_ulong_long_io(FILE *f, unsigned long long *n, long long *geompos);
int deserialize_uint_io(FILE *f, unsigned *n, long long *geompos);
int deserialize_byte_io(FILE *f, signed char *n, long long *geompos);

struct serial_val {
	int type = 0;
	std::string s = "";
};

struct serial_feature {
	long long layer = 0;
	int segment = 0;
	long long seq = 0;

	signed char t = 0;
	signed char feature_minzoom = 0;

	bool has_id = false;
	unsigned long long id = 0;

	bool has_tippecanoe_minzoom = false;
	int tippecanoe_minzoom = 0;

	bool has_tippecanoe_maxzoom = false;
	int tippecanoe_maxzoom = 0;

	drawvec geometry = drawvec();
	unsigned long long index = 0;
	long long extent = 0;

	size_t m = 0;
	std::vector<long long> keys{};
	std::vector<long long> values{};
	long long metapos = 0;

	// XXX This isn't serialized. Should it be here?
	long long bbox[4] = {0, 0, 0, 0};
	std::vector<std::string> full_keys{};
	std::vector<serial_val> full_values{};
	std::string layername = "";
};

void serialize_feature(FILE *geomfile, serial_feature *sf, long long *geompos, const char *fname, long long wx, long long wy, bool include_minzoom);
serial_feature deserialize_feature(FILE *geoms, long long *geompos_in, char *metabase, long long *meta_off, unsigned z, unsigned tx, unsigned ty, unsigned *initial_x, unsigned *initial_y);

struct reader {
	int metafd = -1;
	int poolfd = -1;
	int treefd = -1;
	int geomfd = -1;
	int indexfd = -1;

	FILE *metafile = NULL;
	struct memfile *poolfile = NULL;
	struct memfile *treefile = NULL;
	FILE *geomfile = NULL;
	FILE *indexfile = NULL;

	long long metapos = 0;
	long long geompos = 0;
	long long indexpos = 0;

	long long file_bbox[4] = {0, 0, 0, 0};

	struct stat geomst {};
	struct stat metast {};

	char *geom_map = NULL;
};

struct serialization_state {
	const char *fname = NULL;  // source file name
	int line = 0;		   // user-oriented location within source for error reports

	volatile long long *layer_seq = NULL;     // sequence within current layer
	volatile long long *progress_seq = NULL;  // overall sequence for progress indicator

	std::vector<struct reader> *readers = NULL;  // array of data for each input thread
	int segment = 0;			     // the current input thread

	unsigned *initial_x = NULL;  // relative offset of all geometries
	unsigned *initial_y = NULL;
	int *initialized = NULL;

	double *dist_sum = NULL;  // running tally for calculation of resolution within features
	size_t *dist_count = NULL;
	bool want_dist = false;

	int maxzoom = 0;
	int basezoom = 0;

	bool filters = false;
	bool uses_gamma = false;

	std::map<std::string, layermap_entry> *layermap = NULL;

	std::map<std::string, int> const *attribute_types = NULL;
	std::set<std::string> *exclude = NULL;
	std::set<std::string> *include = NULL;
	int exclude_all = 0;
	json_object *filter = NULL;
};

int serialize_feature(struct serialization_state *sst, serial_feature &sf);
void coerce_value(std::string const &key, int &vt, std::string &val, std::map<std::string, int> const *attribute_types);

#endif


text:
package org.onosproject.cli;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;

import java.util.Collections;
import java.util.List;

import static com.google.common.collect.Lists.newArrayList;

/**
 * Lists application ID information.
 */
@Command(scope = "onos", name = "apps",
         description = "Lists application ID information")
public class ApplicationIdListCommand extends AbstractShellCommand {

    @Override
    protected void execute() {
        CoreService service = get(CoreService.class);
        List<ApplicationId> ids = newArrayList(service.getAppIds());
        Collections.sort(ids, Comparators.APP_ID_COMPARATOR);

        if (outputJson()) {
            print("%s", json(ids));
        } else {
            for (ApplicationId id : ids) {
                print("id=%d, name=%s", id.id(), id.name());
            }
        }
    }

    // ApplicationId
    private JsonNode json(List<ApplicationId> ids) {
        ObjectMapper mapper = new ObjectMapper();
        ArrayNode result = mapper.createArrayNode();
        for (ApplicationId id : ids) {
            result.add(mapper.createObjectNode()
                               .put("id", id.id())
                               .put("name", id.name()));
        }
        return result;
    }

}


text:
class RemoveGittip < ActiveRecord::Migration
  def change
    remove_column :users, :gittip_username
  end
end


text:
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';

const config = {
  input: 'packages/image-js/lib-esm/index.js',
  output: {
    exports: 'named',
    file: 'demo/dist/image.js',
    format: 'umd',
    name: 'IJS'
  },
  plugins: [
    resolve({
      module: true,
      main: true,
      browser: true,
      extensions: ['.js']
    }),
    commonjs({
      namedExports: {
        'packages/image-js/node_modules/pako/index.js': ['Inflate', 'deflate'],
        'packages/image-js/node_modules/utf8/utf8.js': ['decode', 'encode']
      }
    })
  ]
};

export default config;


text:
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert
// Siehe http://java.sun.com/xml/jaxb
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2016.09.10 um 03:02:03 AM CEST
//

package com.laegler.microservice.adapter.lib.persistence.v2_1;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 *
Java-Klasse für anonymous complex type.
 *
 *
Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="persistence-unit" maxOccurs="unbounded">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *                   <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *                   <element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *                   <element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *                   <element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *                   <element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *                   <element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *                   <element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
 *                   <element name="shared-cache-mode" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-caching-type" minOccurs="0"/>
 *                   <element name="validation-mode" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-validation-mode-type" minOccurs="0"/>
 *                   <element name="properties" minOccurs="0">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <sequence>
 *                             <element name="property" maxOccurs="unbounded" minOccurs="0">
 *                               <complexType>
 *                                 <complexContent>
 *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                                     <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                                     <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                                   </restriction>
 *                                 </complexContent>
 *                               </complexType>
 *                             </element>
 *                           </sequence>
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                 </sequence>
 *                 <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                 <attribute name="transaction-type" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-transaction-type" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *       <attribute name="version" use="required" type="{http://xmlns.jcp.org/xml/ns/persistence}versionType" fixed="2.1" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "persistenceUnit"
})
@XmlRootElement(name = "persistence")
public class Persistence {

    @XmlElement(name = "persistence-unit", required = true)
    protected List<Persistence.PersistenceUnit> persistenceUnit;
    @XmlAttribute(name = "version", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String version;

    /**
     * Gets the value of the persistenceUnit property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the persistenceUnit property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getPersistenceUnit().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Persistence.PersistenceUnit }
     *
     *
     */
    public List<Persistence.PersistenceUnit> getPersistenceUnit() {
        if (persistenceUnit == null) {
            persistenceUnit = new ArrayList<Persistence.PersistenceUnit>();
        }
        return this.persistenceUnit;
    }

    /**
     * Ruft den Wert der version-Eigenschaft ab.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getVersion() {
        if (version == null) {
            return "2.1";
        } else {
            return version;
        }
    }

    /**
     * Legt den Wert der version-Eigenschaft fest.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setVersion(String value) {
        this.version = value;
    }

    /**
     *
     *
     *                 Configuration of a persistence unit.
     *
     *
     *
     *
Java-Klasse für anonymous complex type.
     *
     *
Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
     *         <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
     *         <element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
     *         <element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
     *         <element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
     *         <element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
     *         <element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
     *         <element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
     *         <element name="shared-cache-mode" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-caching-type" minOccurs="0"/>
     *         <element name="validation-mode" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-validation-mode-type" minOccurs="0"/>
     *         <element name="properties" minOccurs="0">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <sequence>
     *                   <element name="property" maxOccurs="unbounded" minOccurs="0">
     *                     <complexType>
     *                       <complexContent>
     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                           <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *                           <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *                         </restriction>
     *                       </complexContent>
     *                     </complexType>
     *                   </element>
     *                 </sequence>
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *       </sequence>
     *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
     *       <attribute name="transaction-type" type="{http://xmlns.jcp.org/xml/ns/persistence}persistence-unit-transaction-type" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "description",
        "provider",
        "jtaDataSource",
        "nonJtaDataSource",
        "mappingFile",
        "jarFile",
        "clazz",
        "excludeUnlistedClasses",
        "sharedCacheMode",
        "validationMode",
        "properties"
    })
    public static class PersistenceUnit {

        protected String description;
        protected String provider;
        @XmlElement(name = "jta-data-source")
        protected String jtaDataSource;
        @XmlElement(name = "non-jta-data-source")
        protected String nonJtaDataSource;
        @XmlElement(name = "mapping-file")
        protected List<String> mappingFile;
        @XmlElement(name = "jar-file")
        protected List<String> jarFile;
        @XmlElement(name = "class")
        protected List<String> clazz;
        @XmlElement(name = "exclude-unlisted-classes", defaultValue = "true")
        protected Boolean excludeUnlistedClasses;
        @XmlElement(name = "shared-cache-mode")
        @XmlSchemaType(name = "token")
        protected PersistenceUnitCachingType sharedCacheMode;
        @XmlElement(name = "validation-mode")
        @XmlSchemaType(name = "token")
        protected PersistenceUnitValidationModeType validationMode;
        protected Persistence.PersistenceUnit.Properties properties;
        @XmlAttribute(name = "name", required = true)
        protected String name;
        @XmlAttribute(name = "transaction-type")
        protected PersistenceUnitTransactionType transactionType;

        /**
         * Ruft den Wert der description-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getDescription() {
            return description;
        }

        /**
         * Legt den Wert der description-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setDescription(String value) {
            this.description = value;
        }

        /**
         * Ruft den Wert der provider-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getProvider() {
            return provider;
        }

        /**
         * Legt den Wert der provider-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setProvider(String value) {
            this.provider = value;
        }

        /**
         * Ruft den Wert der jtaDataSource-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getJtaDataSource() {
            return jtaDataSource;
        }

        /**
         * Legt den Wert der jtaDataSource-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setJtaDataSource(String value) {
            this.jtaDataSource = value;
        }

        /**
         * Ruft den Wert der nonJtaDataSource-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getNonJtaDataSource() {
            return nonJtaDataSource;
        }

        /**
         * Legt den Wert der nonJtaDataSource-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setNonJtaDataSource(String value) {
            this.nonJtaDataSource = value;
        }

        /**
         * Gets the value of the mappingFile property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the mappingFile property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getMappingFile().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link String }
         *
         *
         */
        public List<String> getMappingFile() {
            if (mappingFile == null) {
                mappingFile = new ArrayList<String>();
            }
            return this.mappingFile;
        }

        /**
         * Gets the value of the jarFile property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the jarFile property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getJarFile().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link String }
         *
         *
         */
        public List<String> getJarFile() {
            if (jarFile == null) {
                jarFile = new ArrayList<String>();
            }
            return this.jarFile;
        }

        /**
         * Gets the value of the clazz property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the clazz property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getClazz().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link String }
         *
         *
         */
        public List<String> getClazz() {
            if (clazz == null) {
                clazz = new ArrayList<String>();
            }
            return this.clazz;
        }

        /**
         * Ruft den Wert der excludeUnlistedClasses-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link Boolean }
         *
         */
        public Boolean isExcludeUnlistedClasses() {
            return excludeUnlistedClasses;
        }

        /**
         * Legt den Wert der excludeUnlistedClasses-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link Boolean }
         *
         */
        public void setExcludeUnlistedClasses(Boolean value) {
            this.excludeUnlistedClasses = value;
        }

        /**
         * Ruft den Wert der sharedCacheMode-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link PersistenceUnitCachingType }
         *
         */
        public PersistenceUnitCachingType getSharedCacheMode() {
            return sharedCacheMode;
        }

        /**
         * Legt den Wert der sharedCacheMode-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link PersistenceUnitCachingType }
         *
         */
        public void setSharedCacheMode(PersistenceUnitCachingType value) {
            this.sharedCacheMode = value;
        }

        /**
         * Ruft den Wert der validationMode-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link PersistenceUnitValidationModeType }
         *
         */
        public PersistenceUnitValidationModeType getValidationMode() {
            return validationMode;
        }

        /**
         * Legt den Wert der validationMode-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link PersistenceUnitValidationModeType }
         *
         */
        public void setValidationMode(PersistenceUnitValidationModeType value) {
            this.validationMode = value;
        }

        /**
         * Ruft den Wert der properties-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link Persistence.PersistenceUnit.Properties }
         *
         */
        public Persistence.PersistenceUnit.Properties getProperties() {
            return properties;
        }

        /**
         * Legt den Wert der properties-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link Persistence.PersistenceUnit.Properties }
         *
         */
        public void setProperties(Persistence.PersistenceUnit.Properties value) {
            this.properties = value;
        }

        /**
         * Ruft den Wert der name-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getName() {
            return name;
        }

        /**
         * Legt den Wert der name-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setName(String value) {
            this.name = value;
        }

        /**
         * Ruft den Wert der transactionType-Eigenschaft ab.
         *
         * @return
         *     possible object is
         *     {@link PersistenceUnitTransactionType }
         *
         */
        public PersistenceUnitTransactionType getTransactionType() {
            return transactionType;
        }

        /**
         * Legt den Wert der transactionType-Eigenschaft fest.
         *
         * @param value
         *     allowed object is
         *     {@link PersistenceUnitTransactionType }
         *
         */
        public void setTransactionType(PersistenceUnitTransactionType value) {
            this.transactionType = value;
        }

        /**
         *
Java-Klasse für anonymous complex type.
         *
         *
Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <sequence>
         *         <element name="property" maxOccurs="unbounded" minOccurs="0">
         *           <complexType>
         *             <complexContent>
         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *                 <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
         *                 <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
         *               </restriction>
         *             </complexContent>
         *           </complexType>
         *         </element>
         *       </sequence>
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {
            "property"
        })
        public static class Properties {

            protected List<Persistence.PersistenceUnit.Properties.Property> property;

            /**
             * Gets the value of the property property.
             *
             *

             * This accessor method returns a reference to the live list,
             * not a snapshot. Therefore any modification you make to the
             * returned list will be present inside the JAXB object.
             * This is why there is not a set method for the property property.
             *
             *

             * For example, to add a new item, do as follows:
             *

             *    getProperty().add(newItem);
             *

             *
             *
             *

             * Objects of the following type(s) are allowed in the list
             * {@link Persistence.PersistenceUnit.Properties.Property }
             *
             *
             */
            public List<Persistence.PersistenceUnit.Properties.Property> getProperty() {
                if (property == null) {
                    property = new ArrayList<Persistence.PersistenceUnit.Properties.Property>();
                }
                return this.property;
            }

            /**
             *
Java-Klasse für anonymous complex type.
             *
             *
Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
             *
             *

             * <complexType>
             *   <complexContent>
             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
             *       <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
             *     </restriction>
             *   </complexContent>
             * </complexType>
             *

             *
             *
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "")
            public static class Property {

                @XmlAttribute(name = "name", required = true)
                protected String name;
                @XmlAttribute(name = "value", required = true)
                protected String value;

                /**
                 * Ruft den Wert der name-Eigenschaft ab.
                 *
                 * @return
                 *     possible object is
                 *     {@link String }
                 *
                 */
                public String getName() {
                    return name;
                }

                /**
                 * Legt den Wert der name-Eigenschaft fest.
                 *
                 * @param value
                 *     allowed object is
                 *     {@link String }
                 *
                 */
                public void setName(String value) {
                    this.name = value;
                }

                /**
                 * Ruft den Wert der value-Eigenschaft ab.
                 *
                 * @return
                 *     possible object is
                 *     {@link String }
                 *
                 */
                public String getValue() {
                    return value;
                }

                /**
                 * Legt den Wert der value-Eigenschaft fest.
                 *
                 * @param value
                 *     allowed object is
                 *     {@link String }
                 *
                 */
                public void setValue(String value) {
                    this.value = value;
                }

            }

        }

    }

}


text:
'use strict';

var fs = require('fs');
var path = require('path');

var _require = require('source-map');

var SourceNode = _require.SourceNode;
var SourceMapConsumer = _require.SourceMapConsumer;

var makeIdentitySourceMap = require('./makeIdentitySourceMap');

var tagCommonJSExportsSource = null;

function transform(source, map) {
  // This is a Webpack loader, but the user put it in the Babel config.
  if (source && source.types && source.types.IfStatement) {
    throw new Error('React Hot Loader: You are erroneously trying to use a Webpack loader ' + 'as a Babel plugin. Replace "react-hot-loader/webpack" with ' + '"react-hot-loader/babel" in the "plugins" section of your .babelrc file. ' + 'While we recommend the above, if you prefer not to use Babel, ' + 'you may remove "react-hot-loader/webpack" from the "plugins" section of ' + 'your .babelrc file altogether, and instead add "react-hot-loader/webpack" ' + 'to the "loaders" section of your Webpack configuration.');
  }

  if (this.cacheable) {
    this.cacheable();
  }

  // Read the helper once.
  if (!tagCommonJSExportsSource) {
    tagCommonJSExportsSource = fs.readFileSync(path.join(__dirname, 'tagCommonJSExports.js'), 'utf8')
    // Babel inserts these.
    // Ideally we'd opt out for one file but this is simpler.
    .replace(/['"]use strict['"];/, '')
    // eslint comments don't need to end up in the output
    .replace(/\/\/ eslint-disable-line .*\n/g, '\n').replace(/\/\* global.*\*\//, '').split(/\n\s*/).join(' ');
  }

  // Parameterize the helper with the current filename.
  var separator = '\n\n';
  var appendText = tagCommonJSExportsSource.replace(/__FILENAME__/g, JSON.stringify(this.resourcePath));

  if (this.sourceMap === false) {
    return this.callback(null, [source, appendText].join(separator));
  }

  if (!map) {
    map = makeIdentitySourceMap(source, this.resourcePath); // eslint-disable-line no-param-reassign
  }
  var node = new SourceNode(null, null, null, [SourceNode.fromStringWithSourceMap(source, new SourceMapConsumer(map)), new SourceNode(null, null, this.resourcePath, appendText)]).join(separator);

  var result = node.toStringWithSourceMap();
  return this.callback(null, result.code, result.map.toString());
}

module.exports = transform;


text:
layout: post
title: "Jenius Engineer reading list #266"
author: "dedenf"
tags:
    - news
    - jenius

categories:
    - readinglist
    - engineer
published: true
---

- [Divide & Encode: How to Encode Videos Blazingly Fast: Part II - Under The Hood](https://tech.showmax.com/2019/03/divide-encode-2/)
- [Structured Logging: The Best Friend You'll Want When Things Go Wrong](https://engineering.grab.com/structured-logging)
- [Building Robust Layouts With Container Units](https://www.smashingmagazine.com/2019/03/robust-layouts-container-units-css/)
- [Independently Scalable Multi-Container Microservices Architecture on AWS Fargate (I)](https://hackernoon.com/microservices-on-fargate-part1-f26a318827a8?source=rss----3a8144eabfe3---4)
- [AutoML for predictive modeling](https://tech.showmax.com/2019/02/automl-predictive-modeling/)


text:
FFMPEG_LIBS=    libavdevice                        \
                libavformat                        \
                libavfilter                        \
                libavcodec                         \
                libswresample                      \
                libswscale                         \
                libavutil                          \

CFLAGS += -Wall -g
CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)

EXAMPLES=       avio_dir_cmd                       \
                avio_reading                       \
                decode_audio                       \
                decode_video                       \
                demuxing_decoding                  \
                encode_audio                       \
                encode_video                       \
                extract_mvs                        \
                filtering_video                    \
                filtering_audio                    \
                http_multiclient                   \
                hw_decode                          \
                metadata                           \
                muxing                             \
                remuxing                           \
                resampling_audio                   \
                scaling_video                      \
                transcode_aac                      \
                transcoding                        \

OBJS=$(addsuffix .o,$(EXAMPLES))

# the following examples make explicit use of the math library
avcodec:           LDLIBS += -lm
encode_audio:      LDLIBS += -lm
muxing:            LDLIBS += -lm
resampling_audio:  LDLIBS += -lm

.phony: all clean-test clean

all: $(OBJS) $(EXAMPLES)

clean-test:
	$(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg

clean: clean-test
	$(RM) $(EXAMPLES) $(OBJS)


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
    bootstrap="test/bootstrap.php"
    backupStaticAttributes="false"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    processIsolation="false"
    stopOnFailure="false"
    syntaxCheck="false"
>
    <testsuites>
        <testsuite name="Resque Test Suite">
            <directory>./test/Resque/</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory suffix=".php">./lib/Resque/</directory>
        </whitelist>
    </filter>
</phpunit>


text:
namespace Sakura
{
    export class Comments
    {
    }
}


text:
"""
This file contains all the settings that defines the development server.

SECURITY WARNING: don't run with debug turned on in production!
"""

import logging
import socket
from typing import List

from server.settings.components import config
from server.settings.components.common import (
    DATABASES,
    INSTALLED_APPS,
    MIDDLEWARE,
)

# Setting the development status:

DEBUG = True

ALLOWED_HOSTS = [
    config('DOMAIN_NAME'),
    'localhost',
    '0.0.0.0',  # noqa: S104
    '127.0.0.1',
    '[::1]',
]

# Installed apps for development only:

INSTALLED_APPS += (
    # Better debug:
    'debug_toolbar',
    'nplusone.ext.django',

    # Linting migrations:
    'django_migration_linter',

    # django-test-migrations:
    'django_test_migrations.contrib.django_checks.AutoNames',
    # This check might be useful in production as well,
    # so it might be a good idea to move `django-test-migrations`
    # to prod dependencies and use this check in the main `settings.py`.
    # This will check that your database is configured properly,
    # when you run `python manage.py check` before deploy.
    'django_test_migrations.contrib.django_checks.DatabaseConfiguration',

    # django-extra-checks:
    'extra_checks',
)

# Static files:
# https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-STATICFILES_DIRS

STATICFILES_DIRS: List[str] = []

# Django debug toolbar:
# https://django-debug-toolbar.readthedocs.io

MIDDLEWARE += (
    'debug_toolbar.middleware.DebugToolbarMiddleware',

    # https://github.com/bradmontgomery/django-querycount
    # Prints how many queries were executed, useful for the APIs.
    'querycount.middleware.QueryCountMiddleware',
)

# https://django-debug-toolbar.readthedocs.io/en/stable/installation.html#configure-internal-ips
try:  # This might fail on some OS
    INTERNAL_IPS = [
        '{0}.1'.format(ip[:ip.rfind('.')])
        for ip in socket.gethostbyname_ex(socket.gethostname())[2]
    ]
except socket.error:  # pragma: no cover
    INTERNAL_IPS = []
INTERNAL_IPS += ['127.0.0.1', '10.0.2.2']

def _custom_show_toolbar(request):
    """Only show the debug toolbar to users with the superuser flag."""
    return DEBUG and request.user.is_superuser

DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK':
        'server.settings.environments.development._custom_show_toolbar',
}

# This will make debug toolbar to work with django-csp,
# since `ddt` loads some scripts from `ajax.googleapis.com`:
CSP_SCRIPT_SRC = ("'self'", 'ajax.googleapis.com')
CSP_IMG_SRC = ("'self'", 'data:')
CSP_CONNECT_SRC = ("'self'",)

# nplusone
# https://github.com/jmcarp/nplusone

# Should be the first in line:
MIDDLEWARE = (  # noqa: WPS440
    'nplusone.ext.django.NPlusOneMiddleware',
) + MIDDLEWARE

# Logging N+1 requests:
NPLUSONE_RAISE = True  # comment out if you want to allow N+1 requests
NPLUSONE_LOGGER = logging.getLogger('django')
NPLUSONE_LOG_LEVEL = logging.WARN
NPLUSONE_WHITELIST = [
    {'model': 'admin.*'},
]

# django-test-migrations
# https://github.com/wemake-services/django-test-migrations

# Set of badly named migrations to ignore:
DTM_IGNORED_MIGRATIONS = frozenset((
    ('axes', '*'),
))

# django-extra-checks
# https://github.com/kalekseev/django-extra-checks

EXTRA_CHECKS = {
    'checks': [
        # Forbid `unique_together`:
        'no-unique-together',
        # Require non empty `upload_to` argument:
        'field-file-upload-to',
        # Use the indexes option instead:
        'no-index-together',
        # Each model must be registered in admin:
        'model-admin',
        # FileField/ImageField must have non empty `upload_to` argument:
        'field-file-upload-to',
        # Text fields shouldn't use `null=True`:
        'field-text-null',
        # Prefer using BooleanField(null=True) instead of NullBooleanField:
        'field-boolean-null',
        # Don't pass `null=False` to model fields (this is django default)
        'field-null',
        # ForeignKey fields must specify db_index explicitly if used in
        # other indexes:
        {'id': 'field-foreign-key-db-index', 'when': 'indexes'},
        # If field nullable `(null=True)`,
        # then default=None argument is redundant and should be removed:
        'field-default-null',
        # Fields with choices must have companion CheckConstraint
        # to enforce choices on database level
        'field-choices-constraint',
    ],
}

# Disable persistent DB connections
# https://docs.djangoproject.com/en/3.2/ref/databases/#caveats
DATABASES['default']['CONN_MAX_AGE'] = 0


text:
// tslint:disable
// graphql typescript definitions

export interface IGraphQLResponseRoot {
  data?: IQuery
  errors?: Array<IGraphQLResponseError>
}

export interface IGraphQLResponseError {
  /** Required for all errors */
  message: string
  locations?: Array<IGraphQLResponseErrorLocation>
  /** 7.2.2 says 'GraphQL servers may provide additional entries to error' */
  [propName: string]: any
}

export interface IGraphQLResponseErrorLocation {
  line: number
  column: number
}

export interface IQuery {
  __typename: string | null
  vendors: Array<IVendor | null> | null
  bestPrices: Array<IBestPrice | null> | null
  itemsListings: IItemListings | null
  itemsFlatListings: IItemFlatListings | null
}

export interface IVendorsOnQueryArguments {
  province?: string | null
}

export interface IBestPricesOnQueryArguments {
  type?: ItemType | null
  calibres?: Array<string> | null
}

export interface IItemsListingsOnQueryArguments {
  page?: number | null
  pageSize?: number | null
  itemType?: ItemType | null
  subType?: string | null
  province?: string | null
  vendor?: string | null
  sortOrder?: SortOrder | null
  sortField?: SortField | null
  query?: string | null
  brand?: string | null
}

export interface IItemsFlatListingsOnQueryArguments {
  page?: number | null
  pageSize?: number | null
  itemType?: ItemType | null
  subType?: string | null
  province?: string | null
  vendor?: string | null
  sortOrder?: SortOrder | null
  sortField?: FlatSortField | null
  query?: string | null
  brand?: string | null
}

export interface IVendor {
  __typename: string | null
  name: string
  provinces: Array<string>
  location: string
  logo: string
  link: string
  background: boolean | null
  hasReloadingItems: boolean | null
}

export const enum ItemType {
  ammo = 'ammo',
  centerfire = 'centerfire',
  rimfire = 'rimfire',
  shotgun = 'shotgun',
  reloading = 'reloading',
  powder = 'powder',
  shot = 'shot',
  case = 'case',
  primer = 'primer',
}

export interface IBestPrice {
  __typename: string | null
  unitCost: number
  calibre: string
  type: ItemType
}

export const enum SortOrder {
  ASC = 'ASC',
  DES = 'DES',
}

export const enum SortField {
  name = 'name',
  link = 'link',
  minPrice = 'minPrice',
  minUnitCost = 'minUnitCost',
}

export interface IItemListings {
  __typename: string | null
  page: number
  pages: number
  pageSize: number
  items: Array<IItemGroup>
}

export interface IItemGroup {
  __typename: string | null
  name: string
  brand: string
  subType: string | null
  itemType: ItemType
  minPrice: number
  maxPrice: number
  minUnitCost: number | null
  maxUnitCost: number | null
  img: string | null
  vendors: Array<IItemListing>
}

export interface IItemListing {
  __typename: string | null
  img: string | null
  price: number
  name: string
  link: string
  vendor: string
  provinces: Array<string | null> | null
  subType: string | null
  brand: string
  count: number | null
  unitCost: number | null
  itemType: ItemType
  ttl: number | null
}

export const enum FlatSortField {
  name = 'name',
  link = 'link',
  price = 'price',
  unitCost = 'unitCost',
}

export interface IItemFlatListings {
  __typename: string | null
  page: number
  pages: number
  pageSize: number
  items: Array<IItemListing>
}

export const enum Province {
  AB = 'AB',
  BC = 'BC',
  MB = 'MB',
  NB = 'NB',
  NL = 'NL',
  NS = 'NS',
  NT = 'NT',
  NU = 'NU',
  ON = 'ON',
  PE = 'PE',
  QC = 'QC',
  SK = 'SK',
  YT = 'YT',
}

export const enum State {
  FL = 'FL',
  IA = 'IA',
  IL = 'IL',
  ID = 'ID',
  NH = 'NH',
  NV = 'NV',
  OK = 'OK',
  SC = 'SC',
  TN = 'TN',
  TX = 'TX',
  UT = 'UT',
  WA = 'WA',
}

// tslint:enable


text:
@implementation TextFormatter

+ (NSString *)format:(NSString *)text {
	NSString *objc = @"Text from Objective-c";
	NSString *string = [NSString stringWithFormat:@"%@ with %@",
		objc, text];

  return string;
}

@end


text:
namespace g{namespace Android{namespace android{namespace view{struct DragEvent;}}}}
namespace g{namespace Android{namespace android{namespace view{struct View;}}}}

namespace g{
namespace Android{
namespace android{
namespace view{

// public abstract extern interface ViewDLROnDragListener :27186
// {
uInterfaceType* ViewDLROnDragListener_typeof();

struct ViewDLROnDragListener
{
    void(*fp_onDrag)(uObject*, ::g::Android::android::view::View*, ::g::Android::android::view::DragEvent*, bool*);
    static bool onDrag(const uInterface& __this, ::g::Android::android::view::View* arg0, ::g::Android::android::view::DragEvent* arg1) { bool __retval; return __this.VTable<ViewDLROnDragListener>()->fp_onDrag(__this, arg0, arg1, &__retval), __retval; }
};
// }

}}}} // ::g::Android::android::view


text:
<?php

namespace Magento\Framework\Css\Test\Unit\PreProcessor\File\Collector;

use \Magento\Framework\Css\PreProcessor\File\Collector\Aggregated;

/**
 * Tests Aggregate
 */
class AggregatedTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Framework\View\File\FileList\Factory|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $fileListFactoryMock;

    /**
     * @var \Magento\Framework\View\File\FileList|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $fileListMock;

    /**
     * @var \Magento\Framework\View\File\CollectorInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $libraryFilesMock;

    /**
     * @var \Magento\Framework\View\File\CollectorInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $baseFilesMock;

    /**
     * @var \Magento\Framework\View\File\CollectorInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $overriddenBaseFilesMock;

    /**
     * @var \Magento\Framework\View\Design\ThemeInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $themeMock;

    /**
     * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
     */
    protected $loggerMock;

    /**
     * Setup tests
     * @return void
     */
    public function setup()
    {
        $this->fileListFactoryMock = $this->getMockBuilder('Magento\Framework\View\File\FileList\Factory')
            ->disableOriginalConstructor()->getMock();
        $this->fileListMock = $this->getMockBuilder('Magento\Framework\View\File\FileList')
            ->disableOriginalConstructor()->getMock();
        $this->fileListFactoryMock->expects($this->any())->method('create')
            ->will($this->returnValue($this->fileListMock));
        $this->libraryFilesMock = $this->getMockBuilder('Magento\Framework\View\File\CollectorInterface')
            ->getMock();
        $this->loggerMock = $this->getMockBuilder('Psr\Log\LoggerInterface')
            ->getMock();

        $this->baseFilesMock = $this->getMockBuilder('Magento\Framework\View\File\CollectorInterface')->getMock();
        $this->overriddenBaseFilesMock = $this->getMockBuilder('Magento\Framework\View\File\CollectorInterface')
            ->getMock();
        $this->themeMock = $this->getMockBuilder('\Magento\Framework\View\Design\ThemeInterface')->getMock();
    }

    public function testGetFilesEmpty()
    {
        $this->libraryFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));
        $this->baseFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));
        $this->overriddenBaseFilesMock->expects($this->any())->method('getFiles')->will($this->returnValue([]));

        $aggregated = new Aggregated(
            $this->fileListFactoryMock,
            $this->libraryFilesMock,
            $this->baseFilesMock,
            $this->overriddenBaseFilesMock,
            $this->loggerMock
        );

        $this->themeMock->expects($this->any())->method('getInheritedThemes')->will($this->returnValue([]));
        $this->themeMock->expects($this->any())->method('getCode')->will($this->returnValue('theme_code'));

        $this->loggerMock->expects($this->once())
            ->method('notice')
            ->with('magento_import returns empty result by path * for theme theme_code', []);

        $aggregated->getFiles($this->themeMock, '*');
    }

    /**
     *
     * @dataProvider getFilesDataProvider
     *
     * @param $libraryFiles array Files in lib directory
     * @param $baseFiles array Files in base directory
     * @param $themeFiles array Files in theme
     * *
     * @return void
     */
    public function testGetFiles($libraryFiles, $baseFiles, $themeFiles)
    {
        $this->fileListMock->expects($this->at(0))->method('add')->with($this->equalTo($libraryFiles));
        $this->fileListMock->expects($this->at(1))->method('add')->with($this->equalTo($baseFiles));
        $this->fileListMock->expects($this->any())->method('getAll')->will($this->returnValue(['returnedFile']));

        $subPath = '*';
        $this->libraryFilesMock->expects($this->atLeastOnce())
            ->method('getFiles')
            ->with($this->themeMock, $subPath)
            ->will($this->returnValue($libraryFiles));

        $this->baseFilesMock->expects($this->atLeastOnce())
            ->method('getFiles')
            ->with($this->themeMock, $subPath)
            ->will($this->returnValue($baseFiles));

        $this->overriddenBaseFilesMock->expects($this->any())
            ->method('getFiles')
            ->will($this->returnValue($themeFiles));

        $aggregated = new Aggregated(
            $this->fileListFactoryMock,
            $this->libraryFilesMock,
            $this->baseFilesMock,
            $this->overriddenBaseFilesMock,
            $this->loggerMock
        );

        $inheritedThemeMock = $this->getMockBuilder('\Magento\Framework\View\Design\ThemeInterface')->getMock();
        $this->themeMock->expects($this->any())->method('getInheritedThemes')
            ->will($this->returnValue([$inheritedThemeMock]));

        $this->assertEquals(['returnedFile'], $aggregated->getFiles($this->themeMock, $subPath));
    }

    /**
     * Provides test data for testGetFiles()
     *
     * @return array
     */
    public function getFilesDataProvider()
    {
        return [
            'all files' => [['file1'], ['file2'], ['file3']],
            'no library' => [[], ['file1', 'file2'], ['file3']],
        ];
    }
}


text:
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;

import java.io.IOException;
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.apache.isis.core.commons.matchers.IsisMatchers;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
import org.apache.isis.viewer.restfulobjects.tck.Util;

import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMediaTypeProfile;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;

// Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok
public class Get_whenObject_isNotNull_thenRepr_andRespHeaders_and_200_ok {

    @Rule
    public IsisWebServerRule webServerRule = new IsisWebServerRule();

    private RestfulClient client;

    private DomainServiceResource serviceResource;

    @Before
    public void setUp() throws Exception {
        client = webServerRule.getClient();

        serviceResource = client.getDomainServiceResource();
    }

    @Test
    public void usingClientFollow() throws Exception {

        // given
        final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "findById");
        final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);

        final LinkRepresentation invokeLink = actionRepr.getInvoke();
        final JsonRepresentation args =invokeLink.getArguments();

        // when
        args.mapPut("id.value", 1);

        // when
        final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);

        // then
        then(restfulResponse);
    }

    @Test
    public void usingResourceProxy() throws Exception {

        // given, when

        JsonRepresentation args = JsonRepresentation.newMap();
        args.mapPut("id.value", 1);

        Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
        RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);

        then(restfulResponse);
    }

    private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws IOException {

        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
        assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
        assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(IsisMatchers.greaterThan(1000)));

        final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();

        assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
        final DomainObjectRepresentation objRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);

        assertThat(objRepr.getMembers(), is(not(nullValue())));
        assertThat(objRepr.getMembers().size(), is(IsisMatchers.greaterThan(0)));

        assertThat(objRepr.getTitle(), is(not(nullValue())));

        assertThat(objRepr.getLinks(), is(not(nullValue())));
        assertThat(objRepr.getMembers().size(), is(IsisMatchers.greaterThan(0)));

        assertThat(objRepr.getExtensions(), is(not(nullValue())));
    }

}


text:
import os
from optparse import make_option
from uliweb.core.commands import Command
from commands import SQLCommand

class InitCommand(SQLCommand, Command):
    name = 'init'
    help = 'Initialize a new scripts directory.'

    def handle(self, options, global_options, *args):
        from uliweb.utils.common import extract_dirs
        from uliweb.core.template import template_file
        from uliweb.manage import make_simple_application
        from uliweb import settings
        from sqlalchemy import create_engine, MetaData, Table
        from shutil import rmtree
        from uliweb.orm import get_connection, engine_manager

        alembic_path = os.path.join(global_options.project, 'alembic', options.engine).replace('\\', '/')
        #delete alembic path
        if os.path.exists(alembic_path):
            rmtree(alembic_path, True)
        extract_dirs('uliweb.contrib.orm', 'templates/alembic', alembic_path,
            verbose=global_options.verbose, replace=True)
        make_simple_application(project_dir=global_options.project,
            settings_file=global_options.settings,
            local_settings_file=global_options.local_settings)
        ini_file = os.path.join(alembic_path, 'alembic.ini')
        text = template_file(ini_file,
            {'connection':engine_manager[options.engine].options.connection_string,
            'engine_name':options.engine,
            'script_location':alembic_path})

        with open(ini_file, 'wb') as f:
            f.write(text)

        #drop old alembic_version table
        db = get_connection(options.engine)
        metadata = MetaData(db)
        if db.dialect.has_table(db.connect(), 'alembic_version'):
            version = Table('alembic_version', metadata, autoload=True)
            version.drop()

class RevisionCommand(SQLCommand, Command):
    name = 'revision'
    help = 'Create a new revision file.'
    option_list = (
        make_option('--autogenerate', dest='autogenerate', action='store_true', default=False,
            help='Populate revision script with candidate migration operations, based on comparison of database to model.'),
        make_option('-m', '--message', dest='message', help="Message string to use with 'revision'"),
        make_option('--remove', dest='remove', action='store_true', default=False, help="Remove tables if not Model found."),
        make_option('-f', '--force', dest='force', action='store_true', default=False, help="Directly diff without check last unfinished version."),
    )
    check_apps = True

    def handle(self, options, global_options, *args):
        from alembic.config import Config
        from uliweb.orm import engine_manager
        from uliweb.manage import make_simple_application

        app = make_simple_application(apps_dir=global_options.apps_dir,
            settings_file=global_options.settings, local_settings_file=global_options.local_settings)

        alembic_path = os.path.join(global_options.project, 'alembic', options.engine).replace('\\', '/')
        configfile = os.path.join(alembic_path, 'alembic.ini')
        alembic_cfg = Config(configfile)
        alembic_cfg.set_main_option("sqlalchemy.url", engine_manager[options.engine].options.connection_string)
        alembic_cfg.set_main_option("engine_name", options.engine)
        alembic_cfg.set_main_option("script_location", alembic_path)
        alembic_cfg.set_main_option("remove_tables", '1' if options.remove else '0')
        self.do(alembic_cfg, args, options, global_options)

    def do(self, config, args, options, global_options):
        self.run(self.name, config, message=options.message, autogenerate=options.autogenerate)

    def run(self, cmd, config, *args, **kwargs):
        from alembic import command, util
        try:
            getattr(command, cmd)(config, *args, **kwargs)
        except util.CommandError, e:
            util.err(str(e))

class DiffCommand(RevisionCommand):
    name = 'diff'
    help = 'Create a new revision file with autogeneration.'
    check_apps = True

    def do(self, config, args, options, global_options):
        self.run('revision', config, message=options.message, autogenerate=True, skip=options.force)

class CurrentCommand(RevisionCommand):
    name = 'current'
    help = 'Display the current revision for each database.'
    check_apps = True

    def do(self, config, args, options, global_options):
        self.run('current', config)

class UpgradeCommand(RevisionCommand):
    name = 'upgrade'
    help = 'Upgrade to a later version.'
    option_list = (
        make_option('--sql', dest='sql', action='store_true', default=False,
            help="Don't emit SQL to database - dump to standard output/file instead "),
        make_option('--tag', dest='tag', help="Arbitrary 'tag' name - can be used by custom env.py scripts."),
    )
    check_apps = True

    def do(self, config, args, options, global_options):
        if not args:
            revision = 'head'
        else:
            revision = args[0]
        self.run(self.name, config, revision=revision, sql=options.sql, tag=options.tag)


text:
<?php

namespace Spatie\CollectionMacros\Test;

use Illuminate\Support\Collection;

class RangeTest extends TestCase
{
    /** @test */
    public function it_can_create_a_basic_range()
    {
        $this->assertEquals([1, 2, 3], Collection::range(1, 3)->toArray());
        $this->assertEquals([3, 4, 5], Collection::range(3, 5)->toArray());
    }

    /** @test */
    public function it_can_create_a_range_with_a_specified_step_size()
    {
        $this->assertEquals([2, 4, 6], Collection::range(2, 6, 2)->toArray());
    }
}


text:
package restservice

import (
	"code.google.com/p/go.net/websocket"
	"fmt"
	"github.com/straumur/straumur"
	"io"
)

//Represents a connected websocket client
type Client struct {
	Id     string
	ws     *websocket.Conn
	server *WebSocketServer
	ch     chan *straumur.Event
	doneCh chan bool
	query  straumur.Query
}

func NewClient(ws *websocket.Conn, server *WebSocketServer, uuid string) *Client {

	if ws == nil {
		panic("ws cannot be nil")
	}

	ch := make(chan *straumur.Event)
	doneCh := make(chan bool)
	query := straumur.Query{}
	return &Client{uuid, ws, server, ch, doneCh, query}
}

func (c *Client) Conn() *websocket.Conn {
	return c.ws
}

func (c *Client) Write(e *straumur.Event) {
	select {
	case c.ch <- e:
	default:
		c.server.Del(c)
		err := fmt.Errorf("client %s is disconnected.", c.Id)
		c.server.Err(err)
	}
}

func (c *Client) Done() {
	c.doneCh <- true
}

func (c *Client) Listen() {
	go c.listenWrite()
	c.listenRead()
}

func (c *Client) listenWrite() {

	for {
		select {

		case event := <-c.ch:
			err := websocket.JSON.Send(c.ws, event)
			if err != nil {
				c.server.Err(err)
			}

		case <-c.doneCh:
			c.server.Del(c)
			c.doneCh <- true
			return
		}
	}
}

func (c *Client) listenRead() {

	for {
		select {

		case <-c.doneCh:
			c.server.Del(c)
			c.doneCh <- true
			return

		// read data from websocket connection
		default:
			var q straumur.Query
			err := websocket.JSON.Receive(c.ws, &q)
			if err == io.EOF {
				c.doneCh <- true
			} else if err != nil {
				c.server.Err(err)
			} else {
				c.query = q
			}
		}
	}
}


text:
/*
Description: This is a light implementation of a Linux shell
*/

#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>

#define MAX_LEN 4096
static const int MAX_ARGS = 256;

struct proc_st {
	int bg;
	int exec;
	int commc;
	int fd_out;
	int fd_in;
	pid_t pid;
	char pbuff[MAX_LEN];
	char *commv[];
};

/* function prototypes */
int cmd_exit(struct proc_st *);
int cmd_cd(struct proc_st *);
int matches(const char *, const char *);
void error_msg(const char *);
void sig_handler(int);
void comm_identi(struct proc_st *, char *);

/* struct handling built-in commands */
static const struct builtin {
	const char *cmd;
	int (*func)(struct proc_st *);
} cmds[] = {
	{ "exit", cmd_exit},
	{ "cd", cmd_cd},
	{ 0 }
};

int main()
{
	struct proc_st *proc;
	char buff[MAX_LEN];
	pid_t pid;
	int status;

	/* initialize signal handlers */
	signal(SIGINT, SIG_IGN);
	signal(SIGCHLD, sig_handler);

	proc = malloc(sizeof(struct proc_st) + MAX_ARGS);

	/* start of shell loop */
	printf("[SHELL]> ");
	for (;;) {
		while (fgets(buff, MAX_LEN, stdin) != NULL) {

			if (strlen(buff) == 1)
				continue;
			/* initialize to zero for every command */
			memset(proc, 0, sizeof(struct proc_st));
			proc->exec = 1;
			comm_identi(proc, buff);

			if (proc->exec == 1) {
				if ((pid = fork()) < 0 ) {
					error_msg("fork error");
				} else if (pid == 0)	/* child */
					if (execvp(*(proc->commv),
						proc->commv) < 0 )
						error_msg("could not execute");

				/* parent */
				if (proc->bg == 0) {
					if ((pid = waitpid(pid, &status, 0))
							< 0)
						error_msg("waitpid error");
				} else
					printf("PID %d %s\n", pid, proc->pbuff);
			}
			printf("[SHELL]> ");
		}
	}
	free(proc);
	exit(0);
}

/* signal handler */
void sig_handler(int signal)
{
	pid_t pid;
	const char msg[] = "Child Terminated";

	while ((pid = waitpid(-1, NULL, WNOHANG | WUNTRACED)) > 0)
		write(STDOUT_FILENO, msg, sizeof(msg) - 1);

	if (errno != ECHILD)
		exit(EXIT_FAILURE);
}

/* prints error messages */
void error_msg(const char * msg)
{
	fprintf(stderr, "%s: %s\n", msg, strerror(errno));
	exit(EXIT_FAILURE);
}

/* compares input to builtin commands */
int matches(const char* cmd, const char* pattern)
{
	int len = strlen(cmd);

	if (len > strlen(pattern))
		return -1;
	return memcmp(pattern, cmd, len);
}

/* builtin exit */
int cmd_exit(struct proc_st *proc)
{
	free(proc);
	exit(EXIT_SUCCESS);
}

/* builtin cd */
int cmd_cd(struct proc_st *proc)
{
	proc->exec = 0;

	if (chdir(proc->commv[1]) != 0)
		error_msg("chdir() error");
	return (EXIT_SUCCESS);
}

/* parses and identifies commands */
void comm_identi(struct proc_st *proc, char *buffer)
{
	const struct builtin *ctmp;
	char *tmp;

	/* replace newline with null */
	if (buffer[strlen(buffer) - 1] == '\n')
		buffer[strlen(buffer) - 1] = 0;
	strncpy(proc->pbuff,buffer,MAX_LEN);

	tmp = strtok(buffer, " ");
	while (tmp != NULL) {
		proc->commv[(proc->commc)++] = tmp;
		tmp = strtok(NULL, " ");
	}

	proc->commv[proc->commc] = NULL;

	/* check for built-in functions */
	if (proc->commc >= 1) {
		for (ctmp = cmds; ctmp->cmd; ctmp++) {
			if (matches(proc->commv[0], ctmp->cmd) == 0)
				ctmp->func(proc);
		}

		/* check if it is a background process */
		if (*proc->commv[(proc->commc) - 1] == '&') {
			proc->bg = 1;
			proc->commv[(proc->commc) - 1] = NULL;
		}
	}

	return;
}


text:
import stripTags from 'striptags';

export function isBlank(html) {
  return !!stripTags(html).match(/^\s*$/);
}

export function presence(html) {
  return isBlank(html) ? null : html;
}


text:
@protocol IPlayerResponse <NSObject>
-(void)write:(id)text;
@end


text:
<img src="https://raw.github.com/kostia/VexEd/master/etc/screenshot.png" width="600px">

Editor for the [VexTab](http://www.vexflow.com/vextab) notation.

## Install

* OS X: grab the disk image from https://github.com/kostia/VexEd/releases/latest.
* Windows: grab the installer from https://github.com/kostia/VexEd/releases/latest.
* Linux: download the source and run from command line.

## Develop

```
npm install
```

### Run

```
npm start
```

### Build

```
npm run build
```

## License

MIT © [Kostiantyn Kahanskyi](https://github.com/kostia/VexEd)


text:
layout: default
---

{{ site.data.pagetitle.index.title }}

{{ site.data.pagetitle.index.subtitle }}

How to use this framework

      To use this layout, you can just copy paste the HTML, along with the CSS in side-menu.css, and the JavaScript in ui.js. The JS file uses vanilla JavaScript to simply toggle an active class that makes the menu responsive.

Now Let's Speak Some Latin

      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Try Resizing your Browser

      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


text:
//-----------------------------------------------------------------------
// <copyright file="SharedKeyCanonicalizer.cs" company="Microsoft">
//    Copyright 2011 Microsoft Corporation
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//      http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
// </copyright>
// <summary>
//    Contains code for the SharedKeyCanonicalizer class.
// </summary>
//-----------------------------------------------------------------------

namespace Microsoft.WindowsAzure.StorageClient.Protocol
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Globalization;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using Microsoft.WindowsAzure.StorageClient;

    /// <summary>
    /// Provides an implementation of the <see cref="CanonicalizationStrategy"/> class for requests against
    /// the Table service under the Shared Key authentication scheme.
    /// </summary>
    public sealed class SharedKeyCanonicalizer : CanonicalizationStrategy
    {
        /// <summary>
        /// Canonicalizes the HTTP request.
        /// </summary>
        /// <param name="request">The web request.</param>
        /// <param name="accountName">The name of the storage account.</param>
        /// <returns>The canonicalized string for the request.</returns>
        public override string CanonicalizeHttpRequest(HttpWebRequest request, string accountName)
        {
            return CanonicalizeHttpRequestVersion2(
                request.Address,
                accountName,
                request.Method,
                request.ContentType,
                request.ContentLength,
                string.Empty,
                request.Headers);
        }
    }
}


text:
set -e

for i in rsa dsa ecdsa ed25519; do
  local keyfile=/etc/ssh/ssh_host_${i}_key
  if [ ! -e $keyfile ]; then
    ssh-keygen -f $keyfile -N '' -t $i
  fi
done
mkdir -p /var/run/sshd

if [ -n "$CONSOLE_PASSWORD" ]; then
  echo "root:$CONSOLE_PASSWORD" | chpasswd
fi

if [ -n "$CONSOLE_KEYS" ]; then
  mkdir -p /root/.ssh
  chmod 700 /root/.ssh
  echo "$CONSOLE_KEYS" > /root/.ssh/authorized_keys
  chmod 600 /root/.ssh/authorized_keys
else
  # FIXME only do this for now when keys aren't available, ideally should inform
  # the user on the console.
  echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
fi

rm /start.sh

exec /sbin/spawn -f /etc/spawn.conf


text:
require 'active_record/errors'
require 'hydra_attribute/model/validations'
require 'hydra_attribute/model/persistence'
require 'hydra_attribute/model/mediator'
require 'hydra_attribute/model/notifiable'
require 'hydra_attribute/model/identity_map'
require 'hydra_attribute/model/cacheable'
require 'hydra_attribute/model/dirty'
require 'hydra_attribute/model/has_many_through'

module HydraAttribute
  module Model
    extend ActiveSupport::Concern

    include Validations
    include Persistence
    include Mediator
    include Notifiable
    include IdentityMap
    include Cacheable
    include Dirty
    include HasManyThrough

    included do
      # Compatibility with Rails' helpers
      include ActiveModel::Conversion
      extend ActiveModel::Naming
      extend ActiveModel::Translation
    end

    module ClassMethods
      # Find first model
      #
      # @return [HydraAttribute::Model]
      def first
        all.first
      end

      # Find last model
      #
      # @return [HydraAttribute::Model]
      def last
        all.last
      end

      # Returns number of models
      #
      # @return [Fixnum]
      def count
        all.count
      end
    end
  end
end


text:
@interface WGBWaterLabelVIew ()
@property (weak, nonatomic) IBOutlet UIImageView *oldIV;

@property (weak, nonatomic) IBOutlet UIImageView *nIV;

@end

@implementation WGBWaterLabelVIew

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIImage * oldimage =[UIImage imageNamed:@"2"];

    self.oldIV.image=oldimage;

 UIImage * nImage =[UIImage imageAddWaterLabel:oldimage waterText:@"@新浪微博大内蜜炭零零狗~" waterTextDrawPoint:CGPointMake(70, oldimage.size.height-12) andTextAttributes:@{
                                                                                NSForegroundColorAttributeName : KRandomColor,

                                                                                NSFontAttributeName : [UIFont systemFontOfSize:8]
                                                                                }];

    self.nIV.image=nImage;

}

@end


text:
layout: base
title:  'Statistics of PronType in UD_Manx-Cadhan'
udver: '2'
---

## Treebank Statistics: UD_Manx-Cadhan: Features: `PronType`

This feature is universal but the values `Emp` are language-specific.
It occurs with 3 different values: `Art`, `Dem`, `Emp`.

1370 tokens (7%) have a non-empty value of `PronType`.
18 types (1%) occur at least once with a non-empty value of `PronType`.
10 lemmas (0%) occur at least once with a non-empty value of `PronType`.
The feature is used with 2 part-of-speech tags: <tt>DET</tt> (1155; 6% instances), <tt>PRON</tt> (215; 1% instances).

### `DET`

1155 <tt>DET</tt> tokens (61% of all `DET` tokens) have a non-empty value of `PronType`.

The most frequent other feature values with which `DET` and `PronType` co-occurred: <tt>Definite</tt><tt>=Def</tt> (1155; 100%), <tt>Gender</tt><tt>=EMPTY</tt> (1155; 100%), <tt>Person</tt><tt>=EMPTY</tt> (1155; 100%), <tt>Poss</tt><tt>=EMPTY</tt> (1155; 100%), <tt>Number</tt><tt>=Sing</tt> (1001; 87%).

`DET` tokens may have the following values of `PronType`:

* `Art` (1155; 100% of non-empty `PronType`): yn, y, ny, 'n
* `EMPTY` (752): e, ny, my, dty, dagh, ooilley, n', shoh, nyn, shen

### `PRON`

215 <tt>PRON</tt> tokens (6% of all `PRON` tokens) have a non-empty value of `PronType`.

The most frequent other feature values with which `PRON` and `PronType` co-occurred: <tt>Gender</tt><tt>=EMPTY</tt> (171; 80%), <tt>Number</tt><tt>=EMPTY</tt> (112; 52%), <tt>Person</tt><tt>=EMPTY</tt> (112; 52%).

`PRON` tokens may have the following values of `PronType`:

* `Dem` (112; 52% of non-empty `PronType`): shen, shoh
* `Emp` (103; 48% of non-empty `PronType`): eshyn, mish, uss, adsyn, ish, shiuish, shinyn
* `EMPTY` (3095): eh, mee, ad, oo, ee, hene, shin, shiu, cre, ou


text:
/**
 * Created by daniel on 4/7/17.
 */
import {playerStates} from "./commands";

export class Player {

    constructor(id) {
        this._id = id;
        this._playerState = playerStates.ALIVE;
    }

    get id(){
        return this._id;
    }

    get playerState(){
        return this._playerState;
    }
}


text:
package sbn.core.data.attributes

import java.util.NoSuchElementException

/**
  * Represents a custom immutable collection of [[Attribute]] objects.
  *
  * @param attributeList the native collection containing the [[Attribute]] objects.
  * @param attributeOrder the specific order of the attributes.
  * @throws IllegalArgumentException if there are repeated attribute names in the [[attributeList]]
  *                                  or if the [[attributeList]].size != [[attributeOrder]].size
  *                                  or if the [[attributeOrder]] contains values out of bound
  *                                  or if the [[attributeOrder]] contains repeated values.
  */
@throws[IllegalArgumentException]
case class Attributes (attributeList: List[Attribute], attributeOrder: List[Int]) extends Iterable[Attribute]{
  require(attributeList.map(_.name).distinct.size == attributeList.size, "Attribute names cannot be repeated")
  require(attributeList.size == attributeOrder.size, "The size of the attribute list should be the same of the attribute order collection.")
  require(!attributeOrder.exists( _ >= attributeList.size), "Order value out of bounds.")
  require(attributeOrder.groupBy(identity).collect{
    case (attr, attrRepetitionsList)  if attrRepetitionsList.lengthCompare(1) > 0 => attr
  }.isEmpty, "Repeated values in the attributeOrder collection")

  /**
    * Returns the attributeList ordered by the [[attributeOrder]].
    *
    * @return the attributeList ordered by the [[attributeOrder]].
    */
  def orderedAttributeList: List[Attribute] = attributeOrder.map(x => attributeList(x))

  /**
    * Returns the requested [[Attribute]] object.
    *
    * @param name the requested attribute's name.
    * @throws NoSuchElementException if the requested name doesn't exists.
    * @return the requested Attribute.
    */
  @throws[NoSuchElementException]
  def getAttributeByName(name: String): Attribute = {
    this.attributeList.find(attr => attr.name.equals(name))
      .getOrElse(throw new NoSuchElementException("the provided name doesn't coincide with an attribute"))
  }

  /**
   * Returns the size of the [[attributeList]].
    *
   * @return the size of the [[attributeList]].
   */
  override def size: Int = this.attributeList.size

  /**
    * Returns a custom iterator for the collection.
    *
    * @return a custom iterator for the collection.
    */
  override def iterator: Iterator[Attribute] = orderedAttributeList.iterator

  /**
   * Returns the attribute associated to the provided index.
    *
   * @param attributeIndex the index of the attribute.
   * @throws IndexOutOfBoundsException if attributeIndex exceeds the bounds of [[attributeList]].
   * @return the attribute associated to the provided index.
   */
  @throws[IndexOutOfBoundsException]
  def apply(attributeIndex: Int): Attribute = this.attributeList(this.attributeOrder(attributeIndex))

}

/** Factory for the [[Attributes]] class. Its main factory method is created by default. */
object Attributes{

  /**
   * Auxiliary factory method. It is used when no special attribute order is provided.
    *
   * @param attributeList the native collection containing the [[Attribute]] objects.
   * @return a new [[Attributes]] object with a default attribute order.
   */
  def apply(attributeList: List[Attribute]): Attributes = {
    val attributeListOrder = attributeList.zipWithIndex.map{case (attr, index) => index}
    Attributes(attributeList, attributeListOrder)
  }
}


text:
import { history, push } from "../history";

describe("push()", () => {
  it("calls history with a URL", () => {
    const URL = "/wow.html";
    let oldFn = history.push;
    history.push = jest.fn();
    push(URL);
    expect(history.push).toHaveBeenCalledWith(URL);
    history.push = oldFn;
  });
});


text:
/*******************************************************************//*
 * Implementation of the UIClickFunction class.
 *
 * @author      Brandon To
 * @version     1.0
 * @since       2015-02-09
 * @modified    2015-02-20
 *********************************************************************/
#include "UIClickFunction.h"

#ifdef _WIN32
    #include <SDL.h>
    #include <windows.h>
#endif

#ifdef __linux
    #include <SDL2/SDL.h>
#endif

#include "ApplicationStateManager.h"
#include "AudioSystem.h"
#include "WindowElements.h"

namespace ClickFunctions
{
    void onClickBack(ApplicationState* state, WindowElements* windowElements)
    {
        state->statePop();
    }

    void onClickCredits(ApplicationState* state, WindowElements* windowElements)
    {
        state->statePush(STATE_CREDITS);
    }

    void onClickFork(ApplicationState* state, WindowElements* windowElements)
    {
#ifdef _WIN32
        std::string url = "https://github.com/brandonto/sdl-space-shooter";
        ShellExecute(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
#endif

#ifdef __linux
        std::string url = "xdg-open https://github.com/brandonto/sdl-space-shooter";
        system(url.c_str());
#endif
    }

    void onClickGame(ApplicationState* state, WindowElements* windowElements)
    {
        state->stateTransition(STATE_GAME);
    }

    void onClickInstructions(ApplicationState* state, WindowElements* windowElements)
    {
        state->statePush(STATE_INSTRUCTIONS);
    }

    void onClickMenu(ApplicationState* state, WindowElements* windowElements)
    {
        state->stateTransition(STATE_MENU);
    }

    void onClickMusic(ApplicationState* state, WindowElements* windowElements)
    {
        AudioSystem::getInstance()->toggleMusic();
    }

    void onClickNone(ApplicationState* state, WindowElements* windowElements)
    {
    }

    void onClickOptions(ApplicationState* state, WindowElements* windowElements)
    {
        state->statePush(STATE_OPTIONS);
    }

    void onClickQuit(ApplicationState* state, WindowElements* windowElements)
    {
        state->stateTransition(STATE_EXIT);
    }

    void onClickResume(ApplicationState* state, WindowElements* windowElements)
    {
        state->statePop();
    }

    void onClickSound(ApplicationState* state, WindowElements* windowElements)
    {
        AudioSystem::getInstance()->toggleSound();
    }

    void onClickWindow(ApplicationState* state, WindowElements* windowElements)
    {
        if (windowElements->fullScreen)
        {
            SDL_SetWindowFullscreen(windowElements->window, 0);
            windowElements->fullScreen = false;
        }
        else
        {
            SDL_SetWindowFullscreen(windowElements->window, SDL_WINDOW_FULLSCREEN_DESKTOP);
            windowElements->fullScreen = true;
        }
    }
}

UIClickFunction::UIClickFunction(ApplicationState* state,
                            WindowElements* windowElements)
:   state(state),
    windowElements(windowElements)
{
    functionTable["BACK"] = &(ClickFunctions::onClickBack);
    functionTable["CREDITS"] = &(ClickFunctions::onClickCredits);
    functionTable["FORK"] = &(ClickFunctions::onClickFork);
    functionTable["GAME"] = &(ClickFunctions::onClickGame);
    functionTable["INSTRUCTIONS"] = &(ClickFunctions::onClickInstructions);
    functionTable["NONE"] = &(ClickFunctions::onClickNone);
    functionTable["MENU"] = &(ClickFunctions::onClickMenu);
    functionTable["MUSIC"] = &(ClickFunctions::onClickMusic);
    functionTable["OPTIONS"] = &(ClickFunctions::onClickOptions);
    functionTable["QUIT"] = &(ClickFunctions::onClickQuit);
    functionTable["RESUME"] = &(ClickFunctions::onClickResume);
    functionTable["SOUND"] = &(ClickFunctions::onClickSound);
    functionTable["WINDOW"] = &(ClickFunctions::onClickWindow);
    callback = functionTable["NONE"];
}

void UIClickFunction::setCallback(std::string callbackString)
{
    callback = functionTable[callbackString];
}

void UIClickFunction::onClick()
{
    callback(state, windowElements);
}

UIClickFunction::~UIClickFunction()
{
    // To be implemented
}