text:
package com.jetbrains.rest.run;

import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.ConfigurationTypeUtil;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.openapi.project.Project;
import com.jetbrains.python.run.PythonConfigurationFactoryBase;
import com.jetbrains.rest.RestBundle;
import com.jetbrains.rest.RestFileType;
import com.jetbrains.rest.run.docutils.DocutilsRunConfiguration;
import com.jetbrains.rest.run.sphinx.SphinxRunConfiguration;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * User : catherine
 */
public class RestRunConfigurationType implements ConfigurationType {
  public final ConfigurationFactory DOCUTILS_FACTORY = new DocutilsRunConfigurationFactory(this);
  public final ConfigurationFactory SPHINX_FACTORY = new SphinxRunConfigurationFactory(this);

  private String myId = "docs";

  public String getDisplayName() {
    return RestBundle.message("runcfg.docutils.display_name");
  }

  public static RestRunConfigurationType getInstance() {
    return ConfigurationTypeUtil.findConfigurationType(RestRunConfigurationType.class);
  }

  public String getConfigurationTypeDescription() {
    return RestBundle.message("runcfg.docutils.description");
  }

  public Icon getIcon() {
    return RestFileType.INSTANCE.getIcon();
  }

  @NotNull
  public String getId() {
    return myId;
  }

  public ConfigurationFactory[] getConfigurationFactories() {
    return new ConfigurationFactory[] {DOCUTILS_FACTORY, SPHINX_FACTORY};
  }

  private static abstract class RestConfigurationFactory extends PythonConfigurationFactoryBase {
    private final String myName;

    public RestConfigurationFactory(@NotNull final ConfigurationType type, @NotNull String name) {
      super(type);
      myName = name;
    }

    public String getName() {
      return myName;
    }
  }

  private static class DocutilsRunConfigurationFactory extends RestConfigurationFactory {
    protected DocutilsRunConfigurationFactory(ConfigurationType type) {
      super(type, "Docutils task");
    }

    public RunConfiguration createTemplateConfiguration(Project project) {
      return new DocutilsRunConfiguration(project, this);
    }
  }

  private static class SphinxRunConfigurationFactory extends RestConfigurationFactory {
    protected SphinxRunConfigurationFactory(ConfigurationType type) {
      super(type, "Sphinx task");
    }

    public RunConfiguration createTemplateConfiguration(Project project) {
      return new SphinxRunConfiguration(project, this);
    }
  }
}


text:
from django.test import TestCase
from django_snooze import apis

class APITestCase(TestCase):
    def setUp(self):
        """Sets up an API object to play with.

        :returns: None

        """
        self.api = apis.api
        self.api.discover_models()

    def test_apps(self):
        """Test if the right apps are present.

        :returns: None

        """
        self.assertIn('tests', self.api._resources.keys())
        self.assertIn('auth', self.api._resources.keys())
        tests_models = [x.model_name for x in self.api._resources['tests']]
        self.assertNotIn('abstract', tests_models)

redpajama_set_name: RedPajamaGithub


text:
from flask import url_for
from flask_babel import gettext as _

from catwatch.tests.lib.util import ViewTestMixin
from catwatch.tests.lib.assertions import assert_status_with_message
from catwatch.blueprints.issue.models import Issue

class TestSettings(ViewTestMixin):
    def test_support_page(self):
        """ Support page renders successfully. """
        response = self.client.get(url_for('issue.support'))

        assert response.status_code == 200

    def test_support_page_while_logged_in(self):
        """ Support page renders successfully with pre-populated e-mail. """
        self.login()
        response = self.client.get(url_for('issue.support'))

        assert_status_with_message(200, response,
                                   'value="admin@localhost.com"')

    def test_support(self):
        """ Support issue gets saved. """
        old_issue_count = Issue.query.count()
        issue = {
            'label': 'login',
            'email': 'foo@bar.com',
            'question': 'Help!'
        }

        response = self.client.post(url_for('issue.support'), data=issue,
                                    follow_redirects=True)

        assert_status_with_message(200, response,
                                   _('Help is on the way, expect a response '
                                     'shortly.'))

        new_issue_count = Issue.query.count()
        assert (old_issue_count + 1) == new_issue_count

    def test_support_invalid_label(self):
        """ Support issue fails due to an invalid label. """
        issue = {
            'label': 'notlegit',
            'email': 'foo@bar.com',
            'question': 'Help!'
        }

        response = self.client.post(url_for('issue.support'), data=issue,
                                    follow_redirects=True)

        assert_status_with_message(200, response, 'Not a valid choice')


text:
package net.glider.src.utils;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public final class GLoger
{
	private static Logger logger = LogManager.getLogger(GliderModInfo.MOD_ID);
	private static final boolean enableLog = true;

	public static void log(Level level, String msg)
	{
		logger.log(level, msg);
	}

	public static void logInfo(String msg)
	{
		if (enableLog)logger.info(msg);
	}

	public static void logWarn(String msg)
	{
		logger.warn(msg);
	}

	public static void logFatal(String msg)
	{
		logger.fatal(msg);
	}

	public static void logDebug(String msg)
	{
		if (enableLog)logger.debug(msg);
	}

	public static void log(Level level, String msg, Object... args)
	{
		logger.log(level, String.format(msg, args));
	}

	public static void logInfo(String msg, Object... args)
	{
		logger.info(String.format(msg, args));
	}

	public static void logWarn(String msg, Object... args)
	{
		logger.warn(String.format(msg, args));
	}

	public static void logFatal(String msg, Object... args)
	{
		logger.fatal(String.format(msg, args));
	}

	public static void logDebug(String msg, Object... args)
	{
		logger.debug(String.format(msg, args));
	}
}


text:
import { hmac } from '@noble/hashes/hmac';
import { sha256 } from '@noble/hashes/sha256';
import * as secp from '@noble/secp256k1';
import { derToJose, joseToDer } from '../ecdsaSigFormatter';
import { MissingParametersError } from '../errors';
import { bytesToHex } from '@noble/hashes/utils';

// required to use noble secp https://github.com/paulmillr/noble-secp256k1
secp.utils.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {
  const h = hmac.create(sha256, key);
  msgs.forEach(msg => h.update(msg));
  return h.digest();
};

export class SECP256K1Client {
  static algorithmName = 'ES256K';

  static derivePublicKey(privateKey: string, compressed = true): string {
    if (privateKey.length === 66) {
      privateKey = privateKey.slice(0, 64);
    }
    if (privateKey.length < 64) {
      // backward compatibly accept too short private keys
      privateKey = privateKey.padStart(64, '0');
    }
    return bytesToHex(secp.getPublicKey(privateKey, compressed));
  }

  static signHash(signingInputHash: string | Uint8Array, privateKey: string, format = 'jose') {
    // make sure the required parameters are provided
    if (!signingInputHash || !privateKey) {
      throw new MissingParametersError('a signing input hash and private key are all required');
    }

    const derSignature = secp.signSync(signingInputHash, privateKey.slice(0, 64), {
      der: true,
      canonical: false,
    });

    if (format === 'der') return bytesToHex(derSignature);
    if (format === 'jose') return derToJose(derSignature, 'ES256');

    throw Error('Invalid signature format');
  }

  static loadSignature(joseSignature: string | Uint8Array) {
    // create and return the DER-formatted signature bytes
    return joseToDer(joseSignature, 'ES256');
  }

  static verifyHash(
    signingInputHash: Uint8Array,
    derSignatureBytes: string | Uint8Array,
    publicKey: string | Uint8Array
  ) {
    // make sure the required parameters are provided
    if (!signingInputHash || !derSignatureBytes || !publicKey) {
      throw new MissingParametersError(
        'a signing input hash, der signature, and public key are all required'
      );
    }

    return secp.verify(derSignatureBytes, signingInputHash, publicKey, { strict: false });
  }
}


text:
title: "stereokai.vim"
tags: ["Vim", "Code"]
layout: "post"
comments: true
link: "https://github.com/gummesson/stereokai.vim"
---

Lately I've really started to enjoy [the Monokai
theme](http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/). There's
a couple of different versions out there for [Vim](http://www.vim.org) and my
favorite is [Monokai-Refined](https://github.com/jaromero/vim-monokai-refined).
However, Vim's way of handling highlighting can sometimes be quite weird so
I decided to add some minor tweaks so that it looks especially good when your
writing HTML, CSS and JavaScript and make it available in a repository. I don't
know if it'll replace my beloved [Tomorrow
Theme](https://github.com/chriskempson/tomorrow-theme) or
[Solarized](http://ethanschoonover.com/solarized), but it's definitively a close
third atleast.


text:
namespace gl
{
ANGLE_EXPORT void GL_APIENTRY BlendBarrier();
ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
ANGLE_EXPORT void GL_APIENTRY BlendEquationi(GLuint buf, GLenum mode);
ANGLE_EXPORT void GL_APIENTRY
BlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
ANGLE_EXPORT void GL_APIENTRY BlendFunci(GLuint buf, GLenum src, GLenum dst);
ANGLE_EXPORT void GL_APIENTRY
ColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
ANGLE_EXPORT void GL_APIENTRY CopyImageSubData(GLuint srcName,
                                               GLenum srcTarget,
                                               GLint srcLevel,
                                               GLint srcX,
                                               GLint srcY,
                                               GLint srcZ,
                                               GLuint dstName,
                                               GLenum dstTarget,
                                               GLint dstLevel,
                                               GLint dstX,
                                               GLint dstY,
                                               GLint dstZ,
                                               GLsizei srcWidth,
                                               GLsizei srcHeight,
                                               GLsizei srcDepth);
ANGLE_EXPORT void GL_APIENTRY DebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
ANGLE_EXPORT void GL_APIENTRY DebugMessageControl(GLenum source,
                                                  GLenum type,
                                                  GLenum severity,
                                                  GLsizei count,
                                                  const GLuint *ids,
                                                  GLboolean enabled);
ANGLE_EXPORT void GL_APIENTRY DebugMessageInsert(GLenum source,
                                                 GLenum type,
                                                 GLuint id,
                                                 GLenum severity,
                                                 GLsizei length,
                                                 const GLchar *buf);
ANGLE_EXPORT void GL_APIENTRY Disablei(GLenum target, GLuint index);
ANGLE_EXPORT void GL_APIENTRY DrawElementsBaseVertex(GLenum mode,
                                                     GLsizei count,
                                                     GLenum type,
                                                     const void *indices,
                                                     GLint basevertex);
ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedBaseVertex(GLenum mode,
                                                              GLsizei count,
                                                              GLenum type,
                                                              const void *indices,
                                                              GLsizei instancecount,
                                                              GLint basevertex);
ANGLE_EXPORT void GL_APIENTRY DrawRangeElementsBaseVertex(GLenum mode,
                                                          GLuint start,
                                                          GLuint end,
                                                          GLsizei count,
                                                          GLenum type,
                                                          const void *indices,
                                                          GLint basevertex);
ANGLE_EXPORT void GL_APIENTRY Enablei(GLenum target, GLuint index);
ANGLE_EXPORT void GL_APIENTRY FramebufferTexture(GLenum target,
                                                 GLenum attachment,
                                                 GLuint texture,
                                                 GLint level);
ANGLE_EXPORT GLuint GL_APIENTRY GetDebugMessageLog(GLuint count,
                                                   GLsizei bufSize,
                                                   GLenum *sources,
                                                   GLenum *types,
                                                   GLuint *ids,
                                                   GLenum *severities,
                                                   GLsizei *lengths,
                                                   GLchar *messageLog);
ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatus();
ANGLE_EXPORT void GL_APIENTRY
GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
ANGLE_EXPORT void GL_APIENTRY GetObjectPtrLabel(const void *ptr,
                                                GLsizei bufSize,
                                                GLsizei *length,
                                                GLchar *label);
ANGLE_EXPORT void GL_APIENTRY GetPointerv(GLenum pname, void **params);
ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);
ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
ANGLE_EXPORT void GL_APIENTRY GetTexParameterIiv(GLenum target, GLenum pname, GLint *params);
ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);
ANGLE_EXPORT void GL_APIENTRY GetnUniformfv(GLuint program,
                                            GLint location,
                                            GLsizei bufSize,
                                            GLfloat *params);
ANGLE_EXPORT void GL_APIENTRY GetnUniformiv(GLuint program,
                                            GLint location,
                                            GLsizei bufSize,
                                            GLint *params);
ANGLE_EXPORT void GL_APIENTRY GetnUniformuiv(GLuint program,
                                             GLint location,
                                             GLsizei bufSize,
                                             GLuint *params);
ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabledi(GLenum target, GLuint index);
ANGLE_EXPORT void GL_APIENTRY MinSampleShading(GLfloat value);
ANGLE_EXPORT void GL_APIENTRY ObjectLabel(GLenum identifier,
                                          GLuint name,
                                          GLsizei length,
                                          const GLchar *label);
ANGLE_EXPORT void GL_APIENTRY ObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
ANGLE_EXPORT void GL_APIENTRY PatchParameteri(GLenum pname, GLint value);
ANGLE_EXPORT void GL_APIENTRY PopDebugGroup();
ANGLE_EXPORT void GL_APIENTRY PrimitiveBoundingBox(GLfloat minX,
                                                   GLfloat minY,
                                                   GLfloat minZ,
                                                   GLfloat minW,
                                                   GLfloat maxX,
                                                   GLfloat maxY,
                                                   GLfloat maxZ,
                                                   GLfloat maxW);
ANGLE_EXPORT void GL_APIENTRY PushDebugGroup(GLenum source,
                                             GLuint id,
                                             GLsizei length,
                                             const GLchar *message);
ANGLE_EXPORT void GL_APIENTRY ReadnPixels(GLint x,
                                          GLint y,
                                          GLsizei width,
                                          GLsizei height,
                                          GLenum format,
                                          GLenum type,
                                          GLsizei bufSize,
                                          void *data);
ANGLE_EXPORT void GL_APIENTRY SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);
ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuiv(GLuint sampler,
                                                   GLenum pname,
                                                   const GLuint *param);
ANGLE_EXPORT void GL_APIENTRY TexBuffer(GLenum target, GLenum internalformat, GLuint buffer);
ANGLE_EXPORT void GL_APIENTRY TexBufferRange(GLenum target,
                                             GLenum internalformat,
                                             GLuint buffer,
                                             GLintptr offset,
                                             GLsizeiptr size);
ANGLE_EXPORT void GL_APIENTRY TexParameterIiv(GLenum target, GLenum pname, const GLint *params);
ANGLE_EXPORT void GL_APIENTRY TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);
ANGLE_EXPORT void GL_APIENTRY TexStorage3DMultisample(GLenum target,
                                                      GLsizei samples,
                                                      GLenum internalformat,
                                                      GLsizei width,
                                                      GLsizei height,
                                                      GLsizei depth,
                                                      GLboolean fixedsamplelocations);
}  // namespace gl

#endif  // LIBGLESV2_ENTRY_POINTS_GLES_3_2_AUTOGEN_H_


text:
var fs =require("fs")
var unzip=require("unzip")

exports.run=function(orgin,target,callback)
{

	var temp = unzip.Extract({ path: target})

	if(callback) temp.on('close',callback)
	//??
	fs.createReadStream(orgin).pipe(temp);
};


text:
@class WKContentWorld;
@class WKFrameInfo;
@class WKWebView;

namespace base {
class Value;
}  // namespace base

namespace web {

// The domain for JS evaluation NSErrors in web.
extern NSString* const kJSEvaluationErrorDomain;

// The maximum recursion depth when parsing JS results.
extern int const kMaximumParsingRecursionDepth;

// The type of errors that can occur while evaluating JS.
enum JSEvaluationErrorCode {
  // No web view present to evaluate JS.
  JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW = -1000,
  // JS evaluation is not allowed for security reasons.
  JS_EVALUATION_ERROR_CODE_REJECTED = -1001,
};

// Converts result of WKWebView script evaluation to base::Value.
std::unique_ptr<base::Value> ValueResultFromWKResult(id result);

// Executes JavaScript on WKWebView. If the web view cannot execute JS at the
// moment, `completion_handler` is called with an NSError.
void ExecuteJavaScript(WKWebView* web_view,
                       NSString* script,
                       void (^completion_handler)(id, NSError*));

// Executes JavaScript for `web_view` in `frame_info` within `content_world` and
// calls `completion_handler` with the result. `content_world` is optional,
// however, if specified and not equal to WKContentWorld.pageWorld, `frame_info`
// is required. If the web view cannot execute JS at the moment,
// `completion_handler` is called with an NSError.
void ExecuteJavaScript(WKWebView* web_view,
                       WKContentWorld* content_world,
                       WKFrameInfo* frame_info,
                       NSString* script,
                       void (^completion_handler)(id, NSError*));

}  // namespace web

#endif  // IOS_WEB_JS_MESSAGING_WEB_VIEW_JS_UTILS_H_


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using System;
using System.Runtime.InteropServices;
using osuTK;
using osuTK.Graphics;
using osuTK.Graphics.ES30;

namespace osu.Framework.Graphics.OpenGL.Vertices
{
    [StructLayout(LayoutKind.Sequential)]
    public struct TexturedVertex3D : IEquatable<TexturedVertex3D>, IVertex
    {
        [VertexMember(3, VertexAttribPointerType.Float)]
        public Vector3 Position;

        [VertexMember(4, VertexAttribPointerType.Float)]
        public Color4 Colour;

        [VertexMember(2, VertexAttribPointerType.Float)]
        public Vector2 TexturePosition;

        public readonly bool Equals(TexturedVertex3D other) => Position.Equals(other.Position) && TexturePosition.Equals(other.TexturePosition) && Colour.Equals(other.Colour);
    }
}


text:
<?php

namespace Admin\Service;

use Zend\Authentication\Adapter\AdapterInterface;
use Zend\Authentication\Result;
use Zend\Crypt\Password\Bcrypt;
use Admin\Entity\User;

/**
 * Adapter used for authenticating user. It takes login and password on input
 * and checks the database if there is a user with such login (email) and password.
 * If such user exists, the service returns its identity (email). The identity
 * is saved to session and can be retrieved later with Identity view helper provided
 * by ZF3.
 */
class AuthAdapter implements AdapterInterface {

    /**
     * User email.
     * @var string
     */
    private $email;

    /**
     * Password
     * @var string
     */
    private $password;

    /**
     * Entity manager.
     * @var Doctrine\ORM\EntityManager
     */
    private $entityManager;

    /**
     * Constructor.
     */
    public function __construct($entityManager) {
        $this->entityManager = $entityManager;
    }

    /**
     * Sets user email.
     */
    public function setEmail($email) {
        $this->email = $email;
    }

    /**
     * Sets password.
     */
    public function setPassword($password) {
        $this->password = (string) $password;
    }

    /**
     * Performs an authentication attempt.
     */
    public function authenticate() {
        // Check the database if there is a user with such email.
        $user = $this->entityManager->getRepository(User::class)
                ->findOneByEmail($this->email);

        // If there is no such user, return 'Identity Not Found' status.
        if ($user == null) {
            return new Result(
                Result::FAILURE_IDENTITY_NOT_FOUND, null, ['Invalid credentials.']
            );
        }

        // If the user with such email exists, we need to check if it is active or retired.
        // Do not allow retired users to log in.
        if ($user->getStatus() == User::STATUS_RETIRED) {
            return new Result(
                Result::FAILURE, null, ['User is retired.']
            );
        }

        // Now we need to calculate hash based on user-entered password and compare
        // it with the password hash stored in database.
        $bcrypt = new Bcrypt();
        $passwordHash = $user->getPassword();

        if ($bcrypt->verify($this->password, $passwordHash)) {
            // Great! The password hash matches. Return user identity (email) to be
            // saved in session for later use.
            return new Result(
                Result::SUCCESS, $this->email, ['Authenticated successfully.']
            );
        }

        // If password check didn't pass return 'Invalid Credential' failure status.
        return new Result(
            Result::FAILURE_CREDENTIAL_INVALID, null, ['Invalid credentials.']
        );
    }
}


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>
#include <assert.h>
#include <exception>

#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_Predicate_1_gen3781873254MethodDeclarations.h"

// System.Void System.Predicate`1<UnityEngine.Sprite>::.ctor(System.Object,System.IntPtr)
#define Predicate_1__ctor_m1079198399(__this, ___object0, ___method1, method) ((  void (*) (Predicate_1_t2810224124 *, Il2CppObject *, IntPtr_t, const MethodInfo*))Predicate_1__ctor_m982040097_gshared)(__this, ___object0, ___method1, method)
// System.Boolean System.Predicate`1<UnityEngine.Sprite>::Invoke(T)
#define Predicate_1_Invoke_m3525471715(__this, ___obj0, method) ((  bool (*) (Predicate_1_t2810224124 *, Sprite_t3199167241 *, const MethodInfo*))Predicate_1_Invoke_m4106178309_gshared)(__this, ___obj0, method)
// System.IAsyncResult System.Predicate`1<UnityEngine.Sprite>::BeginInvoke(T,System.AsyncCallback,System.Object)
#define Predicate_1_BeginInvoke_m477645938(__this, ___obj0, ___callback1, ___object2, method) ((  Il2CppObject * (*) (Predicate_1_t2810224124 *, Sprite_t3199167241 *, AsyncCallback_t1369114871 *, Il2CppObject *, const MethodInfo*))Predicate_1_BeginInvoke_m2038073176_gshared)(__this, ___obj0, ___callback1, ___object2, method)
// System.Boolean System.Predicate`1<UnityEngine.Sprite>::EndInvoke(System.IAsyncResult)
#define Predicate_1_EndInvoke_m2935779793(__this, ___result0, method) ((  bool (*) (Predicate_1_t2810224124 *, Il2CppObject *, const MethodInfo*))Predicate_1_EndInvoke_m3970497007_gshared)(__this, ___result0, method)


text:
package org.apache.camel.example.pojo_messaging;

import org.apache.camel.Consume;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;

//START SNIPPET: ex
public class SendFileRecordsToQueueBean {
    @Produce(uri = "activemq:personnel.records")
    ProducerTemplate producer;

    @Consume(uri = "file:src/data?noop=true")
    public void onFileSendToQueue(String body) {
        producer.sendBody(body);
    }
}
//END SNIPPET: ex