text:
% Online experiments

@article{salganik_cultural_market_2006,
  title={Experimental Study of Inequality and Unpredictability in an Artificial Cultural Market},
  author={Salganik, M.J. and Dodds, P.S. and Watts, D.J.},
  journal={Science},
  volume={311},
  number={5762},
  pages={854--856},
  year={2006}
}

@article{horton_online_laboratory_2011,
  title={The Online Laboratory: Conducting Experiments in a Real Labor Market},
  author={Horton, J.J. and Rand, D.G. and Zeckhauser, R.J.},
  journal={Experimental Economics},
  volume={14},
  number={3},
  pages={399--425},
  year={2011}
}

@article{paolacci_amt_2010,
  title={Running Experiments on Amazon Mechanical Turk},
  author={Paolacci, G. and Chandler, J. and Ipeirotis, P.G.},
  journal={Judgment and Decision Making},
  volume={5},
  number={5},
  pages={411--419},
  year={2010}
}

@article{mason_behavioral_amt_2012,
  title={Conducting Behavioral Research on Amazon's Mechanical Turk},
  author={Mason, W.and Suri, S.},
  journal={Behavior Research Methods},
  volume={44},
  number={1},
  pages={1--23},
  year={2012}
}

@article{FutureofSocialExperimenting,
  author = {Helbing, D. and Yu, W.},
  title = {The Future of Social Experimenting},
  journal={Proceedings of the National Academy of Sciences (PNAS)},
  issue = {107},
  number = {12},
  pages = {5265--5266},
  year = 2010
}

% Time to Decision

@article{rubinstein_response_time_2013,
  title={Response Time and Decision Making: An Experimental Study},
  author={Rubinstein, A},
  journal={Judgment and Decision Making},
  volume={8},
  number={5},
  pages={540--551},
  year={2013}
}

@article{rand_giving_greed_2012,
  title={Spontaneous Giving and Calculated Greed},
  author={Rand, D.G. and Greene, J.D. and Nowak, M.A.},
  journal={Nature},
  volume={489},
  number={7416},
  pages={427--430},
  year={2012}
}

% Suri

@article{wang_assortativity_2012,
  title={Cooperation and Assortativity with Dynamic Partner Updating},
  author={Wang, J. and Suri, S. and Watts, D.J.},
  journal={Proceedings of the National Academy of Sciences (PNAS)},
  volume={109},
  number={36},
  pages={14363--14368},
  year={2012}
}

@article{suri_contagion_2011,
  title={Cooperation and Contagion in Web-Based, Networked Public Goods Experiments},
  author={Suri, S. and Watts, D.J.},
  journal={PLoS One},
  volume={6},
  number={3},
  pages={e16836},
  year={2011}
}

%% Reips

@article{reips_standards_2002,
  title={Standards for Internet-Based Experimenting},
  author={Reips, U.-D.},
  journal={Experimental Psychology},
  volume={49},
  number={4},
  pages={243--256},
  year={2002}
}

@inbook{musch_history_web_exp_2000,
  chapter={A Brief History of Web Experimenting},
  title={Psychological Experiments on the Internet},
  editor={Birnbaum, M.H.},
  author={Musch, J. and Reips, U.-D.},
  year={2000},
  publisher={Academic Press}
}

@inbook{reips_conducting_2010,
  chapter={Conducting True Experiments on the Web.},
  author={Reips, U.-D. and Krantz, J.H.},
  title={Advanced Methods for Conducting Online Behavioral Research},
  editor={Gosling, S.D. and Johnson J.A.},
  year={2010},
  publisher={American Psychological Association}
}

@article{mangan_sleep_sex_2007,
  title={Sleep, Sex, and the Web: Surveying the Difficult-to-Reach Clinical Population Suffering From Sexsomnia},
  author={Mangan, M.A. and Reips, U.-D.},
  journal={Behavior Research Methods},
  volume={39},
  number={2},
  pages={233--236},
  year={2007}
}

% Other Psy

@article{birnbaum_human_2004,
  title={Human Research and Data Collection via the Internet},
  author={Birnbaum, M.H.},
  journal={Annual Review of Psychology},
  volume={55},
  pages={803--832},
  year={2004}
}

@article{horswill_drivers_web_2001,
  title={User-Controlled Photographic Animations, Photograph-Based Questions, and Questionnaires: Three Internet-Based Instruments for Measuring Drivers' Risk-Taking Behavior},
  author={Horswill, M.S. and Coster, M.E.},
  journal={Behavior Research Methods, Instruments, \& Computers},
  volume={33},
  number={1},
  pages={46--58},
  year={2001}
}

@article{schmidt_technical_online_2007,
  chapter={Technical Considerations When Implementing Online Research},
  author={Schmidt, W.C.},
  title={The Oxford Handbook of Internet Psychology},
  pages={461--472},
  year={2007},
  publisher={Oxford University Press},
  address={Oxford, England}
}

@article{luce_reliability_self-report_2007,
  title={Reliability of Self-Report: Paper Versus Online Administration},
  author={Luce, K.H. and Winzelberg, A.J. and Das, S. and Osborne, M.I. and Bryson, S.W. and Taylor, C.B.},
  journal={Computers in Human Behavior},
  volume={23},
  number={3},
  pages={1384--1389},
  year={2007}
}

@article{buchanan_five_personality_2005,
  title={Implementing a Five-Factor Personality Inventory for Use on the Internet},
  author={Buchanan, T. and Johnson, J.A. and Goldberg, L.R.},
  journal={European Journal of Psychological Assessment},
  volume={21},
  number={2},
  pages={115--127},
  year={2005}
}

@article{bargh_internet_life_2004,
  title={The Internet and Social Life},
  author={Bargh, J.A. and McKenna, K.Y.A.},
  journal={Annual Review of Psychology},
  volume={55},
  pages={573--590},
  year={2004}
}

@article{kraut_psy_online_report_2004,
  title={Psychological Research Online: Report of Board of Scientific Affairs' Advisory Group on the Conduct of Research on the Internet.},
  author={Kraut, R. and Olson, J. and Banaji, M. and Bruckman, A. and
                  Cohen, J. and Couper, M.},
  journal={American Psychologist},
  volume={59},
  number={2},
  pages={105--107},
  year={2004}
}

% Multicultural

@article{bohner_rape_2002,
  title={Rape Myth Acceptance and Judgments of Vulnerability to Sexual Assault: An Internet Experiment.},
  author={Bohner, G. and Danner, U.N. and Siebler, F. and Samson, G.B.},
  journal={Experimental Psychology},
  volume={49},
  number={4},
  pages={257--269},
  year={2002}
}

% Online research for extended periods of time

@article{butler_membership_2001,
  title={Membership Size, Communication Activity, and Sustainability: A Resource-Based Model of Online Social Structures},
  author={Butler, B.S.},
  journal={Information Systems Research},
  volume={12},
  number={4},
  pages={346--362},
  year={2001}
}

@inproceedings{bos_trust_effects_2002,
  title={Effects of Four Computer-Mediated Communications Channels on Trust Development},
  author={Bos, N. and Olson, J. and Gergle, D. and Olson, G. and Wright, Z.},
  booktitle={Proceedings of the SIGCHI Conference on Human Factors in Computing Systems},
  pages={135--140},
  year={2002},
  organization={ACM}
}

@article{centola_spread_2010,
  title={The Spread of Behavior in an Online Social Network Experiment},
  author={Centola, D.},
  journal={Science},
  volume={329},
  number={5996},
  pages={1194--1197},
  keywords={contagion},
  year={2010}
}

% Multiplayer Online Games studies

@article{szell_multiplayer_2010,
    author = {Szell, M. and Thurner, S.},
    journal = {Social Networks},
    number = {4},
    pages = {313--329},
    title = {Measuring Social Dynamics in a Massive Multiplayer Online Game},
    volume = {32},
    year = {2010}
}

@article{bainbridge_2007,
    author = {Bainbridge, W.S.},
    journal = {Science},
    keywords = {games},
    number = {5837},
    pages = {472--476},
    title = {The Scientific Research Potential of Virtual Worlds},
    volume = {317},
    year = {2007}
}

@article{johnson_guilds_2009,
    author = {Johnson, N.F. and Xu, C.and Zhao, Z. and Ducheneaut, N. and Yee, N. and Tita, G. and Hui, P.M.},
    journal = {Physical Review E},
    number = {6},
    pages = {066117+},
    publisher = {American Physical Society},
    title = {Human Group Formation in Online Guilds and Offline Gangs Driven by a Common Team Dynamic},
    volume = {79},
    year = {2009}
}

% Platforms

@article{peer_beyond_turk_2017,
  title={Beyond the Turk: Alternative Platforms for Crowdsourcing Behavioral Research},
  author={Peer, E. and Brandimarte, L. and Samat, S. and Acquisti, A.},
  journal={Journal of Experimental Social Psychology},
  volume={70},
  pages={153--163},
  year={2017}
}

@article{vakharia_beyond_turk_2015,
  title={Beyond Mechanical Turk: An Analysis of Paid Crowd Work Platforms},
  author={Vakharia, D. and Lease, M.},
  journal={Proceedings of the iConference},
  year={2015}
}

% Mturk

@article{stewart_mturk_size_2015,
  title={The Average Laboratory Samples a Population of 7,300 Amazon Mechanical Turk Workers},
  author={Stewart, N. and Ungemach, C. and Harris, A.J.L. and Bartels, D.M. and Newell, B.R. and Paolacci, G. and Chandler, J.},
  journal={Judgment and Decision Making},
  volume={10},
  number={5},
  pages={479},
  year={2015}
}

@article{bohannon_mturk_upends_2016,
  title={Mechanical Turk Upends Social Sciences},
  author={Bohannon, J.},
  journal={Science},
  volume={352},
  number={6291},
  pages={1263--1264},
  year={2016}
}

@article{thomas_validity_exclusion_mturk_2017,
  title={Validity and Mechanical Turk: An Assessment of Exclusion Methods and Interactive Experiments},
  author={Thomas, K.A. and Clifford, S.},
  journal={Computers in Human Behavior},
  year={2017},
  note={(forthcoming)}
}

% Naivete

@article{chandler_nonnaivete_amt_2014,
  title={Nonna{\"\i}vet{\'e} Among Amazon Mechanical Turk Workers: Consequences and Solutions for Behavioral Researchers},
  author={Chandler, J. and Mueller, P. and Paolacci, G.},
  journal={Behavior Research Methods},
  volume={46},
  number={1},
  pages={112--130},
  year={2014}
}

@article{chandler_naive_participants_effect_2015,
  title={Using Nonnaive Participants Can Reduce Effect Sizes},
  author={Chandler, J. and Paolacci, G. and Peer, E. and Mueller, P. and Ratliff, K.A.},
  journal={Psychological Science},
  volume={26},
  number={7},
  pages={1131--1139},
  year={2015}
}

@article{zwaan_naive_participants_reproducibility_2017,
  title={Participant Nonnaivet{\'e} and the Reproducibility of Cognitive Psychology},
  author={Zwaan, R.A. and Pecher, D. and Paolacci, G. and Bouwmeester, S. and Verkoeijen, P. and Dijkstra, K. and Zeelenberg, R.},
  journal={Psychonomic Bulletin \& Review},
  pages={1--5},
  year={2017}
}

% Lab vs Online

@article{stewart_average_sample_amt_2015,
  title={The Average Laboratory Samples a Population of 7,300 Amazon Mechanical Turk Workers},
  author={Stewart, N. and Ungemach, C. and Harris, A.J.L. and Bartels, D.M. and Newell, B.R/ and Paolacci, G. and Chandler, J.},
  journal={Judgment and Decision Making},
  volume={10},
  number={5},
  pages={479--491},
  year={2015}
}

@article{arechar_interactive_online_2017,
  title={Conducting Interactive Experiments Online},
  author={Arechar, A.A. and G{\"a}chter, S. and Molleman, L.},
  journal={Experimental Economics},
  pages={1--33},
  year={2017}
}

@article{behrend_viability_crowdsourcing_2011,
  title={The Viability of Crowdsourcing for Survey Research},
  author={Behrend, T.S. and Sharek, D.J. and Meade, A.W. and Wiebe, E.N.},
  journal={Behavior Research Methods},
  volume={43},
  number={3},
  pages={800--813},
  year={2011}
}

@article{von-gaudecker_experts_2012,
  author={von Gaudecker, H.-M. and van Soest, A. and Wengstr{\"o}m, E},
  title={Experts in Experiments},
  journal={Journal of Risk and Uncertainty},
  year={2012},
  volume={45},
  number={2},
  pages={159--190}
}

@inproceedings{yen_lab_online_skype_2013,
  title={Lab Experiment vs. Crowdsourcing: a Comparative User Study on Skype Call Quality},
  author={Yen, Y.-C. and Chu, C.-Y. and Yeh, S.-L. and Chu, H.-H. and Huang, P.},
  booktitle={Proceedings of the 9th Asian Internet Engineering Conference},
  pages={65--72},
  year={2013},
  organization={ACM}
}

@article{hauser_attentive_turkers_2016,
  title={Attentive Turkers: MTurk Participants Perform Better on Online Attention Checks Than Do Subject Pool Participants},
  author={Hauser, D.J. and Schwarz, N.},
  journal={Behavior Research Methods},
  volume={48},
  number={1},
  pages={400--407},
  year={2016}
}

@inproceedings{wang_mturk_lab_ratings_2015,
  title={Mechanica Turk-based Experiment vs Laboratory-based Experiment: A Case Study on the Comparison of Semantic Transparency Rating Data},
  author={Wang, S. and Huang, C.-R. and Yao, Y. and Chan, A.},
  booktitle={Proceedings of the 9th Pacific Asia Conference on Language, Information and Computation (PACLIC)},
  pages={53--62},
  location={Shanghai, China},
  year={2015}
}

% Games.

@inproceedings{chen_migrants_game_2014,
  title={Facilitating Social Inclusion of Migrant Workers through Digital Game Play},
  author={Chen, V.H.-H.},
  booktitle={Proceedings Annual Workshop of the AIS Special Interest Group for ICT in Global Development},
  location={New Zealand},
  year={2014}
}

% Online

@misc{GoogleBounty,
  url = {http://threatpost.com/en_us/blogs/google-fixes-10-bugs-new-chrome-release-091510},
  title = {Google Fixes 10 Bugs in New Chrome Release}
}

repository: shakty/socialbib

repo_name: shakty/socialbib


text:
@inproceedings {type-your-key-here,
  author = "Tiago Massoni and Rohit Gheyi and Paulo Borba",
  booktitle = "19th Brazilian Symposium on Software Engineering (SBES 2005)",
  title = "Formal Refactoring for UML Class Diagrams",
  year = "2005",
  pages = "152-167"
}

license: MIT

repository: pauloborba/academic-kickstart

license_type: permissive

repo_name: pauloborba/academic-kickstart

branch_name: refs/heads/master

gha_license_id: MIT

extension: bib


text:
package web

import (
	"testing"
	"github.com/cleverua/tuna-timer-api/utils"
	"github.com/cleverua/tuna-timer-api/data"
	"github.com/cleverua/tuna-timer-api/models"
	"github.com/nlopes/slack"
	"gopkg.in/mgo.v2/bson"
	"log"
	"gopkg.in/tylerb/is.v1"
	"gopkg.in/mgo.v2"
	"github.com/pavlo/gosuite"
	"net/http"
	"bytes"
	"net/http/httptest"
	"encoding/json"
	"time"
	"github.com/justinas/alice"
	"github.com/dgrijalva/jwt-go"
	"github.com/gorilla/mux"
)

func TestFrontendHandlers(t *testing.T) {
	gosuite.Run(t, &FrontendHandlersTestSuite{Is: is.New(t)})
}

func (s *FrontendHandlersTestSuite) TestAuthenticate(t *testing.T) {
	reqData := map[string]string{ "pid": "pass-for-jwt-generation" }
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(reqData)

	req, err := http.NewRequest("POST", "/api/v1/frontend/sessions", body)
	s.Nil(err)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	handler := http.HandlerFunc(h.Authenticate)
	handler.ServeHTTP(recorder, req)

	resp := JWTResponse{ResponseData: JwtToken{}}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)
	s.Nil(err)

	verificationToken, err := NewUserToken(s.user.ID.Hex(), s.session)
	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.ResponseData.Token, verificationToken)
}

func (s *FrontendHandlersTestSuite) TestAuthenticateWithWrongPid(t *testing.T) {
	reqData := map[string]string{ "pid": "gIkuvaNzQIHg97ATvDxqgjtO" }
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(reqData)

	req, err := http.NewRequest("POST", "/api/v1/frontend/session", body)
	req.Header.Set("Content-Type", "application/json")
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	handler := http.HandlerFunc(h.Authenticate)
	handler.ServeHTTP(recorder, req)

	resp := JWTResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)
	s.Nil(err)
	s.Equal(resp.ResponseStatus.UserMessage, "please login from slack application")
	s.Equal(resp.ResponseStatus.Status, "400")
	s.Equal(resp.ResponseData.Token, "")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
}

func (s *FrontendHandlersTestSuite) TestTimersData(t *testing.T)  {
	date := time.Now().Format("2006-1-2")
	url := "/api/v1/frontend/timers?startDate=" + date + "&endDate=" + date

	req, err := http.NewRequest("GET", url, nil)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.TimersData).ServeHTTP(recorder, req)

	resp := TimersResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.Equal(len(resp.ResponseData), 1)
	s.Equal(resp.ResponseData[0].ID, s.timer.ID)
}

func (s *FrontendHandlersTestSuite) TestTimersDataWithoutDateRange(t *testing.T)  {
	req, err := http.NewRequest("GET", "/api/v1/frontend/timers", nil)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.TimersData).ServeHTTP(recorder, req)

	resp := TimersResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "500")
	s.NotNil(resp.ResponseStatus.DeveloperMessage)
	s.Equal(resp.ResponseStatus.UserMessage, "")
	s.Len(resp.ResponseData, 0)
}

func (s *FrontendHandlersTestSuite) TestTimersDataWithNoExistingUser(t *testing.T)  {
	req, err := http.NewRequest("GET", "/api/v1/frontend/timers?startDate=2016-12-20&endDate=2016-12-22", nil)
	newToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
		"user_id":	 bson.NewObjectId(),
		"is_team_admin": s.user.SlackUserInfo.IsAdmin,
		"name":		 s.user.ExternalUserName,
		"image48":	 s.user.SlackUserInfo.Profile.Image48,
		"team_id":	 s.team.ID,
		"ext_team_id":	 s.team.ExternalTeamID,
		"ext_team_name": s.team.ExternalTeamName,
	})
	token, err := newToken.SignedString([]byte("TODO: Extract me in config/env"))

	req.Header.Set("Authorization", "Bearer " + token)
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.TimersData).ServeHTTP(recorder, req)

	resp := TimersResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)
	s.Nil(err)

	s.Equal(resp.ResponseStatus.Status, "400")
	s.Equal(resp.ResponseStatus.DeveloperMessage, mgo.ErrNotFound.Error())
	s.Equal(resp.ResponseStatus.UserMessage, "please login from slack application")
	s.Len(resp.ResponseData, 0)
}

func (s *FrontendHandlersTestSuite) TestProjectsData(t *testing.T)  {
	req, err := http.NewRequest("GET", "/api/v1/frontend/projects", nil)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.ProjectsData).ServeHTTP(recorder, req)

	resp := ProjectsResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.Equal(resp.ResponseData[0].ID, s.team.Projects[0].ID)
	s.Equal(resp.ResponseData[0].ExternalProjectID, s.team.Projects[0].ExternalProjectID)
	s.Equal(resp.ResponseData[0].ExternalProjectName, s.team.Projects[0].ExternalProjectName)
}

func (s *FrontendHandlersTestSuite) TestProjectsDataWithNoExistedUser(t *testing.T)  {
	req, err := http.NewRequest("GET", "/api/v1/frontend/projects", nil)
	newToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
		"user_id":	 bson.NewObjectId(),
		"is_team_admin": s.user.SlackUserInfo.IsAdmin,
		"name":		 s.user.ExternalUserName,
		"image48":	 s.user.SlackUserInfo.Profile.Image48,
		"team_id":	 s.team.ID,
		"ext_team_id":	 s.team.ExternalTeamID,
		"ext_team_name": s.team.ExternalTeamName,
	})
	token, err := newToken.SignedString([]byte("TODO: Extract me in config/env"))

	req.Header.Set("Authorization", "Bearer " + token)
	s.Nil(err)

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.ProjectsData).ServeHTTP(recorder, req)
	resp := ProjectsResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "400")
	s.Equal(resp.ResponseStatus.DeveloperMessage, mgo.ErrNotFound.Error())
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
}

func (s *FrontendHandlersTestSuite) TestCreateTimer(t *testing.T)  {
	// It should create new timer, stop active timer and return current day Timers for User
	newTimer := models.Timer{
		TaskName:   "New task name",
		TeamUserID: s.user.ID.Hex(),
		TeamID:     s.team.ID.Hex(),
		ProjectID:  bson.NewObjectId().Hex(),
		ProjectExternalID:  "external-project-id",
		ProjectExternalName: "external-project-name",
		Minutes: 30,
	}
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(newTimer)

	req, err := http.NewRequest("POST", "/api/v1/frontend/timers", body)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.CreateTimer).ServeHTTP(recorder, req)

	resp := TimersResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)

	// Check response timers data
	s.Len(resp.ResponseData, 2)

	// Check for first timer completed
	s.Equal(resp.ResponseData[0].ID, s.timer.ID)
	s.Equal(resp.ResponseData[0].Minutes, 20)
	s.NotNil(resp.ResponseData[0])

	// Check new timers data
	s.Equal(resp.ResponseData[1].TaskName, newTimer.TaskName)
	s.Equal(resp.ResponseData[1].TeamUserID, newTimer.TeamUserID)
	s.Equal(resp.ResponseData[1].ProjectID, newTimer.ProjectID)
	s.Equal(resp.ResponseData[1].ProjectExternalID, newTimer.ProjectExternalID)
	s.Equal(resp.ResponseData[1].ProjectExternalName, newTimer.ProjectExternalName)
	s.Equal(resp.ResponseData[1].Minutes, 0)
	s.Equal(resp.ResponseData[1].ActualMinutes, 0)
	s.Equal(resp.ResponseData[1].TeamID, s.user.TeamID)
}

func (s *FrontendHandlersTestSuite) TestUpdateTimer(t *testing.T)  {
	timersData := models.Timer{
		ID: s.timer.ID,
		TaskName:   "New task name",
		ProjectID:  bson.NewObjectId().Hex(),
		ProjectExternalID:  "external-project-id",
		ProjectExternalName: "external-project-name",
		Minutes: 25,
		Edits: []*models.TimeEdit{
			{TeamUserID: s.user.ID.Hex(), CreatedAt: time.Now(), Minutes: 10},
		},
	}
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(timersData)

	req, err := http.NewRequest("PUT", "/api/v1/frontend/timers", body)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.UpdateTimer).ServeHTTP(recorder, req)

	resp := TimerResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.Equal(resp.ResponseData.ID, s.timer.ID)
	s.Equal(resp.ResponseData.TaskName, timersData.TaskName)
	s.Equal(resp.ResponseData.TeamUserID, s.timer.TeamUserID)
	s.Equal(resp.ResponseData.ProjectID, timersData.ProjectID)
	s.Equal(resp.ResponseData.ProjectExternalID, timersData.ProjectExternalID)
	s.Equal(resp.ResponseData.ProjectExternalName, timersData.ProjectExternalName)
	s.Equal(resp.ResponseData.TeamID, s.user.TeamID)
	// Check calculation of timers edits
	s.NotEqual(resp.ResponseData.Minutes, 25)
	s.Equal(resp.ResponseData.Minutes, 30)
}

func (s *FrontendHandlersTestSuite) TestUpdateTimerWithNoExistingTimer(t *testing.T)  {
	timersData := models.Timer{
		ID: bson.NewObjectId(),
		TaskName:   "New task name",
		ProjectID:  bson.NewObjectId().Hex(),
		ProjectExternalID:  "external-project-id",
		ProjectExternalName: "external-project-name",
	}
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(timersData)

	req, err := http.NewRequest("PUT", "/api/v1/frontend/timers", body)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.UpdateTimer).ServeHTTP(recorder, req)

	resp := TimerResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "500")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.Equal(resp.ResponseStatus.DeveloperMessage, "update forbidden")
}

func (s *FrontendHandlersTestSuite) TestUpdateTimerStopAction(t *testing.T)  {
	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(models.Timer{})

	req, err := http.NewRequest("PUT", "/api/v1/frontend/timers?stop_timer=true", body)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.UpdateTimer).ServeHTTP(recorder, req)

	resp := TimerResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.Equal(resp.ResponseData.ID, s.timer.ID)
	s.Equal(resp.ResponseData.Minutes, 20)
	s.NotNil(resp.ResponseData.FinishedAt)
}

func (s *FrontendHandlersTestSuite) TestUpdateTimerStopAlreadyStoppedTimer(t *testing.T)  {
	timerService := data.NewTimerService(s.session)
	err := timerService.StopTimer(s.timer)
	s.Nil(err)

	body := new(bytes.Buffer)
	json.NewEncoder(body).Encode(models.Timer{})

	req, err := http.NewRequest("PUT", "/api/v1/frontend/timers?stop_timer=true", body)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.UpdateTimer).ServeHTTP(recorder, req)

	resp := TimerResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "400")
	s.Equal(resp.ResponseStatus.DeveloperMessage, mgo.ErrNotFound.Error())
	s.Equal(resp.ResponseStatus.UserMessage, "already stopped")
}

func (s *FrontendHandlersTestSuite) TestDeleteTimer(t *testing.T) {
	router := mux.NewRouter()
	h := NewFrontendHandlers(s.env, s.session)
	router.Handle("/api/v1/frontend/timers/{id}", s.middlewareChain.ThenFunc(h.DeleteTimer)).Methods("DELETE")
	ts := httptest.NewServer(router)
	defer ts.Close()

	req, _ := http.NewRequest("DELETE", ts.URL + "/api/v1/frontend/timers/" + s.timer.ID.Hex(), nil)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	s.Nil(err)

	respBody := ResponseBody{}
	err = json.NewDecoder(resp.Body).Decode(&respBody)
	s.Nil(err)
	s.Equal(respBody.ResponseStatus.Status, "200")
	s.Zero(respBody.ResponseStatus.DeveloperMessage)
	s.Equal(respBody.ResponseStatus.UserMessage, "successfully deleted")

	// Test with not existing timer id
	req, _ = http.NewRequest("DELETE", ts.URL + "/api/v1/frontend/timers/" + bson.NewObjectId().Hex(), nil)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	resp, err = http.DefaultClient.Do(req)
	s.Nil(err)

	respBody = ResponseBody{}
	err = json.NewDecoder(resp.Body).Decode(&respBody)
	s.Nil(err)
	s.Equal(respBody.ResponseStatus.Status, "500")
	s.Equal(respBody.ResponseStatus.DeveloperMessage, "not found")
	s.Zero(respBody.ResponseStatus.UserMessage)
}

func (s *FrontendHandlersTestSuite) TestDeleteTimerWithForeignUser(t *testing.T) {
	router := mux.NewRouter()
	h := NewFrontendHandlers(s.env, s.session)
	router.Handle("/api/v1/frontend/timers/{id}", s.middlewareChain.ThenFunc(h.DeleteTimer)).Methods("DELETE")
	ts := httptest.NewServer(router)
	defer ts.Close()

	userRepository := data.NewUserRepository(s.session)
	user := &models.TeamUser{
		TeamID:           s.team.ID.Hex(),
		ExternalUserID:   "user-id",
		ExternalUserName: "name",
		SlackUserInfo:    &slack.User{
			IsAdmin:  false,
		},
	}

	_, err := userRepository.Save(user)
	s.Nil(err)

	userJwt, err := NewUserToken(user.ID.Hex(), s.session)
	s.Nil(err)

	req, _ := http.NewRequest("DELETE", ts.URL + "/api/v1/frontend/timers/" + s.timer.ID.Hex(), nil)
	req.Header.Set("Authorization", "Bearer " + userJwt)
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	s.Nil(err)

	respBody := ResponseBody{}
	err = json.NewDecoder(resp.Body).Decode(&respBody)
	s.Nil(err)
	s.Equal(respBody.ResponseStatus.Status, "500")
	s.Equal(respBody.ResponseStatus.DeveloperMessage, "delete forbidden")
	s.Zero(respBody.ResponseStatus.UserMessage)
}

func (s *FrontendHandlersTestSuite) TestMonthStatistic(t *testing.T)  {
	startDate := utils.PT("2016 Dec 01 00:00:00")
	finished := startDate.Add(time.Minute * 30)
	timerRepository := data.NewTimerRepository(s.session)
	timerRepository.CreateTimer(&models.Timer{
		ID:			bson.NewObjectId(),
		TeamID:			"team",
		ProjectID:		"project",
		ProjectExternalName:	"project_name",
		TeamUserID:		s.user.ID.Hex(),
		CreatedAt:		startDate.Add(time.Hour * 1),
		Minutes:		30,
		FinishedAt:		&finished,
	})

	req, err := http.NewRequest("GET", "/api/v1/frontend/month_statistics?date=2016-12-1", nil)
	s.Nil(err)
	req.Header.Set("Authorization", "Bearer " + s.userJwt)
	req.Header.Set("Content-Type", "application/json")

	h := NewFrontendHandlers(s.env, s.session)
	recorder := httptest.NewRecorder()
	s.middlewareChain.ThenFunc(h.MonthStatistics).ServeHTTP(recorder, req)

	resp := UserStatisticsResponse{}
	err = json.Unmarshal(recorder.Body.Bytes(), &resp)

	s.Nil(err)
	s.Equal(resp.ResponseStatus.Status, "200")
	s.Equal(resp.AppInfo["env"], utils.TestEnv)
	s.Equal(resp.AppInfo["version"], s.env.AppVersion)
	s.NotNil(resp.ResponseData[0])
	s.Equal(resp.ResponseData[0].Day, 1)
	s.Equal(resp.ResponseData[0].Minutes, 30)
	s.Equal(resp.ResponseData[0].ProjectsNames[0], "project_name")
	s.Len(resp.ResponseData, 1)
}

// =================== TEST setup =================== //
type FrontendHandlersTestSuite struct {
	*is.Is
	env     *utils.Environment
	session *mgo.Session
	user    *models.TeamUser
	pass    *models.Pass
	team    *models.Team
	timer 	*models.Timer
	userJwt string
	secureCTX *SecureContext
	middlewareChain alice.Chain
}

func (s *FrontendHandlersTestSuite) SetUpSuite() {
	e := utils.NewEnvironment(utils.TestEnv, "1.0.0")

	session, err := utils.ConnectToDatabase(e.Config)
	if err != nil {
		log.Fatal("Failed to connect to DB!")
	}

	s.session = session.Clone()
	e.MigrateDatabase(session)
	s.env = e

	s.secureCTX = &SecureContext{
		Origin:  s.env.Config.UString("origin.url"),
		Session: s.session,
		Env: 	 s.env,
	}
	s.middlewareChain = alice.New(
		s.secureCTX.CorsMiddleware,
		JWTMiddleware,
		s.secureCTX.CurrentUserMiddleware)
}

func (s *FrontendHandlersTestSuite) TearDownSuite() {
	s.session.Close()
}

func (s *FrontendHandlersTestSuite) SetUp() {
	//Clear Database
	utils.TruncateTables(s.session)

	//Seed Database
	passRepository := data.NewPassRepository(s.session)
	userRepository := data.NewUserRepository(s.session)
	teamRepository := data.NewTeamRepository(s.session)
	timerRepository := data.NewTimerRepository(s.session)
	var err error

	//Create team with project
	s.team, err = teamRepository.CreateTeam("ExtTeamID", "ExtTeamName")
	s.Nil(err)
	err = teamRepository.AddProject(s.team, "external-project-id", "external-project-name")
	s.Nil(err)
	s.team, _ = teamRepository.FindByID(s.team.ID.Hex())

	//Create user
	s.user = &models.TeamUser{
		TeamID:           s.team.ID.Hex(),
		ExternalUserID:   "ext-user-id",
		ExternalUserName: "user-name",
		SlackUserInfo:    &slack.User{
			IsAdmin: true,
		},
	}
	_, err = userRepository.Save(s.user)
	s.Nil(err)

	//Create pass
	s.pass = &models.Pass{
		ID:           bson.NewObjectId(),
		Token:        "pass-for-jwt-generation",
		TeamUserID:   s.user.ID.Hex(),
		CreatedAt:    time.Now(),
		ExpiresAt:    time.Now().Add(5 * time.Minute),
	}
	err = passRepository.Insert(s.pass)
	s.Nil(err)

	//Create timer
	s.timer, err = timerRepository.CreateTimer(
		&models.Timer{
			ID:         	bson.NewObjectId(),
			TeamID:     	s.team.ID.Hex(),
			ProjectID:  	"project",
			TeamUserID: 	s.user.ID.Hex(),
			CreatedAt:  	time.Now().Add(-20 * time.Minute),
			Minutes:    	20,
			ActualMinutes:  20,
	})
	s.Nil(err)

	//Generate user JWT
	s.userJwt, err = NewUserToken(s.user.ID.Hex(), s.session)
	s.Nil(err)
}

func (s *FrontendHandlersTestSuite) TearDown() {}

repository: cleverua/tuna-timer-api

repo_name: cleverua/tuna-timer-api

branch_name: refs/heads/develop

gha_language: Go

extension: go


text:
@Article{law2017testing,
  title = {Testing and learning on distributions with symmetric noise invariance},
  author = {Ho Chung Law and Christopher Yau and Dino Sejdinovic},
  journal = {Advances in Neural Information Processing Systems},
  volume = {30},
  year = {2017},
  date = {2017-01-01},
}


text:
package lib

// Input is the interface for the Input plugins
type Input interface {
	Put(m Msg) error
	Delete(m Msg) error
	Exit()
}

// Output is the interface for the Output plugins
type Output interface {
	MatchConditions(a Msg) error
	Run(rl ReactorLog, a Msg) error
	Exit()
}

repository: jordimasv/goreactor

repo_name: jordimasv/goreactor


text:
package linux_backend

import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path"
	"sync"
	"time"

	"github.com/cloudfoundry-incubator/garden"
	"github.com/cloudfoundry-incubator/garden-linux/old/system_info"
	"github.com/pivotal-golang/lager"
)

type Container interface {
	ID() string
	Properties() garden.Properties
	GraceTime() time.Duration

	Start() error

	Snapshot(io.Writer) error
	Cleanup()

	garden.Container
}

type ContainerPool interface {
	Setup() error
	Create(garden.ContainerSpec) (Container, error)
	Restore(io.Reader) (Container, error)
	Destroy(Container) error
	Prune(keep map[string]bool) error
	MaxContainers() int
}

type LinuxBackend struct {
	logger lager.Logger

	containerPool ContainerPool
	systemInfo    system_info.Provider
	snapshotsPath string

	containers      map[string]Container
	containersMutex *sync.RWMutex
}

type HandleExistsError struct {
	Handle string
}

func (e HandleExistsError) Error() string {
	return fmt.Sprintf("handle already exists: %s", e.Handle)
}

type FailedToSnapshotError struct {
	OriginalError error
}

func (e FailedToSnapshotError) Error() string {
	return fmt.Sprintf("failed to save snapshot: %s", e.OriginalError)
}

func New(logger lager.Logger, containerPool ContainerPool, systemInfo system_info.Provider, snapshotsPath string) *LinuxBackend {
	return &LinuxBackend{
		logger: logger.Session("backend"),

		containerPool: containerPool,
		systemInfo:    systemInfo,
		snapshotsPath: snapshotsPath,

		containers:      make(map[string]Container),
		containersMutex: new(sync.RWMutex),
	}
}

func (b *LinuxBackend) Setup() error {
	return b.containerPool.Setup()
}

func (b *LinuxBackend) Start() error {
	if b.snapshotsPath != "" {
		_, err := os.Stat(b.snapshotsPath)
		if err == nil {
			b.restoreSnapshots()
			os.RemoveAll(b.snapshotsPath)
		}

		err = os.MkdirAll(b.snapshotsPath, 0755)
		if err != nil {
			return err
		}
	}

	keep := map[string]bool{}

	b.containersMutex.RLock()
	containers := b.containers
	b.containersMutex.RUnlock()

	for _, container := range containers {
		keep[container.ID()] = true
	}

	return b.containerPool.Prune(keep)
}

func (b *LinuxBackend) Ping() error {
	return nil
}

func (b *LinuxBackend) Capacity() (garden.Capacity, error) {
	totalMemory, err := b.systemInfo.TotalMemory()
	if err != nil {
		return garden.Capacity{}, err
	}

	totalDisk, err := b.systemInfo.TotalDisk()
	if err != nil {
		return garden.Capacity{}, err
	}

	return garden.Capacity{
		MemoryInBytes: totalMemory,
		DiskInBytes:   totalDisk,
		MaxContainers: uint64(b.containerPool.MaxContainers()),
	}, nil
}

func (b *LinuxBackend) Create(spec garden.ContainerSpec) (garden.Container, error) {
	if spec.Handle != "" {
		b.containersMutex.RLock()
		_, exists := b.containers[spec.Handle]
		b.containersMutex.RUnlock()

		if exists {
			return nil, HandleExistsError{Handle: spec.Handle}
		}
	}

	container, err := b.containerPool.Create(spec)
	if err != nil {
		return nil, err
	}

	err = container.Start()
	if err != nil {
		return nil, err
	}

	b.containersMutex.Lock()
	b.containers[container.Handle()] = container
	b.containersMutex.Unlock()

	return container, nil
}

func (b *LinuxBackend) Destroy(handle string) error {
	b.containersMutex.RLock()
	container, found := b.containers[handle]
	b.containersMutex.RUnlock()

	if !found {
		return garden.ContainerNotFoundError{handle}
	}

	err := b.containerPool.Destroy(container)
	if err != nil {
		return err
	}

	b.containersMutex.Lock()
	delete(b.containers, container.Handle())
	b.containersMutex.Unlock()

	return nil
}

func (b *LinuxBackend) Containers(filter garden.Properties) (containers []garden.Container, err error) {
	b.containersMutex.RLock()
	defer b.containersMutex.RUnlock()

	for _, container := range b.containers {
		if containerHasProperties(container, filter) {
			containers = append(containers, container)
		}
	}

	return containers, nil
}

func (b *LinuxBackend) Lookup(handle string) (garden.Container, error) {
	b.containersMutex.RLock()
	defer b.containersMutex.RUnlock()

	container, found := b.containers[handle]
	if !found {
		return nil, garden.ContainerNotFoundError{handle}
	}

	return container, nil
}

func (b *LinuxBackend) GraceTime(container garden.Container) time.Duration {
	return container.(Container).GraceTime()
}

func (b *LinuxBackend) Stop() {
	b.containersMutex.RLock()
	defer b.containersMutex.RUnlock()

	for _, container := range b.containers {
		container.Cleanup()
		err := b.saveSnapshot(container)
		if err != nil {
			b.logger.Error("failed-to-save-snapshot", err, lager.Data{
				"container": container.ID(),
			})
		}
	}
}

func (b *LinuxBackend) restoreSnapshots() {
	sLog := b.logger.Session("restore")

	entries, err := ioutil.ReadDir(b.snapshotsPath)
	if err != nil {
		b.logger.Error("failed-to-read-snapshots", err, lager.Data{
			"from": b.snapshotsPath,
		})
	}

	for _, entry := range entries {
		snapshot := path.Join(b.snapshotsPath, entry.Name())

		lLog := sLog.Session("load", lager.Data{
			"snapshot": entry.Name(),
		})

		lLog.Debug("loading")

		file, err := os.Open(snapshot)
		if err != nil {
			lLog.Error("failed-to-open", err)
		}

		_, err = b.restore(file)
		if err != nil {
			lLog.Error("failed-to-restore", err)
		}
	}
}

func (b *LinuxBackend) saveSnapshot(container Container) error {
	if b.snapshotsPath == "" {
		return nil
	}

	b.logger.Info("save-snapshot", lager.Data{
		"container": container.ID(),
	})

	snapshotPath := path.Join(b.snapshotsPath, container.ID())

	snapshot, err := os.Create(snapshotPath)
	if err != nil {
		return &FailedToSnapshotError{err}
	}

	err = container.Snapshot(snapshot)
	if err != nil {
		return &FailedToSnapshotError{err}
	}

	return snapshot.Close()
}

func (b *LinuxBackend) restore(snapshot io.Reader) (garden.Container, error) {
	container, err := b.containerPool.Restore(snapshot)
	if err != nil {
		return nil, err
	}

	b.containersMutex.Lock()
	b.containers[container.Handle()] = container
	b.containersMutex.Unlock()

	return container, nil
}

func containerHasProperties(container Container, properties garden.Properties) bool {
	containerProps := container.Properties()

	for key, val := range properties {
		cval, ok := containerProps[key]
		if !ok {
			return false
		}

		if cval != val {
			return false
		}
	}

	return true
}

repository: jfuerth/garden-linux

repo_name: jfuerth/garden-linux


text:
@Manual{r,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2020},
    url = {https://www.R-project.org/},
  }

We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also ‘citation("pkgname")’ for
citing R packages.

@article{milligan2008evolution,
  title={The evolution of elderly poverty in Canada},
  author={Milligan, Kevin},
  journal={Canadian Public Policy},
  volume={34},
  number={4},
  pages={S79--S94},
  year={2008},
  publisher={University of Toronto Press}
}

  @Article{tidyverse,
    title = {Welcome to the {tidyverse}},
    author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
    year = {2019},
    journal = {Journal of Open Source Software},
    volume = {4},
    number = {43},
    pages = {1686},
    doi = {10.21105/joss.01686},
  }


text:
# Author:  Johannes de Fine Licht (definelicht@inf.ethz.ch)
# Created: February 2019
# This software is copyrighted under the BSD 3-Clause License.
#
# Once done this will define:
#   IntelFPGAOpenCL_FOUND - Indicates whether Intel FPGA OpenCL was found.
#   IntelFPGAOpenCL_INCLUDE_DIRS - Include directories for HLS.
#   IntelFPGAOpenCL_LIBRARIES - Runtime libraries required for host side code.
#   IntelFPGAOpenCL_RPATH - rpath required for runtime linkage
#   IntelFPGAOpenCL_AOC - Path to the aoc executable.
#   IntelFPGAOpenCL_AOCL - Path to the aocl executable.
#   IntelFPGAOpenCL_VERSION - Version of Intel FPGA OpenCL installation
#   IntelFPGAOpenCL_VERSION_MAJOR - Major version of Intel FPGA OpenCL installation
#   IntelFPGAOpenCL_VERSION_MINOR - Minor version of Intel FPGA OpenCL installation
#
# To specify the location of Intel FPGA OpenCL, or to force this script to use a
# specific version, set the variable INTELFPGAOCL_ROOT_DIR to the root
# directory of the desired Intel FPGA OpenCL installation.

if(NOT DEFINED INTELFPGAOCL_ROOT_DIR)

  find_path(INTELFPGAOCL_SEARCH_PATH aocl
            PATHS ENV INTELFPGAOCLSDKROOT
						PATH_SUFFIXES bin)
  get_filename_component(INTELFPGAOCL_ROOT_DIR ${INTELFPGAOCL_SEARCH_PATH} DIRECTORY)
  mark_as_advanced(INTELFPGAOCL_SEARCH_PATH)

else()

  message(STATUS "Using user defined Intel FPGA OpenCL directory: ${INTELFPGAOCL_ROOT_DIR}")

endif()

# Check if all the necessary components are present. We want to ensure that we
# use the tools bundled together, so we don't use find_path again.

find_program(IntelFPGAOpenCL_AOC aoc PATHS ${INTELFPGAOCL_ROOT_DIR}/bin NO_DEFAULT_PATH)

get_filename_component(INTELFPGA_ROOT_DIR "${INTELFPGAOCL_ROOT_DIR}" DIRECTORY)
mark_as_advanced(INTELFPGA_ROOT_DIR)

# Get version number string
get_filename_component(IntelFPGAOpenCL_VERSION "${INTELFPGA_ROOT_DIR}" NAME)
string(REGEX REPLACE "([0-9]+)\\.[0-9\\.]+" "\\1" IntelFPGAOpenCL_MAJOR_VERSION "${IntelFPGAOpenCL_VERSION}")
string(REGEX REPLACE "[0-9]+\\.([0-9\\.]+)" "\\1" IntelFPGAOpenCL_MINOR_VERSION "${IntelFPGAOpenCL_VERSION}")
set(IntelFPGAOpenCL_VERSION ${IntelFPGAOpenCL_VERSION} CACHE STRING "Intel FPGA OpenCL version.")
set(IntelFPGAOpenCL_MAJOR_VERSION ${IntelFPGAOpenCL_MAJOR_VERSION} CACHE STRING "Intel FPGA OpenCL major version.")
set(IntelFPGAOpenCL_MINOR_VERSION ${IntelFPGAOpenCL_MINOR_VERSION} CACHE STRING "Intel FPGA OpenCL minor version.")

find_program(IntelFPGAOpenCL_AOC aoc
             PATHS ${INTELFPGAOCL_ROOT_DIR}/bin NO_DEFAULT_PATH)

find_program(IntelFPGAOpenCL_AOCL aocl
             PATHS ${INTELFPGAOCL_ROOT_DIR}/bin NO_DEFAULT_PATH)

# Extract include directory from aocl compile-config command
execute_process(COMMAND ${IntelFPGAOpenCL_AOCL} compile-config OUTPUT_VARIABLE IntelFPGAOpenCL_INCLUDE_DIRS)
string(REGEX MATCHALL "-I[^ \t]+" IntelFPGAOpenCL_INCLUDE_DIRS "${IntelFPGAOpenCL_INCLUDE_DIRS}")
string(REPLACE "-I" "" IntelFPGAOpenCL_INCLUDE_DIRS "${IntelFPGAOpenCL_INCLUDE_DIRS}")
set(IntelFPGAOpenCL_INCLUDE_DIRS ${IntelFPGAOpenCL_INCLUDE_DIRS} CACHE STRING
    "Intel FPGA OpenCL host code include directories.")

# Extract libraries from aocl link-config command
execute_process(COMMAND ${IntelFPGAOpenCL_AOCL} link-config OUTPUT_VARIABLE INTELFPGAOCL_LINK_FLAGS)
string(REGEX MATCHALL "-L[^ \t\n]+" INTELFPGAOCL_LINK_DIRS "${INTELFPGAOCL_LINK_FLAGS}")
string(REPLACE "-L" "" INTELFPGAOCL_LINK_DIRS "${INTELFPGAOCL_LINK_DIRS}")
string(REGEX MATCHALL "-l[^ \t\n]+" INTELFPGAOCL_LINK_LIBS "${INTELFPGAOCL_LINK_FLAGS}")
string(REPLACE "-l" "" INTELFPGAOCL_LINK_LIBS "${INTELFPGAOCL_LINK_LIBS}")
mark_as_advanced(INTELFPGAOCL_LINK_DIRS INTELFPGAOCL_LINK_LIBS)

# Use find_library with hardcoded paths from aocl link-config
set(IntelFPGAOpenCL_LIBRARIES)
foreach(INTELFPGAOCL_LIB ${INTELFPGAOCL_LINK_LIBS})
  find_library(${INTELFPGAOCL_LIB}_PATH ${INTELFPGAOCL_LIB}
               PATHS ${INTELFPGAOCL_LINK_DIRS} NO_DEFAULT_PATH)
  set(IntelFPGAOpenCL_LIBRARIES ${IntelFPGAOpenCL_LIBRARIES} ${${INTELFPGAOCL_LIB}_PATH})
  mark_as_advanced(${INTELFPGAOCL_LIB}_PATH)
endforeach()
set(IntelFPGAOpenCL_LIBRARIES ${IntelFPGAOpenCL_LIBRARIES} CACHE STRING
    "Intel FPGA OpenCL host code libraries.")

string(REPLACE " " ":" IntelFPGAOpenCL_RPATH "${INTELFPGAOCL_LINK_DIRS}")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH
    "${CMAKE_INSTALL_RPATH}:${INTELFPGAOCL_LINK_DIRS}")
set(IntelFPGAOpenCL_RPATH ${IntelFPGAOpenCL_RPATH} CACHE STRING
    "Intel FPGA OpenCL rpath necessary at runtime to launch OpenCL kernels.")

set(IntelFPGAOpenCL_EXPORTS
    IntelFPGAOpenCL_AOCL
    IntelFPGAOpenCL_AOC
    IntelFPGAOpenCL_INCLUDE_DIRS
    IntelFPGAOpenCL_LIBRARIES
    IntelFPGAOpenCL_RPATH
    IntelFPGAOpenCL_VERSION
    IntelFPGAOpenCL_MAJOR_VERSION
    IntelFPGAOpenCL_MINOR_VERSION)
mark_as_advanced(IntelFPGAOpenCL_EXPORTS)

include(FindPackageHandleStandardArgs)
# Handle the QUIETLY and REQUIRED arguments and set IntelFPGAOpenCLHLS_FOUND to
# TRUE if all listed variables were found.
find_package_handle_standard_args(IntelFPGAOpenCL DEFAULT_MSG ${IntelFPGAOpenCL_EXPORTS})

repository: definelicht/hlslib

repo_name: definelicht/hlslib

extension: cmake


text:
@string{ieeetoc = "IEEE Transactions on Computers"}

@article{Meyer80Performability,
title={On Evaluating the Performability of Degradable Computing Systems},
author={Meyer, John F.},
journal=ieeetoc,
year={1980},
month={August},
volume={C-29},
number={8},
pages={720--731},
}

@ARTICLE{barton:fiat:ieee-toc1990,
title="Fault injection experiments using {FIAT}",
author={James H. Barton and Edward W. Czeck and Zary Z. Segall and Daniel P. Siewiorek},
journal=ieeetoc,
year={1990},
month={Apr},
volume={39},
number={4},
pages={575--582},
}

@article{satyanarayanan:coda:ieeetoc1990,
 author = {Satyanarayanan, Mahadev and Kistler, James J. and Kumar, Puneet and Okasaki, Maria E. and Siegel, Ellen H. and Steere, David C.},
 title = {Coda: A Highly Available File System for a Distributed Workstation Environment},
 journal = ieeetoc,
 volume = {39},
 number = {4},
 year = {1990},
 issn = {0018-9340},
 pages = {447--459},
 doi = {http://dx.doi.org/10.1109/12.54838},
 publisher = {IEEE Computer Society},
 address = {Washington, DC, USA},
 abstract = {The design and implementation of Coda, a file system for a large-scale distributed computing environment composed of Unix workstations, is described. It provides resiliency to server and network failures through the use of two distinct but complementary mechanisms. One mechanism, server replication, stores copies of a file at multiple servers. The other mechanism, disconnected operation, is a mode of execution in which a caching site temporarily assumes the role of a replication site. The design of Coda optimizes for availability and performance and strives to provide the highest degree of consistency attainable in the light of these objectives. Measurements from a prototype show that the performance cost of providing high availability in Coda is reasonable.}
 }

repository: dataseries/Lintel

repo_name: dataseries/Lintel

gha_license_id: NOASSERTION

gha_language: Perl


text:
package main

import (
	ch "cryptohelpers"
	"encoding/hex"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

func main() {
	filename := "4.txt"

	file, err := os.Open(filename)
	if err != nil {
		fmt.Println("Error opening file", filename)
		return
	}

	ciphers, err := ioutil.ReadAll(file)

	cipherList := strings.Split(string(ciphers), "\n")
	byteList := make([][]byte, len(cipherList), len(cipherList))

	for i := 0; i < len(cipherList); i++ {
		byteList[i], err = hex.DecodeString(cipherList[i])
		if err != nil {
			fmt.Println("Error decoding hex string")
			return
		}
	}

	probList := make([]int, len(byteList), len(byteList))
	probByteList := make([]byte, len(byteList), len(byteList))

	for i := 0; i < len(cipherList); i++ {
		probList[i], probByteList[i], _ = ch.ProbIsEncrypted(byteList[i])
	}

	max := 0
	maxIndex := 0
	maxByte := byte(0)
	for i := 0; i < len(probList); i++ {
		if probList[i] > max {
			maxIndex = i
			max = probList[i]
			maxByte = probByteList[i]
		}
	}

	ch.ByteXor(byteList[maxIndex], maxByte)

	fmt.Println("The string that was encrypted was string", maxIndex)
	fmt.Println("The message was:")
	fmt.Println(string(byteList[maxIndex]))
}

repository: AnthonyFH/cryptopals-gosolution

repo_name: AnthonyFH/cryptopals-gosolution


text:
#
# Copyright (c) 2015 Nikolay Zapolnov (zapolnov@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

if(NOT __Z_FIND_QT5_CMAKE_INCLUDED)
    set(__Z_FIND_QT5_CMAKE_INCLUDED TRUE)

    set(Z_QT5_FOUND NO)

    find_package(Qt5Widgets)
    if(Qt5Widgets_FOUND)
        find_package(Qt5Core)
        find_package(Qt5Gui)
        find_package(Qt5Network)
        find_package(Qt5Multimedia)
        find_package(Qt5OpenGL)
        if(Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Network_FOUND AND Qt5Multimedia_FOUND AND Qt5OpenGL_FOUND)
            set(Z_QT5_FOUND YES)
        endif()
    endif()

    macro(z_target_link_qt5 target)
        if(Z_QT5_FOUND)
            target_link_libraries("${target}" Qt5::Core Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL)
            if(MSVC)
                target_compile_options("${target}" PRIVATE /wd4458)
            endif()
        endif()
    endmacro()

    macro(z_qt5_sources)
        if(NOT Z_TARGET_QT5)
            set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE)
        endif()
    endmacro()

endif()

repository: zapolnov/libraries

repo_name: zapolnov/libraries


text:
package invasion

import (
	"fmt"
	"math/rand"
	"time"
)

// NewCity creates a new city with roads to other cities in the map
func (m *Map) NewCity(name string, cities []string) *City {
	return &City{
		Name:  name,
		Roads: m.NewRoads(name, cities),
	}
}

func (m *Map) NewCityBytes(name string, cities [][]byte) *City {
	return &City{
		Name:  name,
		Roads: m.NewRoadsBytes(name, cities),
	}
}

// City represents a city with roads going out of it
type City struct {
	Name  string
	Roads []*Road
}

// RandRoad returns a random road from a city
func (c *City) RandRoad() *Road {
	r := rand.New(rand.NewSource(time.Now().Unix()))
	return c.Roads[r.Intn(len(c.Roads))]
}

// RemoveRoadTo removes a road to a named city from a calling city
func (c *City) RemoveRoadTo(city string) {
	roads := make([]*Road, 0)
	for _, r := range c.Roads {
		if r.City != city {
			roads = append(roads, r)
		}
	}
	c.Roads = roads
}

func (c *City) String() string {
	out := c.Name
	if len(c.Roads) > 0 {
		for _, r := range c.Roads {
			out += fmt.Sprintf(" %s", r.String())
		}
	}
	out += "\n"
	return out
}

// Bytes returns the byte representation of the city
func (c *City) Bytes() []byte {
	return []byte(c.String())
}

repository: tnachen/invasion

repo_name: tnachen/invasion


text:
package mailbox

import (
	"sync"
	"testing"
)

var (
	testVal *uint16

	testBufSize = 128
	testSet     = getList(8192)
	testBatch   = getList(512)
)

func TestMailbox(t *testing.T) {
	var wg sync.WaitGroup
	var cnt int
	wg.Add(2)
	mb := New(testBufSize)

	go func() {
		mb.Listen(func(item *uint16) (end bool) {
			testVal = item
			cnt++
			return
		})

		wg.Done()
	}()

	go func() {
		for _, si := range testSet {
			mb.Send(si)
		}
		mb.Close()
		wg.Done()
	}()

	wg.Wait()
	if cnt != len(testSet) {
		t.Fatal("Errr cnt", cnt)
	}
}

func BenchmarkMailbox(b *testing.B) {
	var rwg sync.WaitGroup
	mb := New(testBufSize)
	rwg.Add(1)

	go func() {
		mb.Listen(func(item *uint16) (end bool) {
			testVal = item
			return
		})
		rwg.Done()
	}()

	b.RunParallel(func(pb *testing.PB) {
		var i *uint16
		for pb.Next() {
			mb.Send(i)
		}
	})

	mb.Close()
	rwg.Wait()

	b.ReportAllocs()
}

func BenchmarkChannel(b *testing.B) {
	var rwg sync.WaitGroup
	ch := make(chan *uint16, testBufSize)
	rwg.Add(1)

	go func() {
		for item := range ch {
			testVal = item
		}

		rwg.Done()
	}()

	b.RunParallel(func(pb *testing.PB) {
		var i *uint16
		for pb.Next() {
			ch <- i
		}
	})

	close(ch)
	rwg.Wait()

	b.ReportAllocs()
}

func BenchmarkBatchMailbox(b *testing.B) {
	var rwg sync.WaitGroup
	mb := New(testBufSize)
	rwg.Add(1)

	go func() {
		mb.Listen(func(item *uint16) (end bool) {
			testVal = item
			return
		})
		rwg.Done()
	}()

	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			mb.Batch(testBatch...)
		}
	})

	mb.Close()
	rwg.Wait()

	b.ReportAllocs()
}

func BenchmarkBatchChannel(b *testing.B) {
	var rwg sync.WaitGroup
	ch := make(chan *uint16, testBufSize)
	rwg.Add(1)

	go func() {
		for item := range ch {
			testVal = item
		}

		rwg.Done()
	}()

	b.RunParallel(func(pb *testing.PB) {
		for pb.Next() {
			for _, i := range testBatch {
				ch <- i
			}
		}
	})

	close(ch)
	rwg.Wait()

	b.ReportAllocs()
}

func getList(n int) (l []*uint16) {
	l = make([]*uint16, n)
	for i := range l {
		l[i] = empty
	}

	return
}

repository: itsmontoya/mailbox

repo_name: itsmontoya/mailbox


text:
SUMMARY = "Netplan Wifi configuration"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://wifi.yaml"

S = "${WORKDIR}"

do_configure[noexec] = "1"
do_compile[noexec] = "1"

do_install() {
	install -d ${D}${sysconfdir}/netplan/
	install -m 0644 ${S}/wifi.yaml ${D}${sysconfdir}/netplan/wifi.yaml
}

FILES_${PN} = "${sysconfdir}/netplan"

repository: diegorondini/meta-mediaserver

repo_name: diegorondini/meta-mediaserver

extension: bb


text:
package azure

import (
	"context"
	"fmt"
	"net/url"
	"time"

	"github.com/Azure/azure-sdk-for-go/services/preview/subscription/mgmt/2018-03-01-preview/subscription"
	"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources"
	"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
	"github.com/Azure/azure-storage-blob-go/azblob"
)

var (
	blobFormatString = `https://%s.blob.core.windows.net`
)

// StorageAccountContainerWalker in an interface that is to be implemented by struct you want
// to pass to Walking functions like WalkStorageAccount().
type StorageAccountContainerWalker interface {
	// Lock prevents concurrent process to WalkBlob().
	Lock()
	// Unlock releases the lock.
	Unlock()
	// WalkBlob is called for all blobs listed by the Walking function.
	WalkBlob(*subscription.Model, *resources.Group, *storage.Account, *storage.ListContainerItem, *azblob.BlobItemInternal)
}

// WalkStorageAccountContainer applies a function on all storage account container blobs.
func WalkStorageAccountContainer(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *storage.Account, container *storage.ListContainerItem, walker StorageAccountContainerWalker) error {
	token, err := GetStorageToken(ctx)

	if err != nil {
		return err
	}

	details, _ := ParseResourceID(*account.ID)
	group, err := GetResourceGroup(ctx, clients, subscription, details.ResourceGroup)

	if err != nil {
		return err
	}

	// ADAL credentials
	accessToken := token.Token().AccessToken
	credential := azblob.NewTokenCredential(accessToken, nil)

	// Preparing browsing container.
	pipeline := azblob.NewPipeline(credential, azblob.PipelineOptions{})
	url, _ := url.Parse(fmt.Sprintf(blobFormatString, *account.Name))
	serviceURL := azblob.NewServiceURL(*url, pipeline)
	containerURL := serviceURL.NewContainerURL(*container.Name)

	marker := azblob.Marker{}
	listOptions := azblob.ListBlobsSegmentOptions{
		Details: azblob.BlobListingDetails{
			Snapshots: true,
		},
	}

	for i := 0; ; i++ {
		t0 := time.Now()
		list, err := containerURL.ListBlobsFlatSegment(ctx, marker, listOptions)
		t1 := time.Since(t0).Seconds()

		if err != nil {
			if ctx.Err() != context.Canceled {
				ObserveAzureAPICallFailed(t1)
				ObserveAzureStorageAPICallFailed(t1, *subscription.DisplayName, *group.Name, *account.Name)
			}
			return err
		}

		ObserveAzureAPICall(t1)
		ObserveAzureStorageAPICall(t1, *subscription.DisplayName, *group.Name, *account.Name)

		// Update request marker.
		marker = list.NextMarker

		walker.Lock()
		for _, blob := range list.Segment.BlobItems {
			walker.WalkBlob(subscription, group, account, container, &blob)
		}
		walker.Unlock()

		// Continue iterating if we are not done.
		if !marker.NotDone() {
			break
		}
	}

	if err != nil {
		return err
	}

	return nil
}

repository: sylr/prometheus-azure-exporter

repo_name: sylr/prometheus-azure-exporter


text:
package templates

import (
	"fmt"
	"strings"

	"github.com/eqlabs/flow-wallet-api/flow_helpers"
	"github.com/onflow/flow-go-sdk"
)

type Service struct {
	store Store
	cfg   *config
}

func NewService(store Store) *Service {
	cfg := parseConfig()

	// Add all enabled tokens from config as fungible tokens
	for _, t := range cfg.enabledTokens {
		if _, err := store.GetByName(t.Name); err == nil {
			// Token already in database
			fmt.Printf("Warning: Skipping %s configuration from environment variables as it already exists in database. ", t.Name)
			fmt.Printf("Consider removing it from database or from environment variables.\n")
			continue
		} else {
			if !strings.Contains(err.Error(), "record not found") {
				// We got an error that is not "record not found"
				panic(err)
			}
		}

		// Copy the value so we get an individual pointer, this is important
		token := t
		token.Type = FT // We only allow fungible tokens through env variables config
		token.Setup = FungibleSetupCode(&token)
		token.Transfer = FungibleTransferCode(&token)
		token.Balance = FungibleBalanceCode(&token)

		// Write to temp storage (memory), instead of database
		store.InsertTemp(&token)
	}

	return &Service{store, cfg}
}

func (s *Service) AddToken(t *Token) error {
	// Check if the input is a valid address
	address, err := flow_helpers.ValidateAddress(t.Address, s.cfg.ChainID)
	if err != nil {
		return err
	}

	t.Address = address

	if t.Name == "" {
		return fmt.Errorf(`not a valid name: "%s"`, t.Name)
	}

	// Received code templates may have values that need replacing
	t.Setup = TokenCode(t, t.Setup)
	t.Transfer = TokenCode(t, t.Transfer)
	t.Balance = TokenCode(t, t.Balance)

	return s.store.Insert(t)
}

func (s *Service) ListTokens(tType *TokenType) (*[]BasicToken, error) {
	return s.store.List(tType)
}

func (s *Service) GetTokenById(id uint64) (*Token, error) {
	return s.store.GetById(id)
}

func (s *Service) GetTokenByName(name string) (*Token, error) {
	return s.store.GetByName(name)
}

func (s *Service) RemoveToken(id uint64) error {
	return s.store.Remove(id)
}

func (s *Service) TokenFromEvent(e flow.Event) (*Token, error) {
	// Example event:
	// A.0ae53cb6e3f42a79.FlowToken.TokensDeposited
	ss := strings.Split(e.Type, ".")

	// Token address from event
	eAddress, err := flow_helpers.ValidateAddress(ss[1], s.cfg.ChainID)
	if err != nil {
		return nil, err
	}

	token, err := s.GetTokenByName(ss[2])
	if err != nil {
		return nil, err
	}

	// Token address from database
	tAddress, err := flow_helpers.ValidateAddress(token.Address, s.cfg.ChainID)
	if err != nil {
		return nil, err
	}

	// Check if addresses match
	if eAddress != tAddress {
		return nil, fmt.Errorf("addresses do not match for %s, from event: %s, from database: %s", token.Name, eAddress, tAddress)
	}

	return token, nil
}

repository: mjmj/wallet-api

repo_name: mjmj/wallet-api

branch_name: refs/heads/main


text:
# Copyright (C) 2013-2016 Freescale Semiconductor
# Copyright 2017-2018 NXP

include recipes-bsp/imx-test/imx-test.inc

PV = "7.0+${SRCPV}"

SRCBRANCH = "imx_4.9.88_2.0.0_ga"
IMXTEST_SRC ?= "git://source.codeaurora.org/external/imx/imx-test.git;protocol=https"
SRC_URI = "${IMXTEST_SRC};branch=${SRCBRANCH}"
SRC_URI_append = " file://memtool_profile "

SRCREV = "1f7da41b3a8d5dff8329d7b01b10d4d71144b43e"

S = "${WORKDIR}/git"

DEPENDS_append        = " alsa-lib"
DEPENDS_append_mx7ulp = " virtual/kernel imx-lib"
DEPENDS_append_mx8    = " virtual/kernel"
DEPENDS_append_imxvpu = " virtual/imxvpu"

PLATFORM_mx6sll = "IMX6SL"
PLATFORM_mx7ulp  = "IMX7D"
PLATFORM_mx8 = "IMX8"

IMX_HAS_VPU         = "false"
IMX_HAS_VPU_imxvpu  = "true"
EXTRA_OEMAKE       += "HAS_VPU=${IMX_HAS_VPU}"

PARALLEL_MAKE="-j 1"

do_install_append() {
    install -d -m 0755 ${D}/home/root/
    install -m 0644 ${WORKDIR}/memtool_profile ${D}/home/root/.profile
}

# Avoid race condition between tasks. This should be upstreamed to meta-freescale.
addtask make_scripts after do_configure before do_compile

FILES_${PN} += " /home/root/.profile "

COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"


text:
# Install script for directory: /Users/chushoutv/Desktop/opencv-3.3.1/modules

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
  set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
  if(BUILD_TYPE)
    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
  else()
    set(CMAKE_INSTALL_CONFIG_NAME "Release")
  endif()
  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
  if(COMPONENT)
    message(STATUS "Install component: \"${COMPONENT}\"")
    set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
  else()
    set(CMAKE_INSTALL_COMPONENT)
  endif()
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
  # Include the install script for each subdirectory.
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/calib3d/.calib3d/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/core/.core/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudaarithm/.cudaarithm/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudabgsegm/.cudabgsegm/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudacodec/.cudacodec/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudafeatures2d/.cudafeatures2d/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudafilters/.cudafilters/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudaimgproc/.cudaimgproc/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudalegacy/.cudalegacy/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudaobjdetect/.cudaobjdetect/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudaoptflow/.cudaoptflow/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudastereo/.cudastereo/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudawarping/.cudawarping/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/cudev/.cudev/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/dnn/.dnn/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/features2d/.features2d/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/flann/.flann/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/highgui/.highgui/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/imgcodecs/.imgcodecs/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/imgproc/.imgproc/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/java/.java/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/js/.js/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/ml/.ml/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/objdetect/.objdetect/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/photo/.photo/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/python/.python/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/shape/.shape/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/stitching/.stitching/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/superres/.superres/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/ts/.ts/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/video/.video/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/videoio/.videoio/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/videostab/.videostab/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/viz/.viz/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/world/.world/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/core/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/flann/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/imgproc/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/ml/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/objdetect/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/photo/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/video/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/dnn/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/imgcodecs/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/shape/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/videoio/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/highgui/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/superres/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/ts/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/features2d/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/calib3d/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/stitching/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/videostab/cmake_install.cmake")
  include("/Users/chushoutv/Desktop/opencv-3.3.1/bulid/modules/python2/cmake_install.cmake")

endif()

repository: JikerSun/FirstOpenCV-master

repo_name: JikerSun/FirstOpenCV-master


text:
// Code generated by gocc; DO NOT EDIT.

package parser

import (
	"fmt"
	"github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/token"
	"github.com/maxcalandrelli/gocc/example/calc/calc.grammar/calc/internal/util"
	"strings"
)

func getString(X Attrib) string {
	switch X.(type) {
	case *token.Token:
		return string(X.(*token.Token).Lit)
	case string:
		return X.(string)
	}
	return fmt.Sprintf("%q", X)
}

func unescape(s string) string {
	return util.EscapedString(s).Unescape()
}

func unquote(s string) string {
	r, _, _ := util.EscapedString(s).Unquote()
	return r
}

func lc(s string) string {
	return strings.ToLower(s)
}

func uc(s string) string {
	return strings.ToUpper(s)
}

type (
	//TODO: change type and variable names to be consistent with other tables
	ProdTab      [numProductions]ProdTabEntry
	ProdTabEntry struct {
		String     string
		Id         string
		NTType     int
		Index      int
		NumSymbols int
		ReduceFunc func(interface{}, []Attrib) (Attrib, error)
	}
	Attrib interface {
	}
)

var productionsTable = ProdTab{
	ProdTabEntry{
		String: `S' : Π<Calc>	<<  >>`,
		Id:         "S'",
		NTType:     0,
		Index:      0,
		NumSymbols: 1,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0], nil
		},
	},
	ProdTabEntry{
		String: `Calc : Π<Expr>	<<  >>`,
		Id:         "Calc",
		NTType:     1,
		Index:      1,
		NumSymbols: 1,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0], nil
		},
	},
	ProdTabEntry{
		String: `Expr : Π<Term> Λ<+> Π<Term>	<< $0.(int64) + $2.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      2,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64) + X[2].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Expr : Π<Term> Λ<-> Π<Term>	<< $0.(int64) - $2.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      3,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64) - X[2].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Expr : Λ<-> Π<Term>	<< -$1.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      4,
		NumSymbols: 2,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return -X[1].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Expr : Π<Term> Λ<*> Π<Factor>	<< $0.(int64) * $2.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      5,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64) * X[2].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Expr : Π<Term> Λ</> Π<Factor>	<< $0.(int64) / $2.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      6,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64) / X[2].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Expr : Π<Term>	<< $0.(int64), nil >>`,
		Id:         "Expr",
		NTType:     2,
		Index:      7,
		NumSymbols: 1,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Term : Π<Term> Λ<*> Π<Factor>	<< $0.(int64) * $2.(int64), nil >>`,
		Id:         "Term",
		NTType:     3,
		Index:      8,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0].(int64) * X[2].(int64), nil
		},
	},
	ProdTabEntry{
		String: `Term : Π<Factor>	<<  >>`,
		Id:         "Term",
		NTType:     3,
		Index:      9,
		NumSymbols: 1,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[0], nil
		},
	},
	ProdTabEntry{
		String: `Factor : Λ<(> Π<Expr> Λ<)>	<< $1, nil >>`,
		Id:         "Factor",
		NTType:     4,
		Index:      10,
		NumSymbols: 3,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return X[1], nil
		},
	},
	ProdTabEntry{
		String: `Factor : int64	<< util.IntValue($0.(*token.Token).Lit) >>`,
		Id:         "Factor",
		NTType:     4,
		Index:      11,
		NumSymbols: 1,
		ReduceFunc: func(Context interface{}, X []Attrib) (Attrib, error) {
			return util.IntValue(X[0].(*token.Token).Lit)
		},
	},
}

repository: maxcalandrelli/gocc

repo_name: maxcalandrelli/gocc


text:
include summit-supplicant.inc

OPENSSLVER = ""

RDEPENDS_${PN} += "libssl (>= 1.1.0) libcrypto (>= 1.1.0)"


text:
package main

import (
	"bufio"
	. "fmt"
	"io"
)

// github.com/EndlessCheng/codeforces-go
func CF1203D2(in io.Reader, out io.Writer) {
	max := func(a, b int) int {
		if b > a {
			return b
		}
		return a
	}

	var s, t string
	Fscan(bufio.NewReader(in), &s, &t)
	n, m := len(s), len(t)
	suf := make([]int, m+1)
	suf[m] = n
	for i, j := n-1, m-1; j >= 0; i-- {
		if s[i] == t[j] {
			suf[j] = i
			j--
		}
	}
	ans := suf[0]
	for i, j := 0, 0; j < m; i++ {
		if s[i] == t[j] {
			j++
			ans = max(ans, suf[j]-i-1)
		}
	}
	Fprint(out, ans)
}

//func main() { CF1203D2(os.Stdin, os.Stdout) }

repository: EndlessCheng/codeforces-go

repo_name: EndlessCheng/codeforces-go


text:
# From meta-virtualization/recipes-extended/seabios
# rev: 279dbced29e928618ba836226542926604d7e570
# url: http://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/tree/recipes-extended/seabios?h=warrior

DESCRIPTION = "SeaBIOS"
HOMEPAGE = "http://www.coreboot.org/SeaBIOS"
LICENSE = "LGPLv3"
SECTION = "firmware"

DEBIAN_QUILT_PATCHES = ""
inherit debian-package
require recipes-debian/sources/seabios.inc

SRC_URI += " \
    file://hostcc.patch \
    "
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504         \
                    file://COPYING.LESSER;md5=6a6a8e020838b23406c81b19c1d46df6  \
                    "

FILES_${PN} = "/usr/share/seabios"

DEPENDS = "util-linux-native file-native bison-native flex-native gettext-native acpica-native python-native"

TUNE_CCARGS = ""
EXTRA_OEMAKE += "HOSTCC='${BUILD_CC}'"
EXTRA_OEMAKE += "CC='${BUILD_CC}'"
EXTRA_OEMAKE += "LD='${BUILD_LD}'"

SEABIOS_TEMP_BIOS_FIRMWARE_DIR = "${B}/bios_images"

seabios_create_bios_config() {
  oe_runmake defconfig

  for x in "$@"; do
    val=""
    case $x in
      (*=n) val="# CONFIG_${x%=*} is not set";;
      (*) val="CONFIG_$x";;
    esac;
    echo "$val" >> ${B}/.config
  done
  oe_runmake oldnoconfig
}

seabios_build_optionroms() {
  oe_runmake -C debian/optionrom
  chmod -x debian/optionrom/*.bin

  if [ -e "debian/optionrom/vapic.bin" ]; then
    rm -f debian/optionrom/vapic.bin
  fi
  ln -s kvmvapic.bin debian/optionrom/vapic.bin
  mv debian/optionrom/*.bin ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR}/
}

seabios_build_firmwares() {
  rm -f ${B}/src/fw/acpi-dsdt.hex ${B}/src/fw/q35-acpi-dsdt.hex ${B}/src/fw/ssdt-misc.hex ${B}/src/fw/ssdt-pcihp.hex ${B}/src/fw/ssdt-proc.hex

  oe_runmake OUT=${B}/out/ src/fw/acpi-dsdt.hex src/fw/q35-acpi-dsdt.hex src/fw/ssdt-misc.hex src/fw/ssdt-pcihp.hex src/fw/ssdt-proc.hex

}

do_configure() {
  oe_runmake defconfig
}

#
# Build each bios targets.
# config options came from debian/rules file.
#
do_compile() {
    unset CPP
    unset CPPFLAGS

    if [ -d ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR} ]; then
      rm -fr ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR}
    fi
    mkdir ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR}

    for name in bios bios-256k vgabios-cirrus vgabios-stdvga vgabios-virtio vgabios-vmware vgabios-qxl vgabios-isavga; do
      oe_runmake clean
      case $name in
        "bios")
          seabios_create_bios_config "QEMU=y" "ROM_SIZE=128" "ATA_DMA=y" "PVSCSI=n" "BOOTSPLASH=n" "XEN=n" "USB_OHCI=n" "USB_XHCI=n" "USB_UAS=n" "SDCARD=n" "TCGBIOS=n" "MPT_SCSI=n" "NVME=n" "USE_SMM=n" "VGAHOOKS=n";;
	"bios-256k")
          seabios_create_bios_config "QEMU=y" "ROM_SIZE=256" "ATA_DMA=y";;
	"vgabios-cirrus")
          seabios_create_bios_config "BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=y";;
	"vgabios-stdvga")
          seabios_create_bios_config "BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=y";;
	"vgabios-virtio")
          seabios_create_bios_config "BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=y" "OVERRIDE_PCI_ID=y" "VGA_VID=0x1af4" "VGA_DID=0x1050";;
        "vgabios-vmware")
          seabios_create_bios_config "vgabios,BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=y" "OVERRIDE_PCI_ID=y" "VGA_VID=0x15ad" "VGA_DID=0x0405";;
        "vgabios-qxl")
          seabios_create_bios_config "BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=y" "OVERRIDE_PCI_ID=y" "VGA_VID=0x1b36" "VGA_DID=0x0100";;
	"vgabios-isavga")
          seabios_create_bios_config "BUILD_VGABIOS=y" "VGA_BOCHS=y" "VGA_PCI=n";;
	"*")
          bberror "unknown target ${name}";;
      esac;

      oe_runmake

      cp ${B}/out/bios.bin ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR}/${name}.bin
    done

   seabios_build_optionroms
   seabios_build_firmwares
}

do_install() {
    install -d ${D}/${prefix}/share/seabios
    install -m 0644 ${SEABIOS_TEMP_BIOS_FIRMWARE_DIR}/*.bin ${D}/${prefix}/share/seabios/
    install -m 0644 ${B}/out/src/fw/acpi-dsdt.aml ${D}/${prefix}/share/seabios/
    install -m 0644 ${B}/out/src/fw/q35-acpi-dsdt.aml ${D}/${prefix}/share/seabios/
}

FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}"
BBCLASSEXTEND = "native nativesdk"

repository: mozoko/meta-debian-extended

repo_name: mozoko/meta-debian-extended

branch_name: refs/heads/warrior


text:
SUMMARY = "OpenBMC NCPLite Check Inventory State Service"
DESCRIPTION = "OpenBMC NCPLite Check Inventory State Daemon."
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

inherit systemd

DEPENDS += "systemd"
RDEPENDS:${PN} += "bash"

SRC_URI = " file://inventory-log.sh \
            file://inventory-log.service \
          "

do_install() {
    install -d ${D}${libexecdir}/${BPN}
    install -m 0755 ${WORKDIR}/inventory-log.sh ${D}${libexecdir}/${BPN}

    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/inventory-log.service ${D}${systemd_system_unitdir}
}

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "inventory-log.service"

repository: openbmc/openbmc

repo_name: openbmc/openbmc

gha_language: Python


text:
package genesis

import (
	"bytes"
	"encoding/json"
	"io"

	"cosmossdk.io/core/appmodule"
)

// RawJSONTarget returns a struct which encapsulates a genesis target that is
// backed by raw JSON messages. Its Target method should be used to retrieve
// an actual genesis target function. When genesis writing is done, the JSON
// method should be called to retrieve the raw message that has been written.
type RawJSONTarget struct {
	m map[string]json.RawMessage
}

// Target returns the actual genesis target function.
func (r *RawJSONTarget) Target() appmodule.GenesisTarget {
	return func(field string) (io.WriteCloser, error) {
		if r.m == nil {
			r.m = map[string]json.RawMessage{}
		}

		return &genesisWriter{Buffer: &bytes.Buffer{}, sink: r, field: field}, nil
	}
}

// JSON returns the raw JSON message that has been written.
func (r *RawJSONTarget) JSON() (json.RawMessage, error) {
	return json.MarshalIndent(r.m, "", "  ")
}

type genesisWriter struct {
	*bytes.Buffer
	field string
	sink  *RawJSONTarget
}

func (r genesisWriter) Close() error {
	r.sink.m[r.field] = r.Buffer.Bytes()
	return nil
}

repository: cosmos/cosmos-sdk

repo_name: cosmos/cosmos-sdk


text:
#
# Trusted firmware-A 1.5
#

require recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc
#require meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc

# Use TF-A for version
SRCREV_FORMAT = "tfa"

# TF-A v1.5
SRCREV_tfa = "ed8112606c54d85781fc8429160883d6310ece32"

LIC_FILES_CHKSUM += "file://license.rst;md5=e927e02bca647e14efd87e9e914b2443"

#
# mbed TLS source
# Those are used in trusted-firmware-a.inc if TFA_MBEDTLS is set to 1
#

SRC_URI_MBEDTLS = "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;destsuffix=git/mbedtls;branch=mbedtls-2.16"

# mbed TLS v2.16.2
SRCREV_mbedtls = "d81c11b8ab61fd5b2da8133aa73c5fe33a0633eb"

LIC_FILES_CHKSUM_MBEDTLS = " \
    file://mbedtls/apache-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
    file://mbedtls/LICENSE;md5=302d50a6369f5f22efdb674db908167a \
    "


text:
SUMMARY = "OpenBMC fan control"
DESCRIPTION = "OpenBMC fan control."
PR = "r1"

inherit skeleton-python

RDEPENDS_${PN} += "\
        python-dbus \
        python-pygobject \
        pyphosphor \
        "
SKELETON_DIR = "pyfanctl"

repository: tpilukechen/openbmc

repo_name: tpilukechen/openbmc


text:
// Copyright 2022 E99p1ant. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package conf

// Build time and commit information.
//
// ⚠ WARNING: should only be set by "-ldflags".
var (
	BuildTime   string
	BuildCommit = "dev"
)

var (
	App struct {
		Production            bool   `ini:"production"`
		ExternalURL           string `ini:"external_url"`
		ICP                   string `ini:"icp"`
		UptraceDSN            string `ini:"uptrace_dsn"`
		QiniuAccessKey        string `ini:"qiniu_access_key"`
		QiniuAccessSecret     string `ini:"qiniu_access_secret"`
		AliyunAccessKey       string `ini:"aliyun_access_key"`
		AliyunAccessKeySecret string `ini:"aliyun_access_key_secret"`
		SentryDSN             string `ini:"sentry_dsn"`
	}

	Security struct {
		EnableTextCensor bool `ini:"enable_text_censor"`
	}

	Server struct {
		Port    int    `ini:"port"`
		Salt    string `ini:"salt"`
		XSRFKey string `ini:"xsrf_key"`
	}

	Database struct {
		DSN      string
		User     string `ini:"user"`
		Password string `ini:"password"`
		Address  string `ini:"address"`
		Name     string `ini:"name"`
	}

	Redis struct {
		Addr     string `ini:"addr"`
		Password string `ini:"password"`
	}

	Recaptcha struct {
		Domain    string `ini:"domain"`
		SiteKey   string `ini:"site_key"`
		ServerKey string `ini:"server_key"`
	}

	Upload struct {
		DefaultAvatarURL    string `ini:"default_avatar"`
		DefaultBackground   string `ini:"default_background"`
		AliyunEndpoint      string `ini:"aliyun_endpoint"`
		AliyunAccessID      string `ini:"aliyun_access_id"`
		AliyunAccessSecret  string `ini:"aliyun_access_secret"`
		AliyunBucket        string `ini:"aliyun_bucket"`
		AliyunBucketCDNHost string `ini:"aliyun_bucket_cdn_host"`
	}

	Mail struct {
		Account  string `ini:"account"`
		Password string `ini:"password"`
		Port     int    `ini:"port"`
		SMTP     string `ini:"smtp"`
	}
)

repository: NekoWheel/NekoBox

repo_name: NekoWheel/NekoBox


text:
// Package qianniu 包含千牛接口相关结构体
//
// https://open.taobao.com/API.htm?docType=2&docId=27244
package qianniu

repository: bububa/opentaobao

repo_name: bububa/opentaobao