text:
import {Deferred} from './deferred.js';
import {LocalTask} from './task.js';

const notStarted = 0;
const started = 1;
const complete = 2;
const canceled = 3;

type TaskState =
    typeof notStarted|typeof started|typeof complete|typeof canceled;

export class LocalTaskContext<T> {
  task: LocalTask<T>;

  private _state: TaskState = notStarted;

  /**
   * Controls the Promise returned by completed. Resolves when the task returns.
   */
  private _completedDeferred = new Deferred<T>();

  /**
   * Controls the Promise returned by the last call to yield(). Resolves when
   * the task should continue.
   */
  private _continueDeferred?: Deferred<void>;

  /**
   * Controls the Promise returned by continue(). Resolves when the task yields.
   */
  private _yieldDeferred?: Deferred<boolean> = new Deferred<boolean>();

  constructor(task: LocalTask<T>) { this.task = task; }

  get completed() { return this._completedDeferred.promise; }

  /**
   * Yields control back to the scheduler. Returns a Promise that resolves when
   * the scheduler continues the task, or rejects if the scheduler cancels the
   * task.
   */
  yield(): Promise<void> {
    console.assert(this._continueDeferred === undefined);

    // Capture the Deferred returned from the previous call to continue() so
    // that we can resolve it.
    const _yield = this._yieldDeferred!.resolve;

    // Create a new Deferred for the next call to continue()
    this._yieldDeferred = new Deferred<boolean>();
    _yield(false);

    this._continueDeferred = new Deferred<void>();
    return this._continueDeferred.promise;
  }

  /**
   * Continues or starts this task.
   *
   * _continue() starts a task function by invoking it, and continues a task by
   * resolving the Promise returned from the last TaskContext.yield() call.
   *
   * Returns a Promise that resolves when the task yields.
   */
  async continue(): Promise<boolean> {
    if (this._state === notStarted) {
      this._state = started;

      // We haven't started the task, so invoke the task function. This is an
      // async operation, so we'll immediately return the _yieldDeferred
      // Promise.
      (async () => {
        try {
          // Wait to start the task so that we can await it's yield() call.
          await 0;
          const start = performance.now();
          const result = this.task.call(null, this);
          const end = performance.now();
          // TODO: report duration somewhere!
          const duration = end - start;
          // console.log('sync time', duration);
          await result;
          this._completedDeferred.resolve(result);
        } catch (e) {
          this._completedDeferred.reject(e);
        } finally {
          // continue() is waiting on _context.yielded, so resolve it to keep
          // going
          this._yieldDeferred!.resolve(true);
        }
      })();
    } else if (this._state === started) {
      // The task is started and has called TaskContext.yield()
      // const context = this._context;
      console.assert(this._continueDeferred !== undefined);
      const _continue = this._continueDeferred!.resolve;
      this._continueDeferred = undefined;
      _continue();
    } else {
      throw new Error('continue() called on non-running task');
    }
    // Wait till the task yields
    return this._yieldDeferred!.promise;
  }

  /**
   * Cancels a running task by rejecting the Promise returned from yield().
   */
  cancel() {
    console.assert(this._state !== canceled);
    if (this._state === notStarted) {
      // Nothing to cleanup, just change the state
      this._state = canceled;
    } else if (this._state === started) {
      // The task is started and has called TaskContext.yield()
      console.assert(this._continueDeferred !== undefined);
      const _cancel = this._continueDeferred!.reject;
      this._continueDeferred = undefined;

      // Rejects the Promise returned from the last TaskContext.yield() call
      // This should in turn reject or resolve the Promise returned by the task
      // function. If not it means the task caught the CancelError and ignored
      // it. If we can detect that case we should reject the _completed Promise
      // via _rejectCompleted().
      _cancel!(new Error('Task canceled'));
    }
  }
}


text:
: '@(#)auconvert.sh 22.1 03/24/08 1999-2002 '
#
#
# Copyright (C) 2015  University of Oregon
#
# You may distribute under the terms of either the GNU General Public
# License or the Apache License, as specified in the LICENSE file.
#
# For more information, see the LICENSE file.
#
#
#!/usr/bin/sh
#
# auconvert.sh
#
# This script converts the original BSM audit file format into
# a human-readable file format and stores new file(s) at
# /tmp/uaudit with .prau prefix then renames the original
# audit file to .orig prefix
#
# Usage: auconvert
#        auconvert  <audit_directory> <dest_directory> <save_directory
#
#	if none of argument given: audit_directory = current directory
#				   dest_directory  = /tmp/uaudit
#				   save_directory  = current directory
#
#	if one arguments given:    dest_directory  = /tmp/uaudit
#				   save_directory  = current directory
#
#	if two arguments given:    save_directory  = current directory
#
#       where:  audit_directory is where the original unix audit files are at
#		dest_directory is where the readable coverted files will be placed
#						 with .praud extension
#		save_directory is where the original unix audit files are to be saved
#				        with the same name and .orig extension appended
#

audit_dir=`pwd`
dest_dir=
#save_dir=`pwd`

if [ $# -gt 0 ]
then
	audit_dir=$1
fi

if [ ! -d $audit_dir ]
then
	echo "\nAudit record directory does not exists\n"
	exit
fi

save_dir=$audit_dir

if [ $# -gt 1 -a x$2 != "x" ]
then
	dest_dir=$2
#else
#    if [ ! -d /tmp/uaudit ]
#    then
#	mkdir -p /tmp/uaudit
#    fi
#    dest_dir=/tmp/uaudit
fi

if [ ! -d $dest_dir ]
then
	echo "\nDestination directory does not exists\n"
	exit
fi

if [ x$3 != "x" ]
then
	save_dir=$3
fi

if [ ! -d $save_dir ]
then
	echo "\nSave directory does not exists\n"
	exit
fi

#close off the *.not_terminated.*
#ps -e | grep auditd 2>&1 > /dev/null
#if [ $? -eq 0 ]
#then
#	audit -n
#fi

ls $audit_dir |
nawk '
BEGIN { tmpfile="/tmp/please_remove_me" }

{
	FileName=$0

	if ( FileName ~ /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]./ &&
	     FileName !~ /not_terminated/ &&
	     FileName !~ /.orig$/ ) {

		fullpath="'$audit_dir'""/"FileName
		system( "/usr/sbin/auditreduce " fullpath " | /usr/sbin/praudit > " tmpfile )

		destpath="'$dest_dir'" "/" FileName ".praud"
		system( "mv " tmpfile " " destpath)

		if ( "'$save_dir'" == "'$audit_dir'" )
		    system( "mv " fullpath " " fullpath ".orig" )

		else {
		    savepath="'$save_dir'" "/" FileName ".orig"
		    system( "mv " fullpath " " savepath )
		}
	}

	#leave the not_terminated file intact for auditd to close it
	if ( FileName ~ /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]./ &&
	     FileName ~ /not_terminated/ &&
	     FileName !~ /.praud$/ &&
	     FileName !~ /.cond$/ &&
	     FileName !~ /.orig$/ ) {

		fullpath="'$audit_dir'""/"FileName
		system( "/usr/sbin/auditreduce " fullpath " | /usr/sbin/praudit > " tmpfile )

		destpath="'$dest_dir'" "/" FileName ".praud"
		system( "mv " tmpfile " " destpath)
	}
}'

redpajama_set_name: RedPajamaGithub


text:
from django.contrib import admin

from .models import Sound

admin.site.register(Sound)

# Register your models here.