text:
<?php
/**
* Useful function for twitter using codebird-php
* https://dev.twitter.com/rest/public
*/
class SS__Twitter {

    const CONSUMER_KEY = SS_TWITTER_CONSUMER_KEY;
    const CONSUMER_SECRET = SS_TWITTER_CONSUMER_SECRET;
    const ACCESS_TOKEN = SS_TWITTER_ACCESS_TOKEN;
    const ACCESS_TOKEN_SECRET = SS_TWITTER_ACCESS_TOKEN_SECRET;

    /**
    * Authentication using codebird-php
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @return  [type]     [description]
    */
    static private function cb_auth() {
        //codebird is going to be doing the oauth lifting for us
        if(!class_exists('Codebird'))
            require_once( SS__PLUGIN_DIR . 'twitter/vendor/codebird.php' );

        //Get authenticated
        \Codebird\Codebird::setConsumerKey(self::CONSUMER_KEY, self::CONSUMER_SECRET);
        $cb = \Codebird\Codebird::getInstance();
        $cb->setToken(self::ACCESS_TOKEN, self::ACCESS_TOKEN_SECRET);

        return $cb;
    }

    /**
    * Get most recent tweets
    *
    * IMPORTANT (from twitter API):
    * "We include retweets in the count, even if include_rts is not supplied.
    * It is recommended you always send include_rts=1 when using this API method."
    *
    * 	https://dev.twitter.com/rest/reference/get/statuses/user_timeline
    *
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @param   string     $screen_name     The screen name of the user for whom to return results for. Example Values: noradio
    * @param   integer    $count           Specifies the number of tweets to try and retrieve, up to a maximum of 200 per distinct request. The value of count is best thought of as a limit to the number of tweets to return because suspended or deleted content is removed after the count has been applied. We include retweets in the count, even if include_rts is not supplied. It is recommended you always send include_rts=1 when using this API method.
    * @param   boolean    $retweets        When set to false, the timeline will strip any native retweets (though they will still count toward both the maximal length of the timeline and the slice selected by the count parameter). Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will still contain a full user object.
    * @param   boolean    $exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets — this is because the count parameter retrieves that many tweets before filtering out retweets and replies. This parameter is only supported for JSON and XML responses.
    * @return  object                      Returns obejct with all tweets.
    */
    static public function get_most_recent_tweets($screen_name, $count = 5, $retweets = true, $exclude_replies = false, $json = false) {
        $cb = self::cb_auth();
        //These are our params passed in for our request to twitter
        //The GET request is made by our codebird instance for us further down
        $params = array(
            'screen_name' => $screen_name,
            'count' => $count,
            'include_rts' => $retweets,
            'exclude_replies' => $exclude_replies
        );
        //tweets returned by Twitter in JSON object format
        $tweets = (array) $cb->statuses_userTimeline($params);

        //unset rubbish that would break foreach loop
        unset($tweets['httpstatus']);
        unset($tweets['rate']);

        //handle errors
        if($tweets['errors']) {
            foreach($tweets['errors'] as $key => $error) {
                // create array of errros
                $errors['error'] = $error->message;
                break; // just get first error.
            }

            // return errors as array.
            return $errors;
        }

        //if you going to use it in javascript.
        if($json)
            return json_encode($tweets);

        return $tweets;
    }

    /**
    * get user object and validate it
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @param   [type]     $user_screen_name [description]
    * @return  [type]                       [description]
    */
    static public function get_user($user_screen_name) {
        $cb = self::cb_auth();

        $params = array(
            'screen_name' => $user_screen_name,
        );
        $user = (array) $cb->users_lookup($params);

        //unset rubbish that would break foreach loop
        unset($user['httpstatus']);
        unset($user['rate']);

        //handle errors
        if($user['errors']) {
        foreach($user['errors'] as $key => $error) {
            // create array of errros
            $errors['error'] = $error->message;
            break; // just get first error.
        }

        // return errors as array.
        return $errors;
    }

    return $user;

    }

    /**
    * see if user exists based on screen name
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @param   string     $user_screen_name e.g. 'thisisbenchmark'
    * @return  boolean                      returns true or false
    */
    static public function user_exists($user_screen_name) {
        //if user name is not given or it's empty
        if(empty($user_screen_name))
            return false;

        //get user object
        $user = self::get_user($user_screen_name);

        //if there is an erorr, user doesn't exists
        if($user['error'])
            return false;

        return true;
    }

    /**
    * get tweet's url fromt $tweet object.
    * if you loop through most_recent tweets e.g.
    * foreach($tweets as $tweet) {
    *    $tweet_url = GetTweets::tweet_url($tweet);
    * }
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @param   object     $tweet single tweet object
    * @return  string            returns url to the tweet
    */
    static public function get_tweet_url($tweet) {
        // make sure we've got value
        if(empty($tweet))
            return false;

        // https://twitter.com/thisisbenchmark/status/613368577400393728
        return 'https://twitter.com/'.$tweet->user->screen_name.'/status/'.$tweet->id;
    }

    /**
    * get username out of twitter url for user
    * @author Lukas Juhas
    * @version 1.0
    * @date    2015-09-09
    * @param   string     $url [description]
    * @return  [type]          [description]
    */
    static public function get_username_from_url($url) {
        //make sure we've got value
        if(empty($url))
            return false;

        //get everything after last forwardslash which we assume is gonna be username
        $user_name = substr(strrchr(rtrim($url, '/'), '/'), 1);

        //if url doesnt contain username return false
        if($user_name == 'twitter.com')
            return false;

        return $user_name;
    }
}


text:
dc.ui.EditorToolbar = Backbone.View.extend({

  className : 'editor_toolbar interface',

  constructor: function() {
    Backbone.View.apply(this, arguments);
    this.modes = {};
    this.viewer = currentDocument;
    this.imageUrl = this.viewer.schema.document.resources.page.image;
  },

  toggle : function() {
    if (this.modes.open == 'is') {
      this.close();
      this.showSelectedThumbnail();
    } else {
      dc.app.editor.closeAllEditors();
      this.open();
    }
  },

  showSelectedThumbnail : function() {
    $('.DV-thumbnail.DV-originallySelected').removeClass('DV-originallySelected').addClass('DV-selected');
  },

  hideSelectedThumbnail : function() {
    $('.DV-thumbnail.DV-selected').removeClass('DV-selected').addClass('DV-originallySelected');
  }

});

redpajama_set_name: RedPajamaGithub


text:
/**
 * Max Jando - 1312825 / Patrick Fruh - 1314827
 * Durch Array realisierte Playlist
 */

package queue.playlist;

import java.io.*;
import java.util.Arrays;

/**
 * @author Herdt/Kaiser
 *
 */
public class Playlist {
	final private static int DEFAULTLEN = 20;
	private String playlistName;
	private Musiktitel[] lieder;
	private int freeIndex = 0;

	/**
	 * Erstelle Queue basierend auf einem Array mit Standardlänge
	 *
	 */
	public Playlist() {
		lieder = new Musiktitel[DEFAULTLEN];
		playlistName = "Unbenannt";
	}

	/**
	 * Erstelle Queue basierend auf einem Array mit Standardlänge
	 *
	 * @param name
	 *            Der Name der Playlist
	 */
	public Playlist(String name) {
		lieder = new Musiktitel[DEFAULTLEN];
		playlistName = name;
	}

	/**
	 * Erstelle Queue basierend auf einem Array mit festgelegter Länge
	 *
	 * @param name
	 *            Der Name der Playlist
	 */
	public Playlist(String name, int groesse) {
		lieder = new Musiktitel[groesse];
		playlistName = name;
	}

	/**
	 * Emulation einer Play-Funktionalität: Erstes Element wird gelöscht
	 *
	 */
	public void play() {

		// Entferne erstes Element falls vorhanden und sortiere Playlist neu
		if (freeIndex != 0) {
			lieder[0] = null;
			reAlignPlaylist();
			freeIndex--;
		}

	}

	/**
	 * †bergebener Musiktitel wird am Ende der Playlist hinzugefügt
	 *
	 * @param neuerMusiktitel
	 *            Der Musiktitel, der der Playlist hinzugefügt werden soll.
	 */
	public void hinzufuegenAmEnde(Musiktitel neuerMusiktitel) {
		// Wenn die Playliste nicht voll ist, Lied am Ende anfügen und Ende
		// weiter nach hinten verschieben.
		if (freeIndex < lieder.length) {
			lieder[freeIndex] = neuerMusiktitel;
			freeIndex++;
		}
	}

	/**
	 * Übergebener Musiktitel wird aus Playlist entfernt.
	 *
	 * @param zuEntfernen
	 *            Der Musiktitel, der aus der Playlist entfernt werden soll.
	 */
	public void entferneMusiktitel(Musiktitel zuEntfernen) {
		int count = 0;
		boolean found = false;

		// Durchlaufe ganze Playlist, bis Titel gefunden wurde
		while (!found && count < freeIndex) {
			// Lösche Titel und sortiere Playliste neu
			if (lieder[count].equals(zuEntfernen)) {
				lieder[count] = null;
				reAlignPlaylist();
				freeIndex--;
				found = true;
			}
			count++;
		}
	}

	/**
	 * Alle in dieser Playlist enthaltenen Titel als Array zurückliefern
	 *
	 * @return Ein Array, das so lang ist, wie die Playlist Titel enthält.
	 */
	public Musiktitel[] getMusiktitel() {
		return lieder;
	}

	/**
	 * Alle Inhalte der Playlist löschen.
	 */
	public void leerePlaylist() {
		Arrays.fill(lieder, null);
	}

	/**
	 * Übergebene Datei wird zeilenweise eingelesen. Die Datei muss
	 * folgendermaßen aufgebaut sein: Titel [Tab] Künstler [neue Zeile]
	 *
	 * @param file
	 * @throws IOException
	 */
	public void leseAusDatei(File file) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader(file));
		String zeile;
		String[] split;
		Musiktitel lied;

		// Datei Zeile für Zeile durchlaufen und neue Musiktitelobjekte anlegen
		while ((zeile = in.readLine()) != null) {
			split = zeile.split("\t");
			lied = new Musiktitel(split[0], split[1]);
			hinzufuegenAmEnde(lied);
		}

		in.close();
	}

	/**
	 * Der Übergebene Musiktitel wird in der Playlist eine Position weiter
	 * bewegt.
	 *
	 * @param musiktitel
	 */
	public void bewegeTitelEinePositionWeiter(Musiktitel musiktitel) {
		Musiktitel temp;
		boolean found = false;
		int count = 0;

		// Durchlaufe Playlist von oben nach unten, bis Titel gefunden wurde
		while (!found && count < freeIndex) {
			if (lieder[count + 1] != null) {
				if (lieder[count].equals(musiktitel)) {
					// Titel mit dem darunter vertauschen
					temp = lieder[count + 1];
					lieder[count + 1] = lieder[count];
					lieder[count] = temp;
					found = true;
				}
			}
			count++;
		}
	}

	/**
	 * Der Übergebene Musiktitel wird in der Playlist eine Position zurück
	 * bewegt.
	 *
	 * @param musiktitel
	 */
	public void bewegeTitelEinePositionZurueck(Musiktitel musiktitel) {
		Musiktitel temp;
		boolean found = false;
		int count = freeIndex - 1;

		// Durchlaufe Playlist von unten nach oben, bis Titel gefunden wurde
		while (!found && count > 0) {
			if (lieder[count - 1] != null) {
				if (lieder[count].equals(musiktitel)) {
					// Titel mit dem darüber vertauschen
					temp = lieder[count - 1];
					lieder[count - 1] = lieder[count];
					lieder[count] = temp;
					found = true;
				}
			}
			count--;
		}

	}

	/**
	 * Liefert den Namen dieser Playlist
	 *
	 * @return Der Name dieser Playlist
	 */
	public String getName() {
		return playlistName;
	}

	/**
	 * Verändert den Namen dieser Playlist
	 *
	 * @param name
	 *            Der neue Name dieser Playlist
	 */
	public void setName(String name) {
		playlistName = name;
	}

	/**
	 * Hängt eine neue Playlist an die Aktuelle, die Länge der neuen Playlist
	 * ist die Kombinierte der beiden alten
	 *
	 * @param anderePlaylist
	 */
	public void haengePlaylistAn(Playlist anderePlaylist) {
		// Lieder aus Playlist 1 und 2 zwischenspeichern.
		Musiktitel[] altelieder = getMusiktitel();
		Musiktitel[] neuelieder = anderePlaylist.getMusiktitel();
		int count = 0, arraycount = 0;

		lieder = new Musiktitel[altelieder.length + neuelieder.length];

		// Playlist 1 in neue Playlist kopieren
		while (arraycount < altelieder.length) {
			if (altelieder[arraycount] != null) {
				lieder[count] = altelieder[arraycount];
				count++;
			}
			arraycount++;
		}

		arraycount = 0;

		// Playlist 2 in neue Playlist kopieren
		while (arraycount < neuelieder.length) {
			if (neuelieder[arraycount] != null) {
				lieder[count] = neuelieder[arraycount];
				count++;
			}
			arraycount++;
		}

		// Freier Index nun bei count
		freeIndex = count;
	}

	/**
	 * Playlist neu aufbauen, schiebt alle Lieder zusammen, entfernt also leere
	 * Einträge vom Anfang und aus der Mitte
	 */
	private void reAlignPlaylist() {
		int count = 0;
		int swapcount;

		// Playlist komplett durchlaufen
		while (count < lieder.length) {
			if (lieder[count] == null) {
				swapcount = count;
				// Jedes Element, welches auf ein Leeres folgt, eins nach vorne
				// schieben
				while (swapcount < lieder.length - 1) {
					lieder[swapcount] = lieder[swapcount + 1];
					swapcount++;
				}
			}
			count++;
		}
	}
}


text:
#if !defined(_WIN32) && !defined(__CYGWIN__)

#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <inttypes.h>

#else

#include <windows.h>

#define PRIx64 "I64x"
#define PRId64 "I64d"

#endif

#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include <yara.h>

#include "args.h"
#include "common.h"
#include "threading.h"

#define ERROR_COULD_NOT_CREATE_THREAD  100

#ifndef MAX_PATH
#define MAX_PATH 256
#endif

#ifndef min
#define min(x, y)  ((x < y) ? (x) : (y))
#endif

#ifdef _MSC_VER
#define snprintf _snprintf
#define strdup _strdup
#endif

#define MAX_QUEUED_FILES 64

typedef struct _MODULE_DATA
{
  const char* module_name;
  YR_MAPPED_FILE mapped_file;
  struct _MODULE_DATA* next;

} MODULE_DATA;

typedef struct _CALLBACK_ARGS
{
  const char* file_path;
  int current_count;

} CALLBACK_ARGS;

typedef struct _THREAD_ARGS
{
  YR_SCANNER*       scanner;
  CALLBACK_ARGS     callback_args;
  time_t            start_time;
  int               current_count;

} THREAD_ARGS;

typedef struct _QUEUED_FILE
{
  char* path;

} QUEUED_FILE;

typedef struct COMPILER_RESULTS
{
  int errors;
  int warnings;

} COMPILER_RESULTS;

#define MAX_ARGS_TAG            32
#define MAX_ARGS_IDENTIFIER     32
#define MAX_ARGS_EXT_VAR        32
#define MAX_ARGS_MODULE_DATA    32

static char* atom_quality_table;
static char* tags[MAX_ARGS_TAG + 1];
static char* identifiers[MAX_ARGS_IDENTIFIER + 1];
static char* ext_vars[MAX_ARGS_EXT_VAR + 1];
static char* modules_data[MAX_ARGS_EXT_VAR + 1];

static bool recursive_search = false;
static bool show_module_data = false;
static bool show_tags = false;
static bool show_stats = false;
static bool show_strings = false;
static bool show_string_length = false;
static bool show_meta = false;
static bool show_namespace = false;
static bool show_version = false;
static bool show_help = false;
static bool ignore_warnings = false;
static bool fast_scan = false;
static bool negate = false;
static bool print_count_only = false;
static bool fail_on_warnings = false;
static bool rules_are_compiled = false;
static int total_count = 0;
static int limit = 0;
static int timeout = 1000000;
static int stack_size = DEFAULT_STACK_SIZE;
static int threads = YR_MAX_THREADS;
static int max_strings_per_rule = DEFAULT_MAX_STRINGS_PER_RULE;

#define USAGE_STRING \
    "Usage: yara [OPTION]... [NAMESPACE:]RULES_FILE... FILE | DIR | PID"

args_option_t options[] =
{
  OPT_STRING(0, "atom-quality-table", &atom_quality_table,
      "path to a file with the atom quality table", "FILE"),

  OPT_BOOLEAN('C', "compiled-rules", &rules_are_compiled,
      "load compiled rules"),

  OPT_BOOLEAN('c', "count", &print_count_only,
      "print only number of matches"),

  OPT_STRING_MULTI('d', "define", &ext_vars, MAX_ARGS_EXT_VAR,
      "define external variable", "VAR=VALUE"),

  OPT_BOOLEAN(0, "fail-on-warnings", &fail_on_warnings,
      "fail on warnings"),

  OPT_BOOLEAN('f', "fast-scan", &fast_scan,
      "fast matching mode"),

  OPT_BOOLEAN('h', "help", &show_help,
      "show this help and exit"),

  OPT_STRING_MULTI('i', "identifier", &identifiers, MAX_ARGS_IDENTIFIER,
      "print only rules named IDENTIFIER", "IDENTIFIER"),

  OPT_INTEGER('l', "max-rules", &limit,
      "abort scanning after matching a NUMBER of rules", "NUMBER"),

  OPT_INTEGER(0, "max-strings-per-rule", &max_strings_per_rule,
      "set maximum number of strings per rule (default=10000)", "NUMBER"),

  OPT_STRING_MULTI('x', "module-data", &modules_data, MAX_ARGS_MODULE_DATA,
      "pass FILE's content as extra data to MODULE", "MODULE=FILE"),

  OPT_BOOLEAN('n', "negate", &negate,
      "print only not satisfied rules (negate)", NULL),

  OPT_BOOLEAN('w', "no-warnings", &ignore_warnings,
      "disable warnings"),

  OPT_BOOLEAN('m', "print-meta", &show_meta,
      "print metadata"),

  OPT_BOOLEAN('D', "print-module-data", &show_module_data,
      "print module data"),

  OPT_BOOLEAN('e', "print-namespace", &show_namespace,
      "print rules' namespace"),

  OPT_BOOLEAN('S', "print-stats", &show_stats,
      "print rules' statistics"),

  OPT_BOOLEAN('s', "print-strings", &show_strings,
      "print matching strings"),

  OPT_BOOLEAN('L', "print-string-length", &show_string_length,
      "print length of matched strings"),

  OPT_BOOLEAN('g', "print-tags", &show_tags,
      "print tags"),

  OPT_BOOLEAN('r', "recursive", &recursive_search,
      "recursively search directories"),

  OPT_INTEGER('k', "stack-size", &stack_size,
      "set maximum stack size (default=16384)", "SLOTS"),

  OPT_STRING_MULTI('t', "tag", &tags, MAX_ARGS_TAG,
      "print only rules tagged as TAG", "TAG"),

  OPT_INTEGER('p', "threads", &threads,
      "use the specified NUMBER of threads to scan a directory", "NUMBER"),

  OPT_INTEGER('a', "timeout", &timeout,
      "abort scanning after the given number of SECONDS", "SECONDS"),

  OPT_BOOLEAN('v', "version", &show_version,
      "show version information"),

  OPT_END()
};

// file_queue is size-limited queue stored as a circular array, files are
// removed from queue_head position and new files are added at queue_tail
// position. The array has room for one extra element to avoid queue_head
// being equal to queue_tail in a full queue. The only situation where
// queue_head == queue_tail is when queue is empty.

QUEUED_FILE file_queue[MAX_QUEUED_FILES + 1];

int queue_head;
int queue_tail;

SEMAPHORE used_slots;
SEMAPHORE unused_slots;

MUTEX queue_mutex;
MUTEX output_mutex;

MODULE_DATA* modules_data_list = NULL;

static int file_queue_init()
{
  int result;

  queue_tail = 0;
  queue_head = 0;

  result = mutex_init(&queue_mutex);

  if (result != 0)
    return result;

  result = semaphore_init(&used_slots, 0);

  if (result != 0)
    return result;

 return semaphore_init(&unused_slots, MAX_QUEUED_FILES);
}

static void file_queue_destroy()
{
  mutex_destroy(&queue_mutex);
  semaphore_destroy(&unused_slots);
  semaphore_destroy(&used_slots);
}

static void file_queue_finish()
{
  int i;

  for (i = 0; i < YR_MAX_THREADS; i++)
    semaphore_release(&used_slots);
}

static void file_queue_put(
    const char* file_path)
{
  semaphore_wait(&unused_slots);
  mutex_lock(&queue_mutex);

  file_queue[queue_tail].path = strdup(file_path);
  queue_tail = (queue_tail + 1) % (MAX_QUEUED_FILES + 1);

  mutex_unlock(&queue_mutex);
  semaphore_release(&used_slots);
}

static char* file_queue_get()
{
  char* result;

  semaphore_wait(&used_slots);
  mutex_lock(&queue_mutex);

  if (queue_head == queue_tail) // queue is empty
  {
    result = NULL;
  }
  else
  {
    result = file_queue[queue_head].path;
    queue_head = (queue_head + 1) % (MAX_QUEUED_FILES + 1);
  }

  mutex_unlock(&queue_mutex);
  semaphore_release(&unused_slots);

  return result;
}

#if defined(_WIN32) || defined(__CYGWIN__)

static bool is_directory(
    const char* path)
{
  DWORD attributes = GetFileAttributes(path);

  if (attributes != INVALID_FILE_ATTRIBUTES &&
	  attributes & FILE_ATTRIBUTE_DIRECTORY)
    return true;
  else
    return false;
}

static void scan_dir(
    const char* dir,
    int recursive,
    time_t start_time)
{
  static char path_and_mask[MAX_PATH];

  snprintf(path_and_mask, sizeof(path_and_mask), "%s\\*", dir);

  WIN32_FIND_DATA FindFileData;
  HANDLE hFind = FindFirstFile(path_and_mask, &FindFileData);

  if (hFind != INVALID_HANDLE_VALUE)
  {
    do
    {
      char full_path[MAX_PATH];

      snprintf(full_path, sizeof(full_path), "%s\\%s",
               dir, FindFileData.cFileName);

      if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
      {
        file_queue_put(full_path);
      }
      else if (recursive &&
               strcmp(FindFileData.cFileName, ".") != 0 &&
               strcmp(FindFileData.cFileName, "..") != 0)
      {
        scan_dir(full_path, recursive, start_time);
      }

    } while (FindNextFile(hFind, &FindFileData));

    FindClose(hFind);
  }
}

#else

static bool is_directory(
    const char* path)
{
  struct stat st;

  if (stat(path,&st) == 0)
    return S_ISDIR(st.st_mode);

  return 0;
}

static void scan_dir(
    const char* dir,
    int recursive,
    time_t start_time)
{
  DIR* dp = opendir(dir);

  if (dp)
  {
    struct dirent* de = readdir(dp);

    while (de && difftime(time(NULL), start_time) < timeout)
    {
      char full_path[MAX_PATH];
      struct stat st;

      snprintf(full_path, sizeof(full_path), "%s/%s", dir, de->d_name);

      int err = lstat(full_path, &st);

      if (err == 0)
      {
        if(S_ISREG(st.st_mode))
        {
          file_queue_put(full_path);
        }
        else if(recursive &&
                S_ISDIR(st.st_mode) &&
                !S_ISLNK(st.st_mode) &&
                strcmp(de->d_name, ".") != 0 &&
                strcmp(de->d_name, "..") != 0)
        {
          scan_dir(full_path, recursive, start_time);
        }
      }

      de = readdir(dp);
    }

    closedir(dp);
  }
}

#endif

static void print_string(
    const uint8_t* data,
    int length)
{
  for (int i = 0; i < length; i++)
  {
    if (data[i] >= 32 && data[i] <= 126)
      printf("%c", data[i]);
    else
      printf("\\x%02X", data[i]);
  }

  printf("\n");
}

static char cescapes[] =
{
  0  , 0  , 0  , 0  , 0  , 0  , 0  , 'a',
  'b', 't', 'n', 'v', 'f', 'r', 0  , 0  ,
  0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
  0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
};

static void print_escaped(
    const uint8_t* data,
    size_t length)
{
  size_t i;

  for (i = 0; i < length; i++)
  {
    switch (data[i])
    {
      case '\"':
      case '\'':
      case '\\':
        printf("\\%c", data[i]);
        break;

      default:
        if (data[i] >= 127)
          printf("\\%03o", data[i]);
        else if (data[i] >= 32)
          putchar(data[i]);
        else if (cescapes[data[i]] != 0)
          printf("\\%c", cescapes[data[i]]);
        else
          printf("\\%03o", data[i]);
    }
  }
}

static void print_hex_string(
    const uint8_t* data,
    int length)
{
  for (int i = 0; i < min(32, length); i++)
    printf("%s%02X", (i == 0 ? "" : " "), data[i]);

  puts(length > 32 ? " ..." : "");
}

static void print_error(
    int error)
{
  switch (error)
  {
    case ERROR_SUCCESS:
      break;
    case ERROR_COULD_NOT_ATTACH_TO_PROCESS:
      fprintf(stderr, "can not attach to process (try running as root)\n");
      break;
    case ERROR_INSUFFICIENT_MEMORY:
      fprintf(stderr, "not enough memory\n");
      break;
    case ERROR_SCAN_TIMEOUT:
      fprintf(stderr, "scanning timed out\n");
      break;
    case ERROR_COULD_NOT_OPEN_FILE:
      fprintf(stderr, "could not open file\n");
      break;
    case ERROR_UNSUPPORTED_FILE_VERSION:
      fprintf(stderr, "rules were compiled with a different version of YARA\n");
      break;
    case ERROR_INVALID_FILE:
      fprintf(stderr, "invalid compiled rules file.\n");
      break;
    case ERROR_CORRUPT_FILE:
      fprintf(stderr, "corrupt compiled rules file.\n");
      break;
    case ERROR_EXEC_STACK_OVERFLOW:
      fprintf(stderr, "stack overflow while evaluating condition "
                      "(see --stack-size argument) \n");
      break;
    case ERROR_INVALID_EXTERNAL_VARIABLE_TYPE:
      fprintf(stderr, "invalid type for external variable\n");
      break;
    case ERROR_TOO_MANY_MATCHES:
      fprintf(stderr, "too many matches\n");
      break;
    default:
      fprintf(stderr, "error: %d\n", error);
      break;
  }
}

static void print_scanner_error(
    YR_SCANNER* scanner,
    int error)
{
  YR_RULE* rule = yr_scanner_last_error_rule(scanner);
  YR_STRING* string = yr_scanner_last_error_string(scanner);

  if (rule != NULL && string != NULL)
  {
    fprintf(
        stderr,
        "string \"%s\" in rule \"%s\" caused ",
        string->identifier,
        rule->identifier);
  }
  else if (rule != NULL)
  {
    fprintf(
        stderr,
        "rule \"%s\" caused ",
        rule->identifier);
  }

  print_error(error);
}

static void print_compiler_error(
    int error_level,
    const char* file_name,
    int line_number,
    const char* message,
    void* user_data)
{
  if (error_level == YARA_ERROR_LEVEL_ERROR)
  {
    fprintf(stderr, "%s(%d): error: %s\n", file_name, line_number, message);
  }
  else if (!ignore_warnings)
  {
    COMPILER_RESULTS* compiler_results = (COMPILER_RESULTS*) user_data;
    compiler_results->warnings++;

    fprintf(stderr, "%s(%d): warning: %s\n", file_name, line_number, message);
  }
}

static void print_rules_stats(
    YR_RULES* rules)
{
  YR_RULES_STATS stats;

  int t = sizeof(stats.top_ac_match_list_lengths) /
          sizeof(stats.top_ac_match_list_lengths[0]);

  int result = yr_rules_get_stats(rules, &stats);

  if (result != ERROR_SUCCESS)
  {
     print_error(result);
     return;
  }

  printf(
      "size of AC transition table        : %d\n",
      stats.ac_tables_size);

  printf(
      "average length of AC matches lists : %f\n",
      stats.ac_average_match_list_length);

  printf(
      "number of rules                    : %d\n",
      stats.rules);

  printf(
      "number of strings                  : %d\n",
      stats.strings);

  printf(
      "number of AC matches               : %d\n",
      stats.ac_matches);

  printf(
      "number of AC matches in root node  : %d\n",
      stats.ac_root_match_list_length);

  printf("number of AC matches in top %d longest lists\n", t);

  for (int i = 0; i < t; i++)
    printf(" %3d: %d\n", i + 1, stats.top_ac_match_list_lengths[i]);

  printf("match list length percentiles\n");

  for (int i = 0; i <= 100; i++)
    printf(" %3d: %d\n", i, stats.ac_match_list_length_pctls[i]);
}

static int handle_message(
    int message,
    YR_RULE* rule,
    void* data)
{
  const char* tag;
  bool show = true;

  if (tags[0] != NULL)
  {
    // The user specified one or more -t <tag> arguments, let's show this rule
    // only if it's tagged with some of the specified tags.

    show = false;

    for (int i = 0; !show && tags[i] != NULL; i++)
    {
      yr_rule_tags_foreach(rule, tag)
      {
        if (strcmp(tag, tags[i]) == 0)
        {
          show = true;
          break;
        }
      }
    }
  }

  if (identifiers[0] != NULL)
  {
    // The user specified one or more -i <identifier> arguments, let's show
    // this rule only if it's identifier is among of the provided ones.

    show = false;

    for (int i = 0; !show && identifiers[i] != NULL; i++)
    {
      if (strcmp(identifiers[i], rule->identifier) == 0)
      {
        show = true;
        break;
      }
    }
  }

  bool is_matching = (message == CALLBACK_MSG_RULE_MATCHING);

  show = show && ((!negate && is_matching) || (negate && !is_matching));

  if (show && !print_count_only)
  {
    mutex_lock(&output_mutex);

    if (show_namespace)
      printf("%s:", rule->ns->name);

    printf("%s ", rule->identifier);

    if (show_tags)
    {
      printf("[");

      yr_rule_tags_foreach(rule, tag)
      {
        // print a comma except for the first tag
        if (tag != rule->tags)
          printf(",");

        printf("%s", tag);
      }

      printf("] ");
    }

    // Show meta-data.

    if (show_meta)
    {
      YR_META* meta;

      printf("[");

      yr_rule_metas_foreach(rule, meta)
      {
        if (meta != rule->metas)
          printf(",");

        if (meta->type == META_TYPE_INTEGER)
        {
          printf("%s=%" PRId64, meta->identifier, meta->integer);
        }
        else if (meta->type == META_TYPE_BOOLEAN)
        {
          printf("%s=%s", meta->identifier, meta->integer ? "true" : "false");
        }
        else
        {
          printf("%s=\"", meta->identifier);
          print_escaped((uint8_t*) (meta->string), strlen(meta->string));
          putchar('"');
        }
      }

      printf("] ");
    }

    printf("%s\n", ((CALLBACK_ARGS*) data)->file_path);

    // Show matched strings.

    if (show_strings || show_string_length)
    {
      YR_STRING* string;

      yr_rule_strings_foreach(rule, string)
      {
        YR_MATCH* match;

        yr_string_matches_foreach(string, match)
        {
          if (show_string_length)
            printf("0x%" PRIx64 ":%d:%s",
              match->base + match->offset,
              match->data_length,
              string->identifier);
          else
            printf("0x%" PRIx64 ":%s",
              match->base + match->offset,
              string->identifier);

          if (show_strings)
          {
            printf(": ");

            if (STRING_IS_HEX(string))
              print_hex_string(match->data, match->data_length);
            else
              print_string(match->data, match->data_length);
          }
          else
          {
            printf("\n");
          }
        }
      }
    }

    mutex_unlock(&output_mutex);
  }

  if (is_matching)
  {
    ((CALLBACK_ARGS*) data)->current_count++;
    total_count++;
  }

  if (limit != 0 && total_count >= limit)
    return CALLBACK_ABORT;

  return CALLBACK_CONTINUE;
}

static int callback(
    int message,
    void* message_data,
    void* user_data)
{
  YR_MODULE_IMPORT* mi;
  YR_OBJECT* object;
  MODULE_DATA* module_data;

  switch(message)
  {
    case CALLBACK_MSG_RULE_MATCHING:
    case CALLBACK_MSG_RULE_NOT_MATCHING:
      return handle_message(message, (YR_RULE*) message_data, user_data);

    case CALLBACK_MSG_IMPORT_MODULE:

      mi = (YR_MODULE_IMPORT*) message_data;
      module_data = modules_data_list;

      while (module_data != NULL)
      {
        if (strcmp(module_data->module_name, mi->module_name) == 0)
        {
          mi->module_data = (void*) module_data->mapped_file.data;
          mi->module_data_size = module_data->mapped_file.size;
          break;
        }

        module_data = module_data->next;
      }

      return CALLBACK_CONTINUE;

    case CALLBACK_MSG_MODULE_IMPORTED:

      if (show_module_data)
      {
        object = (YR_OBJECT*) message_data;

        mutex_lock(&output_mutex);

        yr_object_print_data(object, 0, 1);
        printf("\n");

        mutex_unlock(&output_mutex);
      }

      return CALLBACK_CONTINUE;
  }

  return CALLBACK_ERROR;
}

#if defined(_WIN32) || defined(__CYGWIN__)
static DWORD WINAPI scanning_thread(LPVOID param)
#else
static void* scanning_thread(void* param)
#endif
{
  int result = ERROR_SUCCESS;
  THREAD_ARGS* args = (THREAD_ARGS*) param;
  char* file_path = file_queue_get();

  while (file_path != NULL)
  {
    args->callback_args.current_count = 0;
    args->callback_args.file_path = file_path;

    int elapsed_time = (int) difftime(time(NULL), args->start_time);

    if (elapsed_time < timeout)
    {
      yr_scanner_set_timeout(args->scanner, timeout - elapsed_time);

      result = yr_scanner_scan_file(args->scanner, file_path);

      if (print_count_only)
      {
        mutex_lock(&output_mutex);
        printf("%s: %d\n", file_path, args->callback_args.current_count);
        mutex_unlock(&output_mutex);
      }

      if (result != ERROR_SUCCESS)
      {
        mutex_lock(&output_mutex);
        fprintf(stderr, "error scanning %s: ", file_path);
        print_scanner_error(args->scanner, result);
        mutex_unlock(&output_mutex);
      }

      free(file_path);
      file_path = file_queue_get();
    }
    else
    {
      file_path = NULL;
    }
  }

  return 0;
}

static int define_external_variables(
    YR_RULES* rules,
    YR_COMPILER* compiler)
{
  int result = ERROR_SUCCESS;

  for (int i = 0; ext_vars[i] != NULL; i++)
  {
    char* equal_sign = strchr(ext_vars[i], '=');

    if (!equal_sign)
    {
      fprintf(stderr, "error: wrong syntax for `-d` option.\n");
      return ERROR_SUCCESS;
    }

    // Replace the equal sign with null character to split the external
    // variable definition (i.e: myvar=somevalue) in two strings: identifier
    // and value.

    *equal_sign = '\0';

    char* identifier = ext_vars[i];
    char* value = equal_sign + 1;

    if (is_float(value))
    {
      if (rules != NULL)
        result = yr_rules_define_float_variable(
            rules,
            identifier,
            atof(value));

      if (compiler != NULL)
        result = yr_compiler_define_float_variable(
            compiler,
            identifier,
            atof(value));
    }
    else if (is_integer(value))
    {
      if (rules != NULL)
        result = yr_rules_define_integer_variable(
            rules,
            identifier,
            atoi(value));

      if (compiler != NULL)
        result = yr_compiler_define_integer_variable(
            compiler,
            identifier,
            atoi(value));
    }
    else if (strcmp(value, "true") == 0 || strcmp(value, "false") == 0)
    {
      if (rules != NULL)
        result = yr_rules_define_boolean_variable(
            rules,
            identifier,
            strcmp(value, "true") == 0);

      if (compiler != NULL)
        result = yr_compiler_define_boolean_variable(
            compiler,
            identifier,
            strcmp(value, "true") == 0);
    }
    else
    {
      if (rules != NULL)
        result = yr_rules_define_string_variable(
            rules,
            identifier,
            value);

      if (compiler != NULL)
        result = yr_compiler_define_string_variable(
            compiler,
            identifier,
            value);
    }
  }

  return result;
}

static int load_modules_data()
{
  for (int i = 0; modules_data[i] != NULL; i++)
  {
    char* equal_sign = strchr(modules_data[i], '=');

    if (!equal_sign)
    {
      fprintf(stderr, "error: wrong syntax for `-x` option.\n");
      return false;
    }

    *equal_sign = '\0';

    MODULE_DATA* module_data = (MODULE_DATA*) malloc(sizeof(MODULE_DATA));

    if (module_data != NULL)
    {
      module_data->module_name = modules_data[i];

      int result = yr_filemap_map(equal_sign + 1, &module_data->mapped_file);

      if (result != ERROR_SUCCESS)
      {
        free(module_data);
        fprintf(stderr, "error: could not open file \"%s\".\n", equal_sign + 1);
        return false;
      }

      module_data->next = modules_data_list;
      modules_data_list = module_data;
    }
  }

  return true;
}

static void unload_modules_data()
{
  MODULE_DATA* module_data = modules_data_list;

  while(module_data != NULL)
  {
    MODULE_DATA* next_module_data = module_data->next;

    yr_filemap_unmap(&module_data->mapped_file);
    free(module_data);

    module_data = next_module_data;
  }

  modules_data_list = NULL;
}

int main(
    int argc,
    const char** argv)
{
  COMPILER_RESULTS cr;

  YR_COMPILER* compiler = NULL;
  YR_RULES* rules = NULL;
  YR_SCANNER* scanner = NULL;

  int flags = 0;
  int result, i;

  argc = args_parse(options, argc, argv);

  if (show_version)
  {
    printf("%s\n", YR_VERSION);
    return EXIT_SUCCESS;
  }

  if (show_help)
  {
    printf(
      "YARA %s, the pattern matching swiss army knife.\n"
      "%s\n\n"
      "Mandatory arguments to long options are mandatory for "
      "short options too.\n\n", YR_VERSION, USAGE_STRING);

    args_print_usage(options, 40);
    printf("\nSend bug reports and suggestions to: vmalvarez@virustotal.com.\n");

    return EXIT_SUCCESS;
  }

  if (threads > YR_MAX_THREADS)
  {
    fprintf(stderr, "maximum number of threads is %d\n", YR_MAX_THREADS);
    return EXIT_FAILURE;
  }

  if (argc < 2)
  {
    // After parsing the command-line options we expect two additional
    // arguments, the rules file and the target file, directory or pid to
    // be scanned.

    fprintf(stderr, "yara: wrong number of arguments\n");
    fprintf(stderr, "%s\n\n", USAGE_STRING);
    fprintf(stderr, "Try `--help` for more options\n");

    return EXIT_FAILURE;
  }

  if (!load_modules_data())
    exit_with_code(EXIT_FAILURE);

  result = yr_initialize();

  if (result != ERROR_SUCCESS)
  {
    fprintf(stderr, "error: initialization error (%d)\n", result);
    exit_with_code(EXIT_FAILURE);
  }

  yr_set_configuration(YR_CONFIG_STACK_SIZE, &stack_size);
  yr_set_configuration(YR_CONFIG_MAX_STRINGS_PER_RULE, &max_strings_per_rule);

  // Try to load the rules file as a binary file containing
  // compiled rules first

  if (rules_are_compiled)
  {
    // When a binary file containing compiled rules is provided, yara accepts
    // only two arguments, the compiled rules file and the target to be scanned.

    if (argc != 2)
    {
      fprintf(stderr,
        "error: can't accept multiple rules files if one of them is in "
        "compiled form.\n");
      exit_with_code(EXIT_FAILURE);
    }

    result = yr_rules_load(argv[0], &rules);

    if (result == ERROR_SUCCESS)
      result = define_external_variables(rules, NULL);
  }
  else
  {
    // Rules file didn't contain compiled rules, let's handle it
    // as a text file containing rules in source form.

    if (yr_compiler_create(&compiler) != ERROR_SUCCESS)
      exit_with_code(EXIT_FAILURE);

    result = define_external_variables(NULL, compiler);

    if (result != ERROR_SUCCESS)
    {
      print_error(result);
      exit_with_code(EXIT_FAILURE);
    }

    if (atom_quality_table != NULL)
    {
      result = yr_compiler_load_atom_quality_table(
          compiler, atom_quality_table, 0);

      if (result != ERROR_SUCCESS)
      {
        fprintf(stderr, "error loading atom quality table: ");
        print_error(result);
        exit_with_code(EXIT_FAILURE);
      }
    }

    cr.errors = 0;
    cr.warnings = 0;

    yr_compiler_set_callback(compiler, print_compiler_error, &cr);

    if (!compile_files(compiler, argc, argv))
      exit_with_code(EXIT_FAILURE);

    if (cr.errors > 0)
      exit_with_code(EXIT_FAILURE);

    if (fail_on_warnings && cr.warnings > 0)
      exit_with_code(EXIT_FAILURE);

    result = yr_compiler_get_rules(compiler, &rules);

    yr_compiler_destroy(compiler);

    compiler = NULL;
  }

  if (result != ERROR_SUCCESS)
  {
    print_error(result);
    exit_with_code(EXIT_FAILURE);
  }

  if (show_stats)
    print_rules_stats(rules);

  mutex_init(&output_mutex);

  if (fast_scan)
    flags |= SCAN_FLAGS_FAST_MODE;

  if (is_directory(argv[argc - 1]))
  {
    if (file_queue_init() != 0)
    {
      print_error(ERROR_INTERNAL_FATAL_ERROR);
      exit_with_code(EXIT_FAILURE);
    }

    THREAD thread[YR_MAX_THREADS];
    THREAD_ARGS thread_args[YR_MAX_THREADS];

    time_t start_time = time(NULL);

    for (i = 0; i < threads; i++)
    {
      thread_args[i].start_time = start_time;
      thread_args[i].current_count = 0;

      result = yr_scanner_create(rules, &thread_args[i].scanner);

      if (result != ERROR_SUCCESS)
      {
        print_error(result);
        exit_with_code(EXIT_FAILURE);
      }

      yr_scanner_set_callback(
          thread_args[i].scanner,
          callback,
          &thread_args[i].callback_args);

      yr_scanner_set_flags(thread_args[i].scanner, flags);

      if (create_thread(&thread[i], scanning_thread, (void*) &thread_args[i]))
      {
        print_error(ERROR_COULD_NOT_CREATE_THREAD);
        exit_with_code(EXIT_FAILURE);
      }
    }

    scan_dir(argv[argc - 1], recursive_search, start_time);

    file_queue_finish();

    // Wait for scan threads to finish
    for (i = 0; i < threads; i++)
      thread_join(&thread[i]);

    for (i = 0; i < threads; i++)
      yr_scanner_destroy(thread_args[i].scanner);

    file_queue_destroy();
  }
  else
  {
    CALLBACK_ARGS user_data = { argv[argc - 1], 0 };

    result = yr_scanner_create(rules, &scanner);

    if (result != ERROR_SUCCESS)
    {
      fprintf(stderr, "error: %d\n", result);
      exit_with_code(EXIT_FAILURE);
    }

    yr_scanner_set_callback(scanner, callback, &user_data);
    yr_scanner_set_flags(scanner, flags);
    yr_scanner_set_timeout(scanner, timeout);

    if (is_integer(argv[argc - 1]))
      result = yr_scanner_scan_proc(scanner, atoi(argv[argc - 1]));
    else
      result = yr_scanner_scan_file(scanner, argv[argc - 1]);

    if (result != ERROR_SUCCESS)
    {
      fprintf(stderr, "error scanning %s: ", argv[argc - 1]);
      print_scanner_error(scanner, result);
      exit_with_code(EXIT_FAILURE);
    }

    if (print_count_only)
      printf("%d\n", user_data.current_count);
  }

  result = EXIT_SUCCESS;

_exit:

  #ifdef PROFILING_ENABLED
  if (rules != NULL)
    yr_rules_print_profiling_info(rules);
  #endif

  unload_modules_data();

  if (scanner != NULL)
    yr_scanner_destroy(scanner);

  if (compiler != NULL)
    yr_compiler_destroy(compiler);

  if (rules != NULL)
    yr_rules_destroy(rules);

  yr_finalize();

  return result;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bulletin du Jardin Botanique de l'État, Bruxelles 25: 56 (1955)

#### Original name
Lactarius pseudolignyotus R. Heim

### Remarks
null


text:
package software.amazon.awssdk.services.dynamodb;

import java.time.Duration;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.awscore.retry.AwsRetryPolicy;
import software.amazon.awssdk.core.client.config.SdkClientConfiguration;
import software.amazon.awssdk.core.client.config.SdkClientOption;
import software.amazon.awssdk.core.internal.retry.SdkDefaultRetrySetting;
import software.amazon.awssdk.core.retry.RetryMode;
import software.amazon.awssdk.core.retry.RetryPolicy;
import software.amazon.awssdk.core.retry.backoff.BackoffStrategy;
import software.amazon.awssdk.core.retry.backoff.FullJitterBackoffStrategy;

/**
 * Default retry policy for DynamoDB Client.
 */
@SdkInternalApi
final class DynamoDbRetryPolicy {

    /**
     * Default max retry count for DynamoDB client, regardless of retry mode.
     **/
    private static final int MAX_ERROR_RETRY = 8;

    /**
     * Default base sleep time for DynamoDB, regardless of retry mode.
     **/
    private static final Duration BASE_DELAY = Duration.ofMillis(25);

    /**
     * The default back-off strategy for DynamoDB client, which increases
     * exponentially up to a max amount of delay. Compared to the SDK default
     * back-off strategy, it applies a smaller scale factor.
     */
    private static final BackoffStrategy BACKOFF_STRATEGY =
        FullJitterBackoffStrategy.builder()
                                 .baseDelay(BASE_DELAY)
                                 .maxBackoffTime(SdkDefaultRetrySetting.MAX_BACKOFF)
                                 .build();

    private DynamoDbRetryPolicy() {
    }

    public static RetryPolicy resolveRetryPolicy(SdkClientConfiguration config) {
        RetryPolicy configuredRetryPolicy = config.option(SdkClientOption.RETRY_POLICY);
        if (configuredRetryPolicy != null) {
            return configuredRetryPolicy;
        }

        RetryMode retryMode = RetryMode.resolver()
                                       .profileFile(() -> config.option(SdkClientOption.PROFILE_FILE))
                                       .profileName(config.option(SdkClientOption.PROFILE_NAME))
                                       .defaultRetryMode(config.option(SdkClientOption.DEFAULT_RETRY_MODE))
                                       .resolve();

        return AwsRetryPolicy.forRetryMode(retryMode)
                             .toBuilder()
                             .additionalRetryConditionsAllowed(false)
                             .numRetries(MAX_ERROR_RETRY)
                             .backoffStrategy(BACKOFF_STRATEGY)
                             .build();
    }
}


text:
package blizzard

import (
	"fmt"
	"strings"

	"net/http"

	"github.com/ewollesen/zenbot/blizzard"
	"github.com/ewollesen/zenbot/overwatch"
	"github.com/spacemonkeygo/spacelog"
)

var _ overwatch.OverwatchAPI = (*blizzardScrape)(nil)

var (
	logger = spacelog.GetLogger()
)

type blizzardScrape struct {
	client *http.Client
}

func New() *blizzardScrape {
	return &blizzardScrape{
		client: &http.Client{},
	}
}

func (b *blizzardScrape) SkillRank(platform, battle_tag string) (
	sr int, err error) {
	return overwatch.SkillRankError, fmt.Errorf("not implemented")
}

func (b *blizzardScrape) IsValidBattleTag(platform, region, battle_tag string) (
	bool, error) {

	if !blizzard.WellFormedBattleTag(battle_tag) {
		return false, nil
	}

	resp, err := b.client.Head(b.buildUrl(platform, region, battle_tag))
	if err != nil {
		return false, err
	}
	if resp.Body != nil {
		defer resp.Body.Close()
	}

	switch resp.StatusCode {
	case http.StatusNotFound:
		return false, nil
	case http.StatusOK:
		return true, nil
	default:
		return false, fmt.Errorf("unexpected status %d", resp.StatusCode)
	}
}

func (b *blizzardScrape) escapeBattleTag(in string) (out string) {
	return strings.Replace(in, "#", "-", -1)
}

func (b *blizzardScrape) buildUrl(platform, region, battle_tag string) string {
	overwatch.CheckPlatform(platform)
	overwatch.CheckRegion(region)
	return fmt.Sprintf("https://playoverwatch.com/en-us/career/%s/%s/%s",
		platform, region, b.escapeBattleTag(battle_tag))
}


text:
/*
 * Poll chat plugin
 * By bumbadadabum and Zarel.
 */

'use strict';

interface QuestionData {
	source: string; supportHTML: boolean;
}
interface Option {
	name: string; votes: number; correct?: boolean;
}

export class Poll {
	readonly activityId: 'poll';
	pollNumber: number;
	room: ChatRoom | GameRoom;
	question: string;
	supportHTML: boolean;
	voters: {[k: string]: number};
	voterIps: {[k: string]: number};
	totalVotes: number;
	timeout: NodeJS.Timer | null;
	timeoutMins: number;
	isQuiz: boolean;
	options: Map<number, Option>;
	constructor(room: ChatRoom | GameRoom, questionData: QuestionData, options: string[]) {
		this.activityId = 'poll';
		this.pollNumber = ++room.gameNumber;
		this.room = room;
		this.question = questionData.source;
		this.supportHTML = questionData.supportHTML;
		this.voters = {};
		this.voterIps = {};
		this.totalVotes = 0;
		this.timeout = null;
		this.timeoutMins = 0;
		this.isQuiz = false;

		this.options = new Map();
		for (const [i, option] of options.entries()) {
			const info: Option = {name: option, votes: 0};
			if (option.startsWith('+')) {
				this.isQuiz = true;
				info.correct = true;
				info.name = info.name.slice(1);
			}
			this.options.set(i + 1, info);
		}
	}

	vote(user: User, option: number) {
		const ip = user.latestIp;
		const userid = user.id;

		if (userid in this.voters || ip in this.voterIps) {
			return user.sendTo(this.room, `You have already voted for this poll.`);
		}

		this.voters[userid] = option;
		this.voterIps[ip] = option;
		this.options.get(option)!.votes++;
		this.totalVotes++;

		this.update();
	}

	blankvote(user: User) {
		const ip = user.latestIp;
		const userid = user.id;

		if (!(userid in this.voters) || !(ip in this.voterIps)) {
			this.voters[userid] = 0;
			this.voterIps[ip] = 0;
		}

		this.updateTo(user);
	}

	generateVotes() {
		const iconText = this.isQuiz ? ' Quiz' : ' Poll';
		let output = `

${iconText} ${this.getQuestionMarkup()}
`;
		for (const [num, option] of this.options) {
			output += `
<button class="button" style="text-align: left" value="/poll vote ${num}" name="send" title="Vote for ${num}. ${Chat.escapeHTML(option.name)}">${num}. ${this.getOptionMarkup(option)}</button>
`;
		}
		output += `
<button value="/poll results" name="send" title="View results - you will not be able to vote after viewing results">(View results)</button>
`;
		output += `</div>`;

		return output;
	}

	generateResults(ended = false, option: number | null = 0) {
		const iconText = this.isQuiz ? ' Quiz' : ' Poll';
		const icon = `<span style="border:1px solid #${ended ? '777;color:#555' : '6A6;color:#484'};border-radius:4px;padding:0 3px">${iconText}${ended ? " ended" : ""}</span>`;
		let output = `<div class="infobox"><p style="margin: 2px 0 5px 0">${icon} <strong style="font-size:11pt">${this.getQuestionMarkup()}</strong></p>`;
		const iter = this.options.entries();

		let i = iter.next();
		let c = 0;
		const colors = ['#79A', '#8A8', '#88B'];
		while (!i.done) {
			const percentage = Math.round((i.value[1].votes * 100) / (this.totalVotes || 1));
			const answerMarkup = this.isQuiz ? `<span style="color:${i.value[1].correct ? 'green' : 'red'};">${i.value[1].correct ? '' : '<s>'}${this.getOptionMarkup(i.value[1])}${i.value[1].correct ? '' : '</s>'}</span>` : this.getOptionMarkup(i.value[1]);
			output += `
${i.value[0]}. ${i.value[0] === option ? '' : ''}${answerMarkup}${i.value[0] === option ? '' : ''} (${i.value[1].votes} vote${i.value[1].votes === 1 ? '' : 's'})
 ${percentage}%
`;
			i = iter.next();
			c++;
		}
		if (option === 0 && !ended) output += '
(You can\'t vote after viewing results)
';
		output += '
';

		return output;
	}

	getQuestionMarkup() {
		if (this.supportHTML) return this.question;
		return Chat.escapeHTML(this.question);
	}

	getOptionMarkup(option: Option) {
		if (this.supportHTML) return option.name;
		return Chat.escapeHTML(option.name);
	}

	update() {
		const results = [];

		for (let i = 0; i <= this.options.size; i++) {
			results.push(this.generateResults(false, i));
		}

		// Update the poll results for everyone that has voted
		for (const id in this.room.users) {
			const user = this.room.users[id];
			if (user.id in this.voters) {
				user.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${results[this.voters[user.id]]}`);
			} else if (user.latestIp in this.voterIps) {
				user.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${results[this.voterIps[user.latestIp]]}`);
			}
		}
	}

	updateTo(user: User, connection: Connection | null = null) {
		const recipient = connection || user;
		if (user.id in this.voters) {
			recipient.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${this.generateResults(false, this.voters[user.id])}`);
		} else if (user.latestIp in this.voterIps) {
			recipient.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${this.generateResults(false, this.voterIps[user.latestIp])}`);
		} else {
			recipient.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${this.generateVotes()}`);
		}
	}

	updateFor(user: User) {
		if (user.id in this.voters) {
			user.sendTo(this.room, `|uhtmlchange|poll${this.pollNumber}|${this.generateResults(false, this.voters[user.id])}`);
		}
	}

	display() {
		const votes = this.generateVotes();

		const results = [];

		for (let i = 0; i <= this.options.size; i++) {
			results.push(this.generateResults(false, i));
		}

		for (const id in this.room.users) {
			const thisUser = this.room.users[id];
			if (thisUser.id in this.voters) {
				thisUser.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${results[this.voters[thisUser.id]]}`);
			} else if (thisUser.latestIp in this.voterIps) {
				thisUser.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${results[this.voterIps[thisUser.latestIp]]}`);
			} else {
				thisUser.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${votes}`);
			}
		}
	}

	displayTo(user: User, connection: Connection | null = null) {
		const recipient = connection || user;
		if (user.id in this.voters) {
			recipient.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${this.generateResults(false, this.voters[user.id])}`);
		} else if (user.latestIp in this.voterIps) {
			recipient.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${this.generateResults(false, this.voterIps[user.latestIp])}`);
		} else {
			recipient.sendTo(this.room, `|uhtml|poll${this.pollNumber}|${this.generateVotes()}`);
		}
	}

	onConnect(user: User, connection: Connection | null = null) {
		this.displayTo(user, connection);
	}

	end() {
		const results = this.generateResults(true);

		this.room.send(`|uhtmlchange|poll${this.pollNumber}|<div class="infobox">(The poll has ended – scroll down to see the results)</div>`);
		this.room.add(`|html|${results}`).update();
	}
}

export const commands: ChatCommands = {
	poll: {
		htmlcreate: 'new',
		create: 'new',
		new(target, room, user, connection, cmd, message) {
			if (!target) return this.parse('/help poll new');
			target = target.trim();
			if (target.length > 1024) return this.errorReply("Poll too long.");
			if (room.battle) return this.errorReply("Battles do not support polls.");

			const text = this.filter(target);
			if (target !== text) return this.errorReply("You are not allowed to use filtered words in polls.");

			const supportHTML = cmd === 'htmlcreate';
			let separator = '';
			if (text.includes('\n')) {
				separator = '\n';
			} else if (text.includes('|')) {
				separator = '|';
			} else if (text.includes(',')) {
				separator = ',';
			} else {
				return this.errorReply("Not enough arguments for /poll new.");
			}

			let params = text.split(separator).map(param => param.trim());

			if (!this.can('minigame', null, room)) return false;
			if (supportHTML && !this.can('declare', null, room)) return false;
			if (!this.canTalk()) return;
			if (room.minorActivity) return this.errorReply("There is already a poll or announcement in progress in this room.");
			if (params.length < 3) return this.errorReply("Not enough arguments for /poll new.");

			// @ts-ignore In the case that any of these are null, the function is terminated, and the result never used.
			if (supportHTML) params = params.map(parameter => this.canHTML(parameter));
			if (params.some(parameter => !parameter)) return;

			const options = params.splice(1);
			if (options.length > 8) {
				return this.errorReply("Too many options for poll (maximum is 8).");
			}

			if (new Set(options).size !== options.length) {
				return this.errorReply("There are duplicate options in the poll.");
			}

			room.minorActivity = new Poll(room, {source: params[0], supportHTML}, options);
			room.minorActivity.display();

			this.roomlog(`${user.name} used ${message}`);
			this.modlog('POLL');
			return this.addModAction(`A poll was started by ${user.name}.`);
		},
		newhelp: [
			`/poll create [question], [option1], [option2], [...] - Creates a poll. Requires: % @ # & ~`,
			`Polls can be used as quiz questions. To do this, prepend all correct answers with a +.`,
		],

		vote(target, room, user) {
			if (!room.minorActivity || room.minorActivity.activityId !== 'poll') return this.errorReply("There is no poll running in this room.");
			if (!target) return this.parse('/help poll vote');
			const poll = room.minorActivity as Poll;
			if (target === 'blank') {
				poll.blankvote(user);
				return;
			}

			const parsed = parseInt(target);
			if (isNaN(parsed)) return this.errorReply("To vote, specify the number of the option.");

			if (!poll.options.has(parsed)) return this.sendReply("Option not in poll.");

			poll.vote(user, parsed);
		},
		votehelp: [`/poll vote [number] - Votes for option [number].`],

		timer(target, room, user) {
			if (!room.minorActivity || room.minorActivity.activityId !== 'poll') return this.errorReply("There is no poll running in this room.");
			const poll = room.minorActivity as Poll;

			if (target) {
				if (!this.can('minigame', null, room)) return false;
				if (target === 'clear') {
					if (!poll.timeout) return this.errorReply("There is no timer to clear.");
					clearTimeout(poll.timeout);
					poll.timeout = null;
					poll.timeoutMins = 0;
					return this.add("The poll timer was turned off.");
				}
				const timeout = parseFloat(target);
				if (isNaN(timeout) || timeout <= 0 || timeout > 0x7FFFFFFF) return this.errorReply("Invalid time given.");
				if (poll.timeout) clearTimeout(poll.timeout);
				poll.timeoutMins = timeout;
				poll.timeout = setTimeout(() => {
					if (poll) poll.end();
					room.minorActivity = null;
				}, timeout * 60000);
				room.add(`The poll timer was turned on: the poll will end in ${timeout} minute(s).`);
				this.modlog('POLL TIMER', null, `${timeout} minutes`);
				return this.privateModAction(`(The poll timer was set to ${timeout} minute(s) by ${user.name}.)`);
			} else {
				if (!this.runBroadcast()) return;
				if (poll.timeout) {
					return this.sendReply(`The poll timer is on and will end in ${poll.timeoutMins} minute(s).`);
				} else {
					return this.sendReply("The poll timer is off.");
				}
			}
		},
		timerhelp: [
			`/poll timer [minutes] - Sets the poll to automatically end after [minutes] minutes. Requires: % @ # & ~`,
			`/poll timer clear - Clears the poll's timer. Requires: % @ # & ~`,
		],

		results(target, room, user) {
			if (!room.minorActivity || room.minorActivity.activityId !== 'poll') return this.errorReply("There is no poll running in this room.");
			const poll = room.minorActivity as Poll;

			return poll.blankvote(user);
		},
		resultshelp: [`/poll results - Shows the results of the poll without voting. NOTE: you can't go back and vote after using this.`],

		close: 'end',
		stop: 'end',
		end(target, room, user) {
			if (!this.can('minigame', null, room)) return false;
			if (!this.canTalk()) return;
			if (!room.minorActivity || room.minorActivity.activityId !== 'poll') return this.errorReply("There is no poll running in this room.");
			const poll = room.minorActivity as Poll;
			if (poll.timeout) clearTimeout(poll.timeout);

			poll.end();
			room.minorActivity = null;
			this.modlog('POLL END');
			return this.privateModAction(`(The poll was ended by ${user.name}.)`);
		},
		endhelp: [`/poll end - Ends a poll and displays the results. Requires: % @ # & ~`],

		show: '',
		display: '',
		''(target, room, user, connection) {
			if (!room.minorActivity || room.minorActivity.activityId !== 'poll') return this.errorReply("There is no poll running in this room.");
			const poll = room.minorActivity as Poll;
			if (!this.runBroadcast()) return;
			room.update();

			if (this.broadcasting) {
				poll.display();
			} else {
				poll.displayTo(user, connection);
			}
		},
		displayhelp: [`/poll display - Displays the poll`],
	},
	pollhelp: [
		`/poll allows rooms to run their own polls. These polls are limited to one poll at a time per room.`,
		`Polls can be used as quiz questions. To do this, prepend all correct answers with a +.`,
		`Accepts the following commands:`,
		`/poll create [question], [option1], [option2], [...] - Creates a poll. Requires: % @ # & ~`,
		`/poll htmlcreate [question], [option1], [option2], [...] - Creates a poll, with HTML allowed in the question and options. Requires: # & ~`,
		`/poll vote [number] - Votes for option [number].`,
		`/poll timer [minutes] - Sets the poll to automatically end after [minutes]. Requires: % @ # & ~`,
		`/poll results - Shows the results of the poll without voting. NOTE: you can't go back and vote after using this.`,
		`/poll display - Displays the poll`,
		`/poll end - Ends a poll and displays the results. Requires: % @ # & ~`,
	],
};

process.nextTick(() => {
	Chat.multiLinePattern.register('/poll (new|create|htmlcreate) ');
});


text:
/*
 * StartStop.cpp
 *
 *  Created on: May 14, 2014
 *      Author: ajl2612
 */

#include "StartStop.h"

StartStop::StartStop(std::string message, int id){

    this->message = message;
    this->id = id;

}

std::string StartStop::getMessage(){
    return this-> message;
}

int StartStop::getID(){
    return this-> id;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace WebAddressbookTests
{
    [TestFixture]
    public class LoginTests : TestBase
    {
        [Test]
        public void LoginWithValidCredentials()
        {
            //prepare
            app.Auth.LogOut();
            //action
            AccountData account = new AccountData("admin", "secret");
            app.Auth.Login(account);
            //verification
            Assert.IsTrue(app.Auth.IsLoggedIn(account));
        }

        [Test]
        public void LoginWithInValidCredentials()
        {
            //prepare
            app.Auth.LogOut();
            //action
            AccountData account = new AccountData("admin", "123456");
            app.Auth.Login(account);
            //verification
            Assert.IsFalse(app.Auth.IsLoggedIn(account));
        }
    }
}


text:
import {ViewerCidApi} from '../../src/service/viewer-cid-api';
import {dict} from '../../src/utils/object';
import {mockServiceForDoc} from '../../testing/test-helper';

describes.realWin('viewerCidApi', {amp: true}, env => {
  let ampdoc;
  let api;
  let sandbox;
  let viewerMock;

  beforeEach(() => {
    ampdoc = env.ampdoc;
    sandbox = env.sandbox;
    viewerMock = mockServiceForDoc(sandbox, ampdoc, 'viewer', [
      'sendMessageAwaitResponse',
      'hasCapability',
      'isTrustedViewer',
    ]);

    api = new ViewerCidApi(env.ampdoc);
  });

  describe('isSupported', () => {
    it('should return true if Viewer is trusted and has CID capability', () => {
      viewerMock.isTrustedViewer.returns(Promise.resolve(true));
      viewerMock.hasCapability.withArgs('cid').returns(true);
      return expect(api.isSupported()).to.eventually.be.true;
    });

    it('should return false if Viewer has no CID capability', () => {
      viewerMock.isTrustedViewer.returns(new Promise(() => {}));
      viewerMock.hasCapability.withArgs('cid').returns(false);
      return expect(api.isSupported()).to.eventually.be.false;
    });

    it('should return false if Viewer is not trusted', () => {
      viewerMock.isTrustedViewer.returns(Promise.resolve(false));
      viewerMock.hasCapability.withArgs('cid').returns(true);
      return expect(api.isSupported()).to.eventually.be.false;
    });
  });

  describe('getScopedCid', () => {
    function verifyClientIdApiInUse(used) {
      viewerMock.sendMessageAwaitResponse
          .returns(Promise.resolve('client-id-from-viewer'));
      return api.getScopedCid('AMP_ECID_GOOGLE').then(cid => {
        expect(cid).to.equal('client-id-from-viewer');
        const payload = dict({
          'scope': 'AMP_ECID_GOOGLE',
          'clientIdApi': used,
          'canonicalOrigin': 'http://localhost:9876',
        });
        if (used) {
          payload['apiKey'] = 'AIzaSyA65lEHUEizIsNtlbNo-l2K18dT680nsaM';
        }
        expect(viewerMock.sendMessageAwaitResponse)
            .to.be.calledWith('cid', payload);
      });
    }

    it('should use client ID API from api if everything great', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="googleanalytics">';
      return verifyClientIdApiInUse(true);
    });

    it('should not use client ID API if no opt in meta tag', () => {
      return verifyClientIdApiInUse(false);
    });

    // TODO(lannka, #14336): Fails due to console errors.
    it.skip('should not use client ID API if vendor not whitelisted', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="abodeanalytics">';
      return verifyClientIdApiInUse(false);
    });

    it('should not use client ID API if scope not whitelisted', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="googleanalytics">';
      viewerMock.sendMessageAwaitResponse.withArgs('cid', dict({
        'scope': 'NON_WHITELISTED_SCOPE',
        'clientIdApi': false,
        'canonicalOrigin': 'http://localhost:9876',
      })).returns(Promise.resolve('client-id-from-viewer'));
      return expect(api.getScopedCid('NON_WHITELISTED_SCOPE'))
          .to.eventually.equal('client-id-from-viewer');
    });

    it('should return undefined if Viewer returns undefined', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="googleanalytics">';
      viewerMock.sendMessageAwaitResponse.returns(Promise.resolve());
      return expect(api.getScopedCid('AMP_ECID_GOOGLE'))
          .to.eventually.be.undefined;
    });

    it('should reject if Viewer rejects', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="googleanalytics">';
      viewerMock.sendMessageAwaitResponse
          .returns(Promise.reject('Client API error'));
      return expect(api.getScopedCid('AMP_ECID_GOOGLE'))
          .to.eventually.be.rejectedWith(/Client API error/);
    });
  });

  describe('isScopeOptedIn', () => {
    it('should read predefined clients and custom API keys correctly', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" ' +
          'content="googleanalytics, ' +
          'foo = foo-api-key,' +
          'bar=bar-api-key ,' +
          'hello=hello-api-key">';
      expect(api.isScopeOptedIn('AMP_ECID_GOOGLE'))
          .to.equal('AIzaSyA65lEHUEizIsNtlbNo-l2K18dT680nsaM');
      expect(api.isScopeOptedIn('foo')).to.equal('foo-api-key');
      expect(api.isScopeOptedIn('bar')).to.equal('bar-api-key');
      expect(api.isScopeOptedIn('hello')).to.equal('hello-api-key');
      expect(api.isScopeOptedIn('non-existing')).to.be.undefined;
    });

    it('should work if meta only contains predefined clients', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" content="googleanalytics">';
      expect(api.isScopeOptedIn('AMP_ECID_GOOGLE'))
          .to.equal('AIzaSyA65lEHUEizIsNtlbNo-l2K18dT680nsaM');
    });

    it('should work if meta only contains custom scopes', () => {
      ampdoc.win.document.head.innerHTML +=
          '<meta name="amp-google-client-id-api" ' +
          'content="' +
          'foo=foo-api-key,' +
          'bar=bar-api-key">';
      expect(api.isScopeOptedIn('foo')).to.equal('foo-api-key');
      expect(api.isScopeOptedIn('bar')).to.equal('bar-api-key');
    });
  });
});


text:
@implementation A_AttributedStringBuilder {
    NSMutableDictionary<NSString *, id> *attributed;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        attributed = [[NSMutableDictionary alloc] init];
    }
    return self;
}

+ (A_AttributedStringBuilder *)createWithSystemFontSize:(CGFloat)size {
    A_AttributedStringBuilder *builder = [A_AttributedStringBuilder new];
    [builder setSystemFontSize:size];
    return builder;
}
+ (A_AttributedStringBuilder *)createWithFontName:(NSString *)name withSize:(CGFloat)size {
    A_AttributedStringBuilder *builder = [A_AttributedStringBuilder new];
    [builder setFontName:name withSize:size];
    return builder;
}
+ (A_AttributedStringBuilder *)createFromAttributes:(NSDictionary *)attributes {
    A_AttributedStringBuilder *builder = [A_AttributedStringBuilder new];
    [builder setAttributes:attributes];
    return builder;
}

- (A_AttributedStringBuilder *)setAttributes:(NSDictionary *)attributes {
    [attributed setValuesForKeysWithDictionary:attributes];
    return self;
}
- (A_AttributedStringBuilder *)setSystemFontSize:(CGFloat)size {
    UIFont *font = [UIFont systemFontOfSize:size];
    [attributed setObject:font forKey:NSFontAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setFontName:(NSString *)name withSize:(CGFloat)size {
    UIFont *font = [UIFont fontWithName:name size:size];
    [attributed setObject:font forKey:NSFontAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setKern:(CGFloat)kern {
    [attributed setObject:@(kern) forKey:NSKernAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setParagraphStyle:(NSParagraphStyle *)style {
    [attributed setObject:style forKey:NSParagraphStyleAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setUnderline:(BOOL)underline {
    [attributed setObject:@(underline) forKey:NSUnderlineStyleAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setShadow:(NSShadow *)shadow{
    [attributed setObject:shadow forKey:NSShadowAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setObliqueness:(CGFloat)obliqueness {
    [attributed setObject:@(obliqueness) forKey:NSObliquenessAttributeName];
    return self;
}

- (A_AttributedStringBuilder *)setForegroundColor:(UIColor *)color {
    [attributed setObject:color forKey:NSForegroundColorAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setBackgroundColor:(UIColor *)color {
    [attributed setObject:color forKey:NSBackgroundColorAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setStrokeColor:(UIColor *)color {
    [attributed setObject:color forKey:NSStrokeColorAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setBaselineOffset:(CGFloat)offest {
    [attributed setObject:@(offest) forKey:NSBaselineOffsetAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setUnderlineColor:(UIColor *)color {
    [attributed setObject:color forKey:NSUnderlineColorAttributeName];
    return self;
}
- (A_AttributedStringBuilder *)setExpansion:(CGFloat)offest {
    [attributed setObject:@(offest) forKey:NSExpansionAttributeName];
    return self;
}

- (NSDictionary<NSString *, id> *)getStringAttributes {
    return [attributed copy];
}
- (NSAttributedString *)getAttributedString:(NSString *)string {
    NSAttributedString *str = [[NSAttributedString alloc] initWithString:string attributes:attributed];
    return str;
}

@end


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('zerver', '0044_reaction'),
    ]

    operations = [
        migrations.AddField(
            model_name='realm',
            name='waiting_period_threshold',
            field=models.PositiveIntegerField(default=0),
        ),
    ]


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.apache.hadoop.hbase.replication (HBase 0.94.19 API)
</TITLE>

<META NAME="date" CONTENT="2014-04-22">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package org.apache.hadoop.hbase.replication

Multi Cluster Replication

See:

          Description

Class Summary

ReplicationPeer
This class acts as a wrapper for all the objects used to identify and
 communicate with remote peers and is responsible for answering to expired
 sessions and re-establishing the ZK connections.

ReplicationZookeeper
This class serves as a helper for all things related to zookeeper in
 replication.

Enum Summary

ReplicationZookeeper.PeerState

Package org.apache.hadoop.hbase.replication Description

Multi Cluster Replication

This package provides replication between HBase clusters.

Table Of Contents

Status

Requirements

Deployment

Verifying Replicated Data

Status

This package is experimental quality software and is only meant to be a base
for future developments. The current implementation offers the following
features:

Master/Slave replication.

Master/Master replication.

Cyclic replication.

Replication of scoped families in user tables.

Start/stop replication stream.

Supports clusters of different sizes.

Handling of partitions longer than 10 minutes.

Ability to add/remove slave clusters at runtime.

MapReduce job to compare tables on two clusters

Please report bugs on the project's Jira when found.

Requirements

Before trying out replication, make sure to review the following requirements:

Zookeeper should be handled by yourself, not by HBase, and should
    always be available during the deployment.

All machines from both clusters should be able to reach every
    other machine since replication goes from any region server to any
    other one on the slave cluster. That also includes the
    Zookeeper clusters.

Both clusters should have the same HBase and Hadoop major revision.
    For example, having 0.90.1 on the master and 0.90.0 on the slave is
    correct but not 0.90.1 and 0.89.20100725.

Every table that contains families that are scoped for replication
    should exist on every cluster with the exact same name, same for those
    replicated families.

For multiple slaves, Master/Master, or cyclic replication version
    0.92 or greater is needed.

Deployment

The following steps describe how to enable replication from a cluster
to another.

Edit ${HBASE_HOME}/conf/hbase-site.xml on both cluster to add
    the following configurations:

<property>
  <name>hbase.replication</name>
  <value>true</value>
</property>

      deploy the files, and then restart HBase if it was running.

Run the following command in the master's shell while it's running

add_peer

    This will show you the help to setup the replication stream between
    both clusters. If both clusters use the same Zookeeper cluster, you have
    to use a different zookeeper.znode.parent since they can't
    write in the same folder.

    Once you have a peer, you need to enable replication on your column families.
    One way to do it is to alter the table and to set the scope like this:

      disable 'your_table'
      alter 'your_table', {NAME => 'family_name', REPLICATION_SCOPE => '1'}
      enable 'your_table'

    Currently, a scope of 0 (default) means that it won't be replicated and a
    scope of 1 means it's going to be. In the future, different scope can be
    used for routing policies.

To list all configured peers run the following command in the master's
    shell

list_peers
 (as of version 0.92)

You can confirm that your setup works by looking at any region server's log
on the master cluster and look for the following lines;

Considering 1 rs, with ratio 0.1
Getting 1 rs from peer cluster # 0
Choosing peer 10.10.1.49:62020

In this case it indicates that 1 region server from the slave cluster
was chosen for replication.

Should you want to stop the replication while the clusters are running, open
the shell on the master cluster and issue this command:

hbase(main):001:0> stop_replication

Replication of already queued edits will still happen after you
issued that command but new entries won't be. To start it back, simply replace
"false" with "true" in the command.

Verifying Replicated Data

Verifying the replicated data on two clusters is easy to do in the shell when
looking only at a few rows, but doing a systematic comparison requires more
computing power. This is why the VerifyReplication MR job was created, it has
to be run on the master cluster and needs to be provided with a peer id (the
one provided when establishing a replication stream) and a table name. Other
options let you specify a time range and specific families. This job's short
name is "verifyrep" and needs to be provided when pointing "hadoop jar" to the
hbase jar.

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2014 The Apache Software Foundation. All Rights Reserved.


text:
<?php
    echo "Stoyan Atanasoff ! stoyan.atanasoff at gmail dot com ";
?>


text:
My version of breakout game in JS with requirejs as amd loader and canvas from HTML5.

### Demo
[Astix demo](http://migace.github.io/astix/)


text:
<!doctype html>

        <meta charset="utf-8">
        <title>ZF2 best practices</title>

        <meta name="description" content="Zend Framework 2 best practices">
        <meta name="author" content="Marco Pivetta">

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">

        <link rel="stylesheet" href="css/theme.css" id="theme">
        <link rel="stylesheet" href="bower_components/reveal.js/lib/css/zenburn.css">

                <% _.forEach(slides, function(slide) { %>
                    <% if (!_.isArray(slide)) { %>
                        <%= section(slide) %>
                    <% } %>
                    <% if (_.isArray(slide)) { %>

                            <% _.forEach(slide, function(verticalslide) { %>
                                <%= section(verticalslide) %>
                            <% }); %>

                    <% } %>
                <% }); %>


text:
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
if (env !== 'development' && env !== 'test' && env !== 'production') {
  throw new Error(
    'Using `@moped/babel-preset` requires that you specify `NODE_ENV` or ' +
      '`BABEL_ENV` environment variables. Valid values are "development", ' +
      '"test", and "production". Instead, received: ' +
      JSON.stringify(env) +
      '.',
  );
}
export default env as 'development' | 'test' | 'production';


text:
package v1beta1

type EventExpansion interface{}


text:
package generalized_suffix_tree

import "strings"

func AllOccurrences(s, sub string) []int {
	t := NewGST(s)

	n := find(t.Root, sub)
	if n == nil {
		return []int{}
	}

	return n.DepthFirstSearch("", nil)[0]
}

func find(n *Node, sub string) *Node {
	if len(sub) == 0 {
		return n
	}
	for edge, child := range n.Children {
		if strings.HasPrefix(sub, edge) {
			// sub contains the entire edge. Look one level down.
			return find(child, sub[len(edge):])
		}
		if strings.HasPrefix(edge, sub) {
			// sub ends in the middle of the edge. Return the child.
			return child
		}
	}
	return nil
}


text:
/* tslint:disable: no-unused-variable class-name */

/// <reference path="./color/color.d.ts" />

declare function emitLog(text: string): void;

interface integer {}

declare module Type {
  interface Range<T> {
    start: T;
    end: T;
  }

  interface Point {
    x: number;
    y: number;
    set(x: number, y: number): void;
    set(args: [number, number]): void;
    new(x: number, y: number): Point;
    new(args: [number, number]): Point;
    new(...variadicArgs: number[]): Point;
  }

  interface Square {
    center: Point;
    margin?: number;

    /**
     * Size from 1 to 5 (highest).
     * @minimum 1
     * @maximum 5
     */
    size: integer;
  }

  interface ColoredSquare extends Square {
    /**
     * Default color is red.
     * @default Color.Red
     */
    color: Color;
    setColor(color: Color, callback?: (color: Color) => void): void;
  }

  interface SquareDictionary<T extends Square> {
    [stringIndex: string]: T;
    [numberIndex: number]: T;
  }

  interface Transformer {
    (squeare: Square, scale : number): void;
  }

  class Line {
    color: Color;
    constructor(src: Point, dest: Point);
    setColor(color: Color, callback?: (color: Color) => void): void;
    private ownColor;
    protected draw(): void;
  }

  class LineDrawer {
    static lines: Line[];
    static draw(src: Point, dest: Point): Line;
  }

  type time = number | Date;

  interface Time {
    now: time;
  }
}

declare module Rpc {
  export import RpcType = Type;
  export import Transformer = RpcType.Transformer;
  var type: typeof Type;
  var baseUrl: string;
  var anyAny: any;

  module Get {
    function getRange(start: Type.Point, dest: Type.Point): { range: RpcType.Range<number> };
  }

  module Post {
    function setOptions(options: { [index: string]: string }): boolean;
  }
}