text:
@article{2009arXiv0912.0201L,
 abstract = {A survey that can cover the sky in optical bands over wide fields to
faint magnitudes with a fast cadence will enable many of the
exciting science opportunities of the next decade. The Large
Synoptic Survey Telescope (LSST) will have an effective aperture
of 6.7 meters and an imaging camera with field of view of 9.6
deg2̂, and will be devoted to a ten-year imaging survey over
20,000 deg\ ̂south of +15 deg. Each pointing will be imaged
2000 times with fifteen second exposures in six broad bands from
0.35 to 1.1 microns, to a total point-source depth of
råisebox-0.5ex~27.5. The LSST Science Book
describes the basic parameters of the LSST hardware, software,
and observing plans. The book discusses educational and outreach
opportunities, then goes on to describe a broad range of science
that LSST will revolutionize: mapping the inner and outer Solar
System, stellar populations in the Milky Way and nearby
galaxies, the structure of the Milky Way disk and halo and other
objects in the Local Volume, transient and variable objects both
at low and high redshift, and the properties of normal and
active galaxies at low and high redshift. It then turns to far-
field cosmological topics, exploring properties of supernovae to
z\i̊sebox-0.5ex~1, strong and weak lensing, the
large-scale distribution of galaxies and baryon oscillations,
and how these different probes may be combined to constrain
cosmological models and the physics of dark energy. <P />},
 adsnote = {Provided by the SAO/NASA Astrophysics Data System},
 adsurl = {https://ui.adsabs.harvard.edu/abs/2009arXiv0912.0201L},
 archiveprefix = {arXiv},
 author = {LSST Science Collaboration and Abell, Paul A. and Allison, Julius and
Anderson, Scott F. and Andrew, John R. and Angel, J. Roger P. and
Armus, Lee and Arnett, David and Asztalos, S.~J. and
Axelrod, Tim S. and Bailey, Stephen and Ballantyne, D.~R. and
Bankert, Justin R. and Barkhouse, Wayne A. and Barr, Jeffrey D. and
Barrientos, L. Felipe and Barth, Aaron J. and Bartlett, James G. and
Becker, Andrew C. and Becla, Jacek and Beers, Timothy C. and
Bernstein, Joseph P. and Biswas, Rahul and Blanton, Michael R. and
Bloom, Joshua S. and Bochanski, John J. and Boeshaar, Pat and
Borne, Kirk D. and Bradac, Marusa and Brandt, W.~N. and
Bridge, Carrie R. and Brown, Michael E. and Brunner, Robert J. and
Bullock, James S. and Burgasser, Adam J. and Burge, James H. and
Burke, David L. and Cargile, Phillip A. and Chand
rasekharan, Srinivasan and Chartas, George and Chesley, Steven R. and
Chu, You-Hua and Cinabro, David and Claire, Mark W. and
Claver, Charles F. and Clowe, Douglas and Connolly, A.~J. and
Cook, Kem H. and Cooke, Jeff and Cooray, Asantha and
Covey, Kevin R. and Culliton, Christopher S. and de Jong, Roelof and
de Vries, Willem H. and Debattista, Victor P. and
Delgado, Francisco and Dell'Antonio, Ian P. and Dhital, Saurav and
Di Stefano, Rosanne and Dickinson, Mark and Dilday, Benjamin and
Djorgovski, S.~G. and Dobler, Gregory and Donalek, Ciro and
Dubois-Felsmann, Gregory and Durech, Josef and
Eliasdottir, Ardis and Eracleous, Michael and Eyer, Laurent and
Falco, Emilio E. and Fan, Xiaohui and Fassnacht, Christopher D. and
Ferguson, Harry C. and Fernandez, Yanga R. and Fields, Brian D. and
Finkbeiner, Douglas and Figueroa, Eduardo E. and Fox, Derek B. and
Francke, Harold and Frank, James S. and Frieman, Josh and
Fromenteau, Sebastien and Furqan, Muhammad and Galaz, Gaspar and
Gal-Yam, A. and Garnavich, Peter and Gawiser, Eric and
Geary, John and Gee, Perry and Gibson, Robert R. and
Gilmore, Kirk and Grace, Emily A. and Green, Richard F. and
Gressler, William J. and Grillmair, Carl J. and Habib, Salman and
Haggerty, J.~S. and Hamuy, Mario and Harris, Alan W. and
Hawley, Suzanne L. and Heavens, Alan F. and Hebb, Leslie and
Henry, Todd J. and Hileman, Edward and Hilton, Eric J. and
Hoadley, Keri and Holberg, J.~B. and Holman, Matt J. and
Howell, Steve B. and Infante, Leopoldo and Ivezic, Zeljko and
Jacoby, Suzanne H. and Jain, Bhuvnesh and R and Jedicke and
Jee, M. James and Garrett Jernigan, J. and Jha, Saurabh W. and
Johnston, Kathryn V. and Jones, R. Lynne and Juric, Mario and
Kaasalainen, Mikko and Styliani and Kafka and Kahn, Steven M. and
Kaib, Nathan A. and Kalirai, Jason and Kantor, Jeff and
Kasliwal, Mansi M. and Keeton, Charles R. and Kessler, Richard and
Knezevic, Zoran and Kowalski, Adam and Krabbendam, Victor L. and
Krughoff, K. Simon and Kulkarni, Shrinivas and Kuhlman, Stephen and
Lacy, Mark and Lepine, Sebastien and Liang, Ming and Lien, Amy and
Lira, Paulina and Long, Knox S. and Lorenz, Suzanne and
Lotz, Jennifer M. and Lupton, R.~H. and Lutz, Julie and
Macri, Lucas M. and Mahabal, Ashish A. and Mandelbaum, Rachel and
Marshall, Phil and May, Morgan and McGehee, Peregrine M. and
Meadows, Brian T. and Meert, Alan and Milani, Andrea and
Miller, Christopher J. and Miller, Michelle and Mills, David and
Minniti, Dante and Monet, David and Mukadam, Anjum S. and
Nakar, Ehud and Neill, Douglas R. and Newman, Jeffrey A. and
Nikolaev, Sergei and Nordby, Martin and O'Connor, Paul and
Oguri, Masamune and Oliver, John and Olivier, Scot S. and
Olsen, Julia K. and Olsen, Knut and Olszewski, Edward W. and
Oluseyi, Hakeem and Padilla, Nelson D. and Parker, Alex and
Pepper, Joshua and Peterson, John R. and Petry, Catherine and
Pinto, Philip A. and Pizagno, James L. and Popescu, Bogdan and
Prsa, Andrej and Radcka, Veljko and Raddick, M. Jordan and
Rasmussen, Andrew and Rau, Arne and Rho, Jeonghee and
Rhoads, James E. and Richards, Gordon T. and Ridgway, Stephen T. and
Robertson, Brant E. and Roskar, Rok and Saha, Abhijit and
Sarajedini, Ata and Scannapieco, Evan and Schalk, Terry and
Schindler, Rafe and Schmidt, Samuel and Schmidt, Sarah and
Schneider, Donald P. and Schumacher, German and Scranton, Ryan and
Sebag, Jacques and Seppala, Lynn G. and Shemmer, Ohad and
Simon, Joshua D. and Sivertz, M. and Smith, Howard A. and
Allyn Smith, J. and Smith, Nathan and Spitz, Anna H. and
Stanford, Adam and Stassun, Keivan G. and Strader, Jay and
Strauss, Michael A. and Stubbs, Christopher W. and
Sweeney, Donald W. and Szalay, Alex and Szkody, Paula and
Takada, Masahiro and Thorman, Paul and Trilling, David E. and
Trimble, Virginia and Tyson, Anthony and Van Berg, Richard and Vand
en Berk, Daniel and VanderPlas, Jake and Verde, Licia and
Vrsnak, Bojan and Walkowicz, Lucianne M. and Wand
elt, Benjamin D. and Wang, Sheng and Wang, Yun and
Warner, Michael and Wechsler, Risa H. and West, Andrew A. and
Wiecha, Oliver and Williams, Benjamin F. and Willman, Beth and
Wittman, David and Wolff, Sidney C. and Wood-Vasey, W. Michael and
Wozniak, Przemek and Young, Patrick and Zentner, Andrew and
Zhan, Hu},
 eid = {arXiv:0912.0201},
 eprint = {0912.0201},
 journal = {arXiv e-prints},
 keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Cosmology and Extragalactic Astrophysics, Astrophysics - Earth and Planetary Astrophysics, Astrophysics - Galaxy Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
 month = {Dec},
 pages = {arXiv:0912.0201},
 primaryclass = {astro-ph.IM},
 title = {LSST Science Book, Version 2.0},
 year = {2009}
}

repository: profjsb/my-content

repo_name: profjsb/my-content


text:
package api

import (
	"net/http"

	"github.com/uadmin/uadmin"
	"github.com/uadmin/uadmin-docs/sample_project/todo/models"
)

// CustomListAPIHandler !
func CustomListAPIHandler(w http.ResponseWriter, r *http.Request) {
	// Fetch Data from DB
	todo := []models.Todo{}

	// Assigns a map as a string of interface to store any types of values
	results := []map[string]interface{}{}

	// "id" - order the todo model by id
	// false - to sort in descending order
	// 0 - start at index 0
	// 5 - get five records
	// &todo - todo model to execute
	// "" - fetch the id of the model itself
	uadmin.AdminPage("id", false, 0, 5, &todo, "")

	// Loop to fetch the record of todo
	for i := range todo {
		// Accesses and fetches the record of the linking models in Todo
		uadmin.Preload(&todo[i])

		// Assigns the string of interface in each Todo fields
		results = append(results, map[string]interface{}{
			"ID":          todo[i].ID,
			"Name":        todo[i].Name,
			"Description": todo[i].Description,
			// This returns only the name of the Category model, not the
			// other fields
			"Category": todo[i].Category.Name,
			// This returns only the name of the Friend model, not the
			// other fields
			"Friend": todo[i].Friend.Name,
			// This returns only the name of the Item model, not the other
			// fields
			"Item":       todo[i].Item.Name,
			"TargetDate": todo[i].TargetDate,
			"Progress":   todo[i].Progress,
		})
	}

	// Prints the results in JSON format
	uadmin.ReturnJSON(w, r, results)
}

license: MIT

repository: uadmin/uadmin-docs

license_type: permissive

repo_name: uadmin/uadmin-docs

branch_name: refs/heads/master

gha_license_id: NOASSERTION

gha_language: HTML

extension: go


text:
KSRC = "git://github.com/Nuvoton-Israel/linux;protocol=https;branch=${KBRANCH}"
KBRANCH = "NPCM-5.10-OpenBMC"
LINUX_VERSION = "5.10.161"
SRCREV = "ac7b0c4752378ed9fccfb6345b80d56de5baf1bc"

require linux-nuvoton.inc
SRC_URI:append:nuvoton = " file://enable_emmc_510.cfg"
SRC_URI:append:nuvoton = " file://disalbe_stackprotector.cfg"
SRC_URI:append:nuvoton = " file://enable-pcie-vdm.cfg"
SRC_URI:append:nuvoton = " file://enable-usb-legacy.cfg"

repository: Nuvoton-Israel/openbmc

repo_name: Nuvoton-Israel/openbmc

branch_name: refs/heads/npcm-master

gha_language: Python

extension: bb


text:
package cloudinsight

// FINCLOUD_APACHE_NO_VERSION

import (
	"context"
	"crypto"
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/azure"
	"github.com/Azure/go-autorest/autorest/validation"
	"github.com/Azure/go-autorest/tracing"
	"github.com/samjegal/fincloud-sdk-for-go/common"
	"github.com/samjegal/go-fincloud-helpers/security"
	"net/http"
	"strconv"
	"time"
)

// MonitorGroupClient is the cloud Insight Client
type MonitorGroupClient struct {
	BaseClient
}

// NewMonitorGroupClient creates an instance of the MonitorGroupClient client.
func NewMonitorGroupClient() MonitorGroupClient {
	return NewMonitorGroupClientWithBaseURI(DefaultBaseURI)
}

func NewMonitorGroupClientWithKey(accessKey string, secretKey string, apiGatewayKey string) MonitorGroupClient {
	return NewMonitorGroupClientWithBaseURIWithKey(DefaultBaseURI, accessKey, secretKey, apiGatewayKey)
}

// NewMonitorGroupClientWithBaseURI creates an instance of the MonitorGroupClient client using a custom endpoint.  Use
// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewMonitorGroupClientWithBaseURI(baseURI string) MonitorGroupClient {
	return MonitorGroupClient{NewWithBaseURI(baseURI)}
}

func NewMonitorGroupClientWithBaseURIWithKey(baseURI string, accessKey string, secretKey string, apiGatewayKey string) MonitorGroupClient {
	return MonitorGroupClient{NewWithBaseURIWithKey(baseURI, accessKey, secretKey, apiGatewayKey)}
}

// DeleteForce 감시 대상 그룹과 관련된 모든 Event Rule을 삭제합니다.
// Parameters:
// prodKey - 상품의 cw_key
// parameters - rule group for deletion
func (client MonitorGroupClient) DeleteForce(ctx context.Context, prodKey string, parameters []TypeGroupRelatedRuleParameter) (result autorest.Response, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.DeleteForce")
		defer func() {
			sc := -1
			if result.Response != nil {
				sc = result.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	if err := validation.Validate([]validation.Validation{
		{TargetValue: parameters,
			Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
		return result, validation.NewError("cloudinsight.MonitorGroupClient", "DeleteForce", err.Error())
	}

	req, err := client.DeleteForcePreparer(ctx, prodKey, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce", nil, "Failure preparing request")
		return
	}

	resp, err := client.DeleteForceSender(req)
	if err != nil {
		result.Response = resp
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce", resp, "Failure sending request")
		return
	}

	result, err = client.DeleteForceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce", resp, "Failure responding to request")
	}

	return
}

// DeleteForcePreparer prepares the DeleteForce request.
func (client MonitorGroupClient) DeleteForcePreparer(ctx context.Context, prodKey string, parameters []TypeGroupRelatedRuleParameter) (*http.Request, error) {
	queryParameters := map[string]interface{}{
		"prodKey": autorest.Encode("query", prodKey),
	}

	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("DELETE", common.GetPath(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/metric/groups")+"?"+common.GetQuery(queryParameters), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPath("/cw_fea/real/cw/api/rule/group/metric/groups"),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// DeleteForceSender sends the DeleteForce request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) DeleteForceSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// DeleteForceResponder handles the response to the DeleteForce request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) DeleteForceResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByClosing())
	result.Response = resp
	return
}

// DeleteForce1 감시 대상 그룹과 관련된 모든 Event Rule을 삭제합니다.
// Parameters:
// prodKey - 상품의 cw_key
// parameters - 감시 대상 그룹 혹은 감시 항목 그룹과 관련된 모든 Event Rule 리스트
func (client MonitorGroupClient) DeleteForce1(ctx context.Context, prodKey string, parameters []TypeGroupRelatedRuleParameter) (result String, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.DeleteForce1")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	if err := validation.Validate([]validation.Validation{
		{TargetValue: parameters,
			Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
		return result, validation.NewError("cloudinsight.MonitorGroupClient", "DeleteForce1", err.Error())
	}

	req, err := client.DeleteForce1Preparer(ctx, prodKey, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce1", nil, "Failure preparing request")
		return
	}

	resp, err := client.DeleteForce1Sender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce1", resp, "Failure sending request")
		return
	}

	result, err = client.DeleteForce1Responder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "DeleteForce1", resp, "Failure responding to request")
	}

	return
}

// DeleteForce1Preparer prepares the DeleteForce1 request.
func (client MonitorGroupClient) DeleteForce1Preparer(ctx context.Context, prodKey string, parameters []TypeGroupRelatedRuleParameter) (*http.Request, error) {
	queryParameters := map[string]interface{}{
		"prodKey": autorest.Encode("query", prodKey),
	}

	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("DELETE", common.GetPath(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/monitor/groups")+"?"+common.GetQuery(queryParameters), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPath("/cw_fea/real/cw/api/rule/group/monitor/groups"),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// DeleteForce1Sender sends the DeleteForce1 request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) DeleteForce1Sender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// DeleteForce1Responder handles the response to the DeleteForce1 request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) DeleteForce1Responder(resp *http.Response) (result String, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByUnmarshallingJSON(&result.Value),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// Get 감시 항목 그룹(템플릿) id로 감시 항목 그룹에 대한 상세정보를 조회합니다.
// Parameters:
// prodKey - 상품의 cw_key
// ID - 감시 항목 그룹(템플릿)의 id
func (client MonitorGroupClient) Get(ctx context.Context, prodKey string, ID string) (result MonitorGroupParameter, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.Get")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.GetPreparer(ctx, prodKey, ID)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "Get", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "Get", resp, "Failure sending request")
		return
	}

	result, err = client.GetResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "Get", resp, "Failure responding to request")
	}

	return
}

// GetPreparer prepares the Get request.
func (client MonitorGroupClient) GetPreparer(ctx context.Context, prodKey string, ID string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"id":      autorest.Encode("path", ID),
		"prodKey": autorest.Encode("path", prodKey),
	}

	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("GET", common.GetPathParameters(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/monitor/{prodKey}/{id}", pathParameters), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/cw_fea/real/cw/api/rule/group/monitor/{prodKey}/{id}", pathParameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) GetSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) GetResponder(resp *http.Response) (result MonitorGroupParameter, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// GetByMonitorGroupIds 감시 대상 그룹과 관련된 Event Rule을 조회합니다.
// Parameters:
// prodKey - 상품의 cw_key
// parameters - 조회하려는 감시 대상 그룹의 Id이며, 여러개의 감시 대상 그룹을 한번에 조회할 수 있습니다.
func (client MonitorGroupClient) GetByMonitorGroupIds(ctx context.Context, prodKey string, parameters []string) (result String, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.GetByMonitorGroupIds")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	if err := validation.Validate([]validation.Validation{
		{TargetValue: parameters,
			Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
		return result, validation.NewError("cloudinsight.MonitorGroupClient", "GetByMonitorGroupIds", err.Error())
	}

	req, err := client.GetByMonitorGroupIdsPreparer(ctx, prodKey, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "GetByMonitorGroupIds", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetByMonitorGroupIdsSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "GetByMonitorGroupIds", resp, "Failure sending request")
		return
	}

	result, err = client.GetByMonitorGroupIdsResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "GetByMonitorGroupIds", resp, "Failure responding to request")
	}

	return
}

// GetByMonitorGroupIdsPreparer prepares the GetByMonitorGroupIds request.
func (client MonitorGroupClient) GetByMonitorGroupIdsPreparer(ctx context.Context, prodKey string, parameters []string) (*http.Request, error) {
	queryParameters := map[string]interface{}{
		"prodKey": autorest.Encode("query", prodKey),
	}

	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("POST", common.GetPath(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/monitor/group/related")+"?"+common.GetQuery(queryParameters), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsPost(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPath("/cw_fea/real/cw/api/rule/group/monitor/group/related"),
		autorest.WithJSON(parameters),
		autorest.WithQueryParameters(queryParameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// GetByMonitorGroupIdsSender sends the GetByMonitorGroupIds request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) GetByMonitorGroupIdsSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// GetByMonitorGroupIdsResponder handles the response to the GetByMonitorGroupIds request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) GetByMonitorGroupIdsResponder(resp *http.Response) (result String, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByUnmarshallingJSON(&result.Value),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// List 해당 상품에 대한 모든 감시 항목 그룹(템플릿)을 조회합니다.
// Parameters:
// prodKey - 상품의 cw_key
func (client MonitorGroupClient) List(ctx context.Context, prodKey string) (result ListMonitorGroupParameter, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.List")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.ListPreparer(ctx, prodKey)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "List", nil, "Failure preparing request")
		return
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "List", resp, "Failure sending request")
		return
	}

	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "List", resp, "Failure responding to request")
	}

	return
}

// ListPreparer prepares the List request.
func (client MonitorGroupClient) ListPreparer(ctx context.Context, prodKey string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"prodKey": autorest.Encode("path", prodKey),
	}

	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("GET", common.GetPathParameters(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/monitor/{prodKey}", pathParameters), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/cw_fea/real/cw/api/rule/group/monitor/{prodKey}", pathParameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) ListSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) ListResponder(resp *http.Response) (result ListMonitorGroupParameter, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByUnmarshallingJSON(&result.Value),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// RemoveResourceFromRules event Rule의 감시 대상 그룹에서 특정 감시 대상을 삭제합니다.
// Parameters:
// parameters - remove info
func (client MonitorGroupClient) RemoveResourceFromRules(ctx context.Context, parameters RemoveResourceFromRulesParameter) (result autorest.Response, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/MonitorGroupClient.RemoveResourceFromRules")
		defer func() {
			sc := -1
			if result.Response != nil {
				sc = result.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.RemoveResourceFromRulesPreparer(ctx, parameters)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "RemoveResourceFromRules", nil, "Failure preparing request")
		return
	}

	resp, err := client.RemoveResourceFromRulesSender(req)
	if err != nil {
		result.Response = resp
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "RemoveResourceFromRules", resp, "Failure sending request")
		return
	}

	result, err = client.RemoveResourceFromRulesResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "cloudinsight.MonitorGroupClient", "RemoveResourceFromRules", resp, "Failure responding to request")
	}

	return
}

// RemoveResourceFromRulesPreparer prepares the RemoveResourceFromRules request.
func (client MonitorGroupClient) RemoveResourceFromRulesPreparer(ctx context.Context, parameters RemoveResourceFromRulesParameter) (*http.Request, error) {
	timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
	sec := security.NewSignature(client.Secretkey, crypto.SHA256)
	signature, err := sec.Signature("POST", common.GetPath(DefaultBaseURI, "/cw_fea/real/cw/api/rule/group/monitor/removeResourceFromRules"), client.AccessKey, timestamp)
	if err != nil {
		return nil, err
	}

	preparer := autorest.CreatePreparer(
		autorest.AsContentType("application/json; charset=utf-8"),
		autorest.AsPost(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPath("/cw_fea/real/cw/api/rule/group/monitor/removeResourceFromRules"),
		autorest.WithJSON(parameters),
		autorest.WithHeader("x-ncp-apigw-api-key", client.APIGatewayAPIKey),
		autorest.WithHeader("x-ncp-apigw-timestamp", timestamp),
		autorest.WithHeader("x-ncp-iam-access-key", client.AccessKey),
		autorest.WithHeader("x-ncp-apigw-signature-v2", signature))
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

// RemoveResourceFromRulesSender sends the RemoveResourceFromRules request. The method will close the
// http.Response Body if it receives an error.
func (client MonitorGroupClient) RemoveResourceFromRulesSender(req *http.Request) (*http.Response, error) {
	return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
}

// RemoveResourceFromRulesResponder handles the response to the RemoveResourceFromRules request. The method always
// closes the http.Response Body.
func (client MonitorGroupClient) RemoveResourceFromRulesResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest, http.StatusUnauthorized, http.StatusNotFound, http.StatusInternalServerError),
		autorest.ByClosing())
	result.Response = resp
	return
}

repository: samjegal/fincloud-sdk-for-go

repo_name: samjegal/fincloud-sdk-for-go


text:
@article{2019MNRAS.482.3261K,
 adsnote = {Provided by the SAO/NASA Astrophysics Data System},
 adsurl = {https://ui.adsabs.harvard.edu/abs/2019MNRAS.482.3261K},
 archiveprefix = {arXiv},
 author = {Kulier, Andrea and Padilla, Nelson and Schaye, Joop and
Crain, Robert A. and Schaller, Matthieu and Bower, Richard G. and
Theuns, Tom and Paillas, Enrique},
 doi = {10.1093/mnras/sty2914},
 eprint = {1805.05349},
 journal = {\mnras},
 keywords = {galaxies: evolution, galaxies: formation, galaxies: haloes, Astrophysics - Astrophysics of Galaxies},
 month = {January},
 number = {3},
 pages = {3261-3273},
 primaryclass = {astro-ph.GA},
 title = {The evolution of the baryon fraction in haloes as a cause of scatter in the galaxy stellar mass in the EAGLE simulation},
 volume = {482},
 year = {2019}
}

repository: epaillas/academic-kickstart

repo_name: epaillas/academic-kickstart

extension: bib


text:
SUMMARY = "Cinnamon Menus"
SECTION = "x11/libs"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
DEPENDS = ""

inherit cinnamon autotools gettext gobject-introspection

SRC_URI[md5sum] = "02410dc1a16ca6f0d4940fecb0535833"
SRC_URI[sha256sum] = "e17494e65edb6ca8b36e05ca21316db8ce6864d4f9bfa9312a661d5c39054ad7"

repository: Varcain/meta-cinnamon

repo_name: Varcain/meta-cinnamon


text:
inherit setuptools3
require python-xlsxwriter.inc

SRC_URI[md5sum] = "20f8b7df7f1705fa2f7ac3f84789d2ca"
SRC_URI[sha256sum] = "828b3285fc95105f5b1946a6a015b31cf388bd5378fdc6604e4d1b7839df2e77"

repository: johanjeppsson/meta-openembedded

repo_name: johanjeppsson/meta-openembedded

gha_license_id: MIT


text:
@inproceedings{Chakrabarty2017b,
 author = {S. Chakrabarty and E. A. P. Habets},
 booktitle = {ML4Audio Worskhop at NeurIPS},
 month = {December},
 title = {Multi-Speaker Localization using Convolutional Neural Network Trained with Noise},
 year = {2017}
}

repository: Soumitro-Chakrabarty/academic-kickstart

repo_name: Soumitro-Chakrabarty/academic-kickstart


text:
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRCREV = "10.09.05"
FILENAME = "Poleg_bootblock.bin"

SRC_URI = "git://github.com/Nuvoton-Israel/npcm7xx-bootblock;protocol=git"
SRC_URI[md5sum] = "cf8daa5f4636ed1ff952618e435af028"

S = "${WORKDIR}/git"

inherit deploy

do_deploy () {
	install -d ${DEPLOYDIR}
	install -m 644 ${FILENAME} ${DEPLOYDIR}/
}

addtask deploy before do_build after do_compile

repository: Ircona/openbmc

repo_name: Ircona/openbmc


text:
@INPROCEEDINGS{Wettel2008,
  author = {Richard Wettel and Michele Lanza},
  title = {Visually localizing design problems with disharmony maps},
  pages = {155--164},
  abstract = {Assessing the quality of software design is difficult, as "design" is expressed through guidelines and heuristics, not rigorous rules. One successful approach to assess design quality is based on detection strategies, which are metrics-based composed logical conditions, by which design fragments with specific properties are detected in the source code. Such detection strategies, when executed on large software systems usually return large sets of artifacts, which potentially exhibit one or more "design disharmonies", which are then inspected manually, a cumbersome activity. In this article we present disharmony maps, a visualization-based approach to locate such flawed software artifacts in large systems. We display the whole system using a 3D visualization technique based on a city metaphor. We enrich such visualizations with the results returned by a number of detection strategies, and thus render both the static structure and the design problems that affect a subject system. We evaluate our approach on a number of open-source Java systems and report on our findings.},
  doi = {10.1145/1409720.1409745},
  year = {2008},
  booktitle = {SoftVis'08: Proceedings of the Symposium on Software Visualization},
  publisher = {ACM Press},
  isbn = {9781605581125}
}

repository: vis-au/treevisnet

repo_name: vis-au/treevisnet

gha_language: TeX


text:
@book {Lehner2012DidaktischeReduktion,
title = {Didaktische Reduktion},
editor = {Lehner, Martin},
series = {UTB ; 3715},
series = {utb-studi-e-book},
address = {Stuttgart},
publisher = {UTB GmbH},
year = {2012},
pages = {Online Ressource (211  Seiten , 56 Abb.)},
edition = {1. Aufl.},
ISBN = {978-3-8385-3715-3},
ISBN = {978-3-8252-3715-8 (Druck-Ausgabe)},
language = {Deutsch},
keywords = {Bildung. Didaktische Reduktion. Erwachsenenbildung},
type = {Lehrmittel},
abstract = {Jeder Lehrende kennt das Problem: Die Komplexität der Lerninhalte nimmt ständig zu, gleichzeitig steht immer weniger Zeit für Lernprozesse zur Verfügung.Martin Lehner zeigt, wie man komplexe Sachverhalte ohne falsche Vereinfachung so aufbereitet, dass sie auch in kurzer Zeit zu verstehen sind. Abhängig von den jeweiligen Rahmenbedingungen kann es sich bei der Didaktischen Reduktion sowohl um eine Reduktion der Stofffülle (Auswahl) als auch um eine Reduktion der inhaltlichen Komplexität (Konzentration und Vereinfachung) handeln. Martin Lehner führt in Konzepte der didaktischen Reduktion ein und gibt konkrete Hinweise für die tägliche Lehrpraxis.Ein Buch, für das jeder Lehrer und Dozent dankbar sein wird.},
URL = {http://www.utb-studi-e-book.de/9783838537153},
}

repository: marius-ebel/lecture

repo_name: marius-ebel/lecture


text:
'use strict';

const globalVariables = require('../../lib/utils/global-variables.js');
const express = require('express');
const consts = require('../../lib/consts/consts.js');
const _ = require('lodash');
const config = require('config');
const validator = require('validator');
const async = require('async');
const mongodb = require('mongodb');
const router = express.Router();
let util = require('util');

let allFields = [
    '_id',
    'codename',
    'name',
    'desc',
    'deftrendfields',
    'deftrendobjects',
    'fields',
    '_appid',
    '_ctime'
];

let defaultFields = [
    'fields'
];

// Get a specific action type
router.get('/action-type/:_appid/:_typeid',
    validate,
    getConverter,
    handleMoreFileds,
    function(req, res, next) {
        let _appid = req.params._appid;
        let _typeid = req.params._typeid;
        let collection = config.mongod.prefix + consts.ACTION_TYPE_COLLECTION;

        let query = {
            [req.meotrics_converters['_appid']]: _appid,
            [req.meotrics_converters['codename']]: _typeid
        };

        let projection = {};
        req.meotrics_moreFields.forEach(field => {
            projection[req.meotrics_converters[field]] = 1;
        });

        let options = {};

        globalVariables
            .get('db')
            .collection(collection)
            .findOne(query, projection, options, (err, result) => {
                if(err) {
                    return res.json({
                        ec: consts.CODE.ERROR,
                        error: util.inspect(err)
                    });
                }

                res.json({
                    ec: consts.CODE.SUCCESS,
                    data: result
                });
            });
    });

// Middleware for checking data
function validate(req, res, next) {
    return next();
}

function getConverter(req, res, next) {
    globalVariables.get('converter').toIDs(allFields, ids => {
        req.meotrics_converters = ids;
        return next();
    });
}

function handleMoreFileds(req, res, next) {
    let more = req.query.more || '';
    let moreFields = more.split(',');

    let temp = [];
    moreFields.forEach(field => {
        if( (allFields.indexOf(field) !== -1) && (defaultFields.indexOf(field) === -1) ) {
            temp.push(field);
        }
    });

    req.meotrics_moreFields = temp.concat(defaultFields);

    return next();
}

module.exports = function (app) {
    app.use('/', router);
};

repository: meotrics/meotrics

repo_name: meotrics/meotrics

extension: js


text:
@incollection{Wilkey2016a,
 author = {Wilkey, J and Spinti, J and Ring, T},
 booktitle = {Utah Oil Shale - Science, Technology, and Policy Perspectives},
 chapter = {11},
 editor = {Spinti, J},
 isbn = {9781498721721},
 pages = {279--308},
 publisher = {CRC Press},
 title = {Economic Analysis of In Situ Oil Shale Development in the Uinta Basin},
 year = {2016}
}

repository: jonwilkey/MySite

repo_name: jonwilkey/MySite


text:
@article{boyce2020maze,
 author = {Veronica Boyce and Richard Futrell and Roger P. Levy},
 code = {https://github.com/vboyce/Maze},
 journal = {Journal of Memory and Language},
 pages = {104082},
 title = {Maze Made Easy: Better and easier measurement of incremental processing difficulty},
 url = {http://socsci.uci.edu/~rfutrell/papers/boyce2020maze.pdf},
 volume = {111},
 year = {2020}
}

repository: langprocgroup/academic-kickstart

repo_name: langprocgroup/academic-kickstart


text:
package model

import (
	"encoding/json"

	"strings"
)

// Request Object
type ListMigprojectsRequest struct {
	// 每一页记录的迁移项目

	Limit *int32 `json:"limit,omitempty"`
	// 偏移量

	Offset *int32 `json:"offset,omitempty"`
}

func (o ListMigprojectsRequest) String() string {
	data, err := json.Marshal(o)
	if err != nil {
		return "ListMigprojectsRequest struct{}"
	}

	return strings.Join([]string{"ListMigprojectsRequest", string(data)}, " ")
}


text:
package portwarden

import (
	"archive/zip"
	"bufio"
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"strconv"
	"strings"
	"time"

	b64 "encoding/base64"
	"github.com/davecgh/go-spew/spew"

	"github.com/mholt/archiver"
	"github.com/tidwall/pretty"
)

const (
	BackupFolderName              = "./portwarden_backup/"
	ErrVaultIsLocked              = "vault is locked"
	ErrNoPhassPhraseProvided      = "no passphrase provided"
	ErrNoFilenameProvided         = "no filename provided"
	ErrSessionKeyExtractionFailed = "session key extraction failed"
	ErrVaultNotEmptyForRestore    = "account's valut not empty! you have to restore the backup to an empty Bitwarden account"

	BWErrNotLoggedIn           = "You are not logged in."
	BWErrInvalidMasterPassword = "Invalid master password."
	BWEnterEmailAddress        = "? Email address:"
	BWEnterMasterPassword      = "? Master password:"

	LoginCredentialMethodNone          = 100
	LoginCredentialMethodAuthenticator = 0
	LoginCredentialMethodEmail         = 1
	LoginCredentialMethodYubikey       = 3

	ItemsJsonFileName   = "items.json"
	FoldersJSONFileName = "folders.json"
)

// LoginCredentials is used to login to the `bw` cli. See documentation
// https://help.bitwarden.com/article/cli/
// The possible `Method` values are
// None 			100
// Authenticator	0
// Email			1
// Yubikey			3
type LoginCredentials struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Method   int    `json:"method"`
	Code     string `json:"code"`
}

func CreateBackupBytesUsingBitwardenLocalJSON(dataJson []byte, BITWARDENCLI_APPDATA_DIR, passphrase, sessionKey string, sleepMilliseconds int) ([]byte, error) {
	// Put data.json in the BITWARDENCLI_APPDATA_DIR
	defer BWDelete(BITWARDENCLI_APPDATA_DIR)
	if err := ioutil.WriteFile(filepath.Join(BITWARDENCLI_APPDATA_DIR, "data.json"), dataJson, 0644); err != nil {
		return nil, err
	}
	return CreateBackupBytes(passphrase, sessionKey, sleepMilliseconds)
}

func CreateBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int, noLogout bool) error {
	if !noLogout {
		defer BWLogout()
	}
	if !strings.HasSuffix(fileName, ".portwarden") {
		fileName += ".portwarden"
	}
	f, err := os.Create(fileName)
	if err != nil {
		return err
	}
	defer f.Close()
	encryptedData, err := CreateBackupBytes(passphrase, sessionKey, sleepMilliseconds)
	if err != nil {
		return err
	}
	f.Write(encryptedData)
	return nil
}

func CreateBackupBytes(passphrase, sessionKey string, sleepMilliseconds int) ([]byte, error) {
	if err := os.MkdirAll(BackupFolderName, os.ModePerm); err != nil {
		return nil, err
	}
	defer os.RemoveAll(BackupFolderName)

	// save formmated json to FoldersJSONFileName
	rawByte, err := BWListFoldersRawBytes(sessionKey)
	if err != nil {
		return nil, err
	}
	formattedByte := pretty.Pretty(rawByte)
	if err := ioutil.WriteFile(BackupFolderName+FoldersJSONFileName, formattedByte, 0644); err != nil {
		return nil, err
	}

	// save formmated json to ItemsJsonFileName
	rawByte, err = BWListItemsRawBytes(sessionKey)
	if err != nil {
		return nil, err
	}
	formattedByte = pretty.Pretty(rawByte)
	if err := ioutil.WriteFile(BackupFolderName+ItemsJsonFileName, formattedByte, 0644); err != nil {
		return nil, err
	}

	// download attachments
	pwes := []PortWardenElement{}
	if err := json.Unmarshal(rawByte, &pwes); err != nil {
		return nil, err
	}
	err = BWGetAllAttachments(BackupFolderName, sessionKey, pwes, sleepMilliseconds)
	if err != nil {
		return nil, err
	}

	var b bytes.Buffer
	writer := bufio.NewWriter(&b)
	err = archiver.Zip.Write(writer, []string{BackupFolderName})
	if err != nil {
		return nil, err
	}

	// derive a key from the master password
	encryptedBytes, err := EncryptBytes(b.Bytes(), passphrase)
	if err != nil {
		return nil, err
	}

	return encryptedBytes, nil
}

func DecryptBackupFile(fileName, passphrase string) error {
	rawBytes, err := ioutil.ReadFile(fileName)
	if err != nil {
		return err
	}
	tb, err := DecryptBytes(rawBytes, passphrase)
	if err != nil {
		fmt.Println("decryption failed: " + err.Error())
		return err
	}
	if err := ioutil.WriteFile(fileName+".decrypted"+".zip", tb, 0644); err != nil {
		fmt.Println("decryption failed: " + err.Error())
		return err
	}
	return nil
}

func RestoreBackupFile(fileName, passphrase, sessionKey string, sleepMilliseconds int, noLogout bool) error {
	// dummy check if the account is not empty, don't restore
	var err error
	var rawByte []byte

	var file []byte
	err = DecryptBackupFile(fileName, passphrase)
	if err != nil {
		return err
	}
	err = Unzip(fileName+".decrypted"+".zip", "")
	if err != nil {
		return err
	}
	defer os.RemoveAll(BackupFolderName)
	defer os.Remove(fileName + ".decrypted" + ".zip")

	rawByte, err = BWListItemsRawBytes(sessionKey)
	if err != nil {
		return err
	}
	pwes := []PortWardenElement{}
	if err := json.Unmarshal(rawByte, &pwes); err != nil {
		return err
	}
	if len(pwes) != 0 {
		return errors.New(ErrVaultNotEmptyForRestore)
	}

	// restore folders
	if file, err = ioutil.ReadFile(BackupFolderName + FoldersJSONFileName); err != nil {
		return err
	}
	folderData := PortWardenFolder{}
	err = json.Unmarshal([]byte(file), &folderData)
	if err != nil {
		return err
	}
	oldToNewFolderID := make(map[string]string)
	var itemBytes []byte
	for _, item := range folderData {
		time.Sleep(time.Millisecond * time.Duration(sleepMilliseconds))
		if item.ID != nil {
			itemBytes, err = json.Marshal(item)
			cmd := exec.Command("bw", "create", "folder", "--session", sessionKey, b64.StdEncoding.EncodeToString(itemBytes))
			var stdout bytes.Buffer
			var stderr bytes.Buffer
			cmd.Stdout = &stdout
			cmd.Stderr = &stderr
			cmd.Stdin = os.Stdin
			if err := cmd.Run(); err != nil {
				fmt.Println("An error occured: ", err)
				spew.Dump(stdout, stderr)
			}
			fmt.Println("restoring folder", item.Name)
			newItem := PortWardenFolderElement{}
			err = json.Unmarshal(stdout.Bytes(), &newItem)
			if err != nil {
				return err
			}
			oldToNewFolderID[*item.ID] = *newItem.ID
		}
	}

	// restore items
	if file, err = ioutil.ReadFile(BackupFolderName + ItemsJsonFileName); err != nil {
		return err
	}
	itemData := PortWarden{}
	err = json.Unmarshal([]byte(file), &itemData)
	if err != nil {
		return err
	}
	oldToNewItemID := make(map[string]string)
	for _, item := range itemData {
		time.Sleep(time.Millisecond * time.Duration(sleepMilliseconds))
		// deal with attachments separately
		item.Attachments = nil
		if item.FolderID != nil {
			*item.FolderID = oldToNewFolderID[*item.FolderID]
		}
		item.OrganizationID = nil
		item.CollectionIDS = nil

		itemBytes, err = json.Marshal(item)
		cmd := exec.Command("bw", "create", "item", "--session", sessionKey, b64.StdEncoding.EncodeToString(itemBytes))
		var stdout bytes.Buffer
		var stderr bytes.Buffer
		cmd.Stdout = &stdout
		cmd.Stderr = &stderr
		cmd.Stdin = os.Stdin
		if err := cmd.Run(); err != nil {
			fmt.Println("An error occured: ", err)
			spew.Dump(stdout, stderr)
		}
		fmt.Println("restoring item", item.Name)
		newItem := PortWardenElement{}
		err = json.Unmarshal(stdout.Bytes(), &newItem)
		if err != nil {
			return err
		}
		oldToNewItemID[item.ID] = newItem.ID
	}
	fmt.Println("restoring item finished")

	// restore item's attachments
	if file, err = ioutil.ReadFile(BackupFolderName + ItemsJsonFileName); err != nil {
		return err
	}
	itemData = PortWarden{}
	err = json.Unmarshal([]byte(file), &itemData)
	if err != nil {
		return err
	}
	for _, item := range itemData {
		if len(item.Attachments) > 0 {
			time.Sleep(time.Millisecond * time.Duration(sleepMilliseconds))
			for _, innerItem := range item.Attachments {
				itemBytes, err = json.Marshal(item)
				cmd := exec.Command("bw", "create", "attachment", "--itemid", oldToNewItemID[item.ID], "--session", sessionKey, "--file", BackupFolderName+item.Name+"/"+innerItem.FileName)
				var stdout bytes.Buffer
				var stderr bytes.Buffer
				cmd.Stdout = &stdout
				cmd.Stderr = &stderr
				cmd.Stdin = os.Stdin
				if err := cmd.Run(); err != nil {
					fmt.Println("An error occured: ", err)
					spew.Dump(stdout, stderr)
				}
				fmt.Println("restoring item's attachment", item.Name, innerItem.FileName)
			}
		}
	}
	return nil
}

func ExtractSessionKey(stdout string) (string, error) {
	r := regexp.MustCompile(`BW_SESSION=".+"`)
	matches := r.FindAllString(stdout, 1)
	if len(matches) == 0 {
		return "", errors.New(ErrSessionKeyExtractionFailed)
	}
	sessionKeyRawString := r.FindAllString(stdout, 1)[0]
	sessionKey := strings.TrimPrefix(sessionKeyRawString, `BW_SESSION="`)
	sessionKey = sessionKey[:len(sessionKey)-1]
	return sessionKey, nil
}

func BWListItemsRawBytes(sessionKey string) ([]byte, error) {
	var stdout, stderr bytes.Buffer
	cmd := exec.Command("bw", "list", "items", "--session", sessionKey)
	cmd.Stdin = os.Stdin
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	err := cmd.Run()
	if err != nil {
		return nil, err
	}
	return stdout.Bytes(), nil
}

func BWListFoldersRawBytes(sessionKey string) ([]byte, error) {
	var stdout, stderr bytes.Buffer
	cmd := exec.Command("bw", "list", "folders", "--session", sessionKey)
	cmd.Stdin = os.Stdin
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	err := cmd.Run()
	if err != nil {
		return nil, err
	}
	return stdout.Bytes(), nil
}

func BWGetAttachment(outputDir, itemID, attachmentID, sessionKey string) error {
	cmd := exec.Command("bw", "get", "attachment", attachmentID, "--itemid", itemID,
		"--session", sessionKey, "--output", outputDir)
	err := cmd.Run()
	if err != nil {
		return err
	}
	return nil
}

func BWGetAllAttachments(outputDir, sessionKey string, pws []PortWardenElement, sleepMilliseconds int) error {
	for _, item := range pws {
		if len(item.Attachments) > 0 {
			for _, innerItem := range item.Attachments {
				ourputDir := strings.TrimSpace(outputDir + item.Name) // Keep this line. See https://github.com/vwxyzjn/portwarden/issues/10
				err := BWGetAttachment(ourputDir+"/", item.ID, innerItem.ID, sessionKey)
				time.Sleep(time.Millisecond * time.Duration(sleepMilliseconds))
				if err != nil {
					spew.Dump(err, "failed item ids are ", item.ID, innerItem.ID, item.Name)
					return err
				}
			}
		}
	}
	return nil
}

func BWLoginGetSessionKey(lc *LoginCredentials) (string, error) {
	var cmd *exec.Cmd
	if lc.Method != LoginCredentialMethodNone {
		cmd = exec.Command("bw", "login", lc.Email, lc.Password, "--method", strconv.Itoa(lc.Method), "--code", lc.Code, "--raw")
	} else {
		cmd = exec.Command("bw", "login", lc.Email, lc.Password, "--raw")
	}
	var stdout bytes.Buffer
	cmd.Stdout = &stdout
	if err := cmd.Run(); err != nil {
		return stdout.String(), err
	}
	sessionKey := stdout.String()
	return sessionKey, nil
}

func BWLoginGetSessionKeyAndDataJSON(lc *LoginCredentials, BITWARDENCLI_APPDATA_DIR string) (string, []byte, error) {
	sessionKey, err := BWLoginGetSessionKey(lc)
	if err != nil {
		return "", nil, err
	}
	defer BWDelete(BITWARDENCLI_APPDATA_DIR)
	dataJSONPath := filepath.Join(BITWARDENCLI_APPDATA_DIR, "data.json")
	dat, err := ioutil.ReadFile(dataJSONPath)
	if err != nil {
		return "", nil, err
	}
	err = os.Remove(dataJSONPath)
	if err != nil {
		return "", nil, err
	}
	return sessionKey, dat, nil
}

func BWLogout() error {
	var stdout, stderr bytes.Buffer
	cmd := exec.Command("bw", "logout")
	cmd.Stdin = os.Stdin
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr
	err := cmd.Run()
	if err != nil {
		return errors.New(string(stderr.Bytes()))
	}
	return nil
}

func BWDelete(BITWARDENCLI_APPDATA_DIR string) error {
	dataJSONPath := filepath.Join(BITWARDENCLI_APPDATA_DIR, "data.json")
	err := os.Remove(dataJSONPath)
	if err != nil {
		return err
	}
	return nil
}

func Unzip(src, dest string) error {
	r, err := zip.OpenReader(src)
	if err != nil {
		return err
	}
	defer func() {
		if err := r.Close(); err != nil {
			panic(err)
		}
	}()

	os.MkdirAll(dest, 0755)

	// Closure to address file descriptors issue with all the deferred .Close() methods
	extractAndWriteFile := func(f *zip.File) error {
		rc, err := f.Open()
		if err != nil {
			return err
		}
		defer func() {
			if err := rc.Close(); err != nil {
				panic(err)
			}
		}()

		path := filepath.Join(dest, f.Name)

		if f.FileInfo().IsDir() {
			os.MkdirAll(path, f.Mode())
		} else {
			os.MkdirAll(filepath.Dir(path), f.Mode())
			f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
			if err != nil {
				return err
			}
			defer func() {
				if err := f.Close(); err != nil {
					panic(err)
				}
			}()

			_, err = io.Copy(f, rc)
			if err != nil {
				return err
			}
		}
		return nil
	}

	for _, f := range r.File {
		err := extractAndWriteFile(f)
		if err != nil {
			return err
		}
	}

	return nil
}

repository: vwxyzjn/portwarden

repo_name: vwxyzjn/portwarden

gha_language: Go


text:
DESCRIPTION = "Node-RED Contrib ModBus Node"
HOMEPAGE = "https://flows.nodered.org/node/node-red-contrib-modbus"

SRC_URI  = "git://github.com/biancode/node-red-contrib-modbus.git;protocol=git;tag=v${PV}"

require node-red-module.inc


text:
inherit obmc-phosphor-systemd

SUMMARY = "Intel ASD Utility"
DESCRIPTION = "Intel At-Scale Debug utility"

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=0d1c657b2ba1e8877940a8d1614ec560"

SRC_URI = "git://github.com/Intel-BMC/asd"
SRCREV = "1.4.4"

S = "${WORKDIR}/git"
PV = "0.1+git${SRCPV}"

inherit cmake
DEPENDS = "sdbusplus openssl libpam libgpiod safec"
RDEPENDS_${PN} = "safec"

do_configure[depends] += "virtual/kernel:do_shared_workdir"

# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = "-DBUILD_UT=OFF"


text:
package workers

import (
	"github.com/mee6aas/zeep/internal/pkg/worker"
	"github.com/pkg/errors"
)

// Add adds a worker into the collection with specified username and activity name as the key.
func Add(username string, actName string, w worker.Worker) (e error) {
	var (
		ok bool
		es map[string][]worker.Worker
		ws []worker.Worker
	)

	if ok = w.IsAllocated(); !ok {
		e = errors.New("not allocated worker")
		return
	}

	if es, ok = workers[username]; !ok {
		es = make(map[string][]worker.Worker)
	}

	if ws, ok = es[actName]; !ok {
		ws = make([]worker.Worker, 0, 1)
	}

	es[actName] = append(ws, w)
	workers[username] = es

	return
}

// TryAdd attempts to add a worker into the collection with specified username and activity name as the key.
// Use the `Add` instead if you are not sure about the preconditions.
func TryAdd(username string, actName string, w worker.Worker) (ok bool) {
	e := Add(username, actName, w)
	ok = e == nil

	return
}


text:
@inproceedings{cruz2017improving,
 author = {Cruz-Benito, Juan and Therón, Roberto and García-Peñalvo, Francisco J and Sánchez-Prieto, José Carlos and Vázquez-Ingelmo, Andrea and Martín-González, Martín and Martínez, Jorge M},
 booktitle = {International Conference on Learning and Collaboration Technologies},
 organization = {Springer},
 pages = {352--370},
 title = {Improving success/completion ratio in large surveys: a proposal based on usability and engagement},
 year = {2017}
}