AWS |
AWS - Webinar Channel |
Build ML models using SageMaker Studio Notebooks - AWS Virtual Workshop |
https://www.youtube.com/watch?v=1iSiN4sVMjE
|
Build ML models using SageMaker Studio Notebooks AWS Virtual WorkshopManaging compute instances to view run or share a notebook is tedious Amazon SageMaker Studio Notebooks are one click Jupyter notebooks that can be spun up quickly The underlying compute resources are fully elastic so you can easily dial up or down the available resources and the changes take place automatically in the background without interrupting your work You can also share notebooks with others in a few clicks They will get the exact same notebook saved in the same place Join us to get started using SageMaker Studio Notebooks Learning Objectives Objective See how to launch and use SageMaker Studio Notebooks Objective Learn how to install open source extensions Objective Learn how to track and manage training and data processing jobs and test machine learning model performance To learn more about the services featured in this talk please visit |
2022-08-18 17:30:01 |
海外TECH |
DEV Community |
Cheat sheet for react Part I (Updated August 2022) |
https://dev.to/khansa/cheat-sheet-for-react-part-i-updated-august-2022-am4
|
Cheat sheet for react Part I Updated August Would you like to learn React as rapidly as possible In order to offer you a thorough review of every React topic you ll need to understand in I ve put together a really handy cheatsheet If you liked it wait for my next article The good news is that it is beginner friendly and I covered a really simple concept The Game begins here Create a React AppCreate React App provides a pleasant learning environment for React and is the easiest approach to begin constructing a new single page application in React Create a new appnpx create react app hello world Run the created appcd hello worldnpm start http localhost ComponentsComponents are self contained and reusable pieces of code They perform the same job as JavaScript functions except they act independently and return pseudo HTML syntex Components are classified into two types class components and function components This course will focus on function components Functional ComponentThere is no need to import React from the word react since React JSX must be returned if the first letter is uppercase React Componentfunction App return lt h gt Hey I m Functional Component lt h gt export default App Two ways to import ComponentSeparate files will be created for each component Each component must be exported and then imported function Card return lt gt lt div className card gt lt h gt I m Card lt h gt lt div gt lt gt export default CardThis component may be imported in the following ways you can also alter its name during importing import ICard from Card function App return lt ICard gt or name export export const Card gt return lt gt lt div className card gt lt h gt I m Card lt h gt lt div gt lt gt export default CardThis component may then be imported import Card from Card function App return lt Card gt Nested ComponentsA component that is nested is a subcomponent of the component it contains Relative to that parent the child component is positioned and shown Arrow function shorthand componentconst User gt lt h gt Khansa lt h gt Arrow function componentconst Message gt return lt h gt Hello lt h gt Function componentfunction App return lt gt lt Message gt lt User gt lt gt Some JSX Rules Are hereIt is a JavaScript syntactic extension We advocate utilising it alongside React to specify how the user interface should appear parent elementReturn just one element only one parent element not validreturn lt h gt Hello world lt h gt lt h gt Hi lt h gt valid with React fragment return lt React Fragment gt lt h gt Hello World lt h gt lt h gt Hi lt h gt lt React Fragment gt valid with fragment as Well return lt gt lt h gt Hello World lt h gt lt h gt Hi lt h gt lt gt Noted the parenthesis for multi line formattingInstead of class use className Explanation The only reason it uses className instead of class is that class is a reserved term in JavaScript and since we use JSX in React which is an extension of JavaScript we must use className instead of class attribute Also all attribute names must be in camelCase not validreturn lt div class card gt I m Card lt div gt validreturn lt div className card gt I m Card lt div gt Close every element is important as well return lt img src image jpg gt lt input type text placeholder write your name gt JSX ElementsLike standard HTML components React elements are written in the same way Any legitimate HTML element may be written in React validconst input lt input type text gt valid as well lt h gt I am Header lt h gt lt p gt I am paragraph lt p gt lt button gt I am button lt button gt JSX FunctionsAll of your primitives may be passed in JSX functions JSX Functionsconst name khansa const age const isHuman true return lt h gt My name is name I am age year s old lt h gt JSX Conditional renderingBy utilising an if statement alone import React from react export default function Weather props if props temperature gt return lt p gt It is props temperature °C Warm in props city lt p gt else return lt p gt It is props temperature °C in props city lt p gt Or by utilising an ternery operatorconst name khansa const age const isHuman true return isHuman lt h gt My name is name I am age year s old lt h gt lt p gt I m not here lt p gt By utilising an Truth value or amp amp operatorconst name khansa const age const isHuman true return isHuman amp amp lt h gt My name is name I am age year s old lt h gt lt p gt I m not here lt p gt By utilising an opratorconst name khansa const age const isHuman false return isHuman lt h gt My name is name I am age year s old lt h gt lt p gt I m not here lt p gt PropertiesThe component s input values come from properties When rendering the component and setting the state they are utilised discussed shortly The component s properties should be regarded as immutable after they have been instantiated lt User firstName Khansa lastName Mueen age pro true gt Default Props valueThe value attribute on form elements will take precedence over the value in the DOM during the React rendering process You frequently want React to specify the initial value for an uncontrolled component but let future updates uncontrolled const User name age children gt return lt h gt Name name Age age lt h gt lt p gt children lt p gt User defaultProps name Khansa age List Using Spread Operatorexport const SpreadData gt const users khansa Mueen Arshad const data users Moiz return lt div gt Users data is data lt div gt List Using MapOn websites menus are typically displayed using lists which are used to display facts in an organised fashion Lists in React can be built similarly to how lists are created in JavaScript const users id name khansa age id name Arshad age id name Mueen age function App return users map person gt return lt Person name person name age person age gt const Person props gt return lt h gt Name props name Age props age lt h gt Props object destructuringimport React from react import Card from component Card function App return lt div className App gt lt Card title React Course duration day gt lt div gt export default App ConclusionThese are really basic concepts that I have covered for newcomers and I must finish the following section shortly For additional updates ping me on Twitter |
2022-08-18 17:53:58 |
海外TECH |
DEV Community |
The Concept |
https://dev.to/midnqp/rest-api-a-quickread-for-backend-dev-3i70
|
The ConceptREST stands for Representational State Transfer This is an architectural style A web API conforming to this style is a REST API REST stands on guiding principles important among them are Client server separate backend and frontend Stateless each http request contains enough data e g auth session user data to understand it without knowing what the previous request was CacheableGET always POST using http headers expire cache control etag last modifiedPUT DELETE never ConceptsThe following are some important concise and simplified REST concepts a good backend dev must be familiarized with ResourceREST APIs are modeled as a resource hierarchy where each node is either a collection or a single resource A single resource has some state or sub resources Example of a stateful resource is the following where a user resource has data states POST users id id edaf name muhammad country earth verified true Example of a resource with sub resources is the following where a user has multiple projects each of which are a resource GET users id projectscontent type application json id postman cli desc postman implemented in command line url github com midnqp postman cli id typescript desc typescript is a superset of javascript url github com microsoft typescript IdempotencyAPI Idempotency means a client can make a request multiple times returning same response without having any side effect Making the following requests multiple times produces the same result and has no further side effect thus are idempotent APIs GET users id just retrieving same user dataPUT users just updating same json dataDELETE users id just deleteing the same userA non idempotent API POST users id because a new user will be created everytime this request is made |
2022-08-18 17:45:00 |
海外TECH |
DEV Community |
Announcing the Redis Hackathon on DEV! |
https://dev.to/devteam/announcing-the-redis-hackathon-on-dev-3248
|
Announcing the Redis Hackathon on DEV Update On August the Redis team increased the total prize pool significantly with the following breakdown Four FIVE Grand Prize Winners to receive USDTen TWENTY Runners Up to receive USDTWENTY FIVE participants who included the optional video in their submission to receive Hello dear DEV community We wanted to stop by and let you in on some exciting news today we re launching a new way for you to build an interesting application in the open learn something new and win exciting prizes in the process… Announcing the Redis Hackathon on DEV If you re familiar with our hackathons here on DEV you know that the community has a lot of fun with them and gets pretty creative with what they build Whether you ve joined us in the past or not we hope you ll throw your hat into the ring by participating in the Redis Hackathon on DEV Keep reading to get all the details on how you can enter this contest more about Redis and the prizes they re offering our community Why Participate What s so interesting about Redis beyond caching Redis is the most loved open source database in the world Over the last several years Redis has evolved from a caching database into a multi model primary database This means your cache is now your database and your database is your cache Secondly because it s multi model you can use it for collecting billions of events like Kafka storing JSON documents like MongoDB querying and indexing your data like Algolia or Elasticsearch analyzing time series data like InfluxDB and recommending like Neoj you can do it all in a single system and do it fast Redis gives you unprecedented flexibility to build anything you want or just simplify a complex backend that has multiple data systems Kafka MongoDB Algolia InfluxDB Neoj AnalyticsDB with just a single system Redis Furthermore if you are using a microservices architecture you can use Redis to connect all those services and process requests and responses blazing fast in both parallel or in order fashion For this hackathon you ll be building a new app that uses many of these capabilities or migrate an existing OSS demo app and show reduced complexity and improved performance P S Want to get a sense of the benefits of Redis before you get started Take a look at this minute video From now through August th DEV has partnered up with Redis for a community hackathon that will give you the chance to build a new application using Redis or simplify a complex backend Anyone who submits a valid project including an official submission post published on DEV will be automatically entered to win a variety of fantastic prizes including up to USD Project CategoriesThe Redis Hackathon on DEV is calling for projects in the following four categories Minimalism Magicians Simplify an existing OSS reference demo app from one of the cloud providers AWS Azure GCP etc that uses multiple data systems such as ElastiCache TimeStream DynamoDB Neptune Kafka etc by replacing as many of the data systems as possible with Redis Notes for the “Minimalism Magicians category •AWS examples Samples repo IoT Reference Architectures Retail Demo Store •Google Cloud examples Samples repo GCP Microserves demo •Azure examples Samples repo Streaming at scale Search with JavaScript No need to create a new app just port the backend of an existing app •Be sure to show a before and after architecture diagram with a working demo application •Be sure to show the performance improvement between the new architecture and the old architecture Microservice Mavens Build an event driven microservices application that primarily uses Redis features such as streams pubsub queues JSON search time series etc to provide a blazing fast yet simple platform Inspiration GCP Microserves demoNotes for the “Microservice Mavens category •Video explaining how to use Redis with Microservices •Recently published e book Understanding Streams in Redis and Kafka A Visual GuideMEAN MERN Mavericks Build a new or port an existing OSS MEAN MERN stack app and use Redis in one of the following three ways •Use Redis to your MEAN MERN stack to add caching and advanced searching capabilities using JSON and Search modules •Use Redis as a primary database instead of MongoDB i e replace “M in MEAN MERN with “R for Redis •Use Redis along side MongoDB as a frontend database “Write behind or “Write Through in front of MongoDB i e do all the CRUD operations directly with Redis and asynchronously send the updates back to Mongo for storage Notes Use Redis Search and JSON modules for CRUD operations Use Redis Gears to use Redis as a frontend database and asynchronously send updates to MongoDB Mongo Example Learn more about different ways Cache aside Write behind or Write Through of using Redis and Mongo here Lastly show the architecture diagram with and without Redis and performance improvements in your submission Inspiration Redis Launchpad Wacky Wildcards Build a random app that doesn t fit into one of the categories above With this category we are looking for some truly silly and or fun submissions Feel free to dream big and ridiculously ーand utilize any offering that Redis offers Tip If you are still struggling to come up with something please follow the Redis Org on DEV and look out for upcoming project ideas and additional resources that their team will be sharing Prizes Four FIVE Grand Prize Winners TWO winners in a random category and one per category for the other three USD gift card or equivalent USD credit to the Forem ShopDEV Sticker PackDEV “Redis Hackathon Grand Prize profile badgeRunner Up Prizes Total updated on August th USD gift card or equivalent USD credit to the Forem ShopDEV Sticker PackDEV “Redis Hackathon Runner Up profile badgeParticipants with a valid project DEV Sticker PackDEV “Redis Hackathon participant profile badgeBonus We will be awarding USD extra for all Grand Prize winners as well as Runners Up that have a minutes video as part of the submission max winners winners updated on August th Bonus We will be awarding USD extra for all Grand Prize winners as well as Runners Up that have a minutes video as part of the submission max winners Bonus Redis will promote the winners and top submitters apps over social media and invite them to write guest blogs on the Redis official website to promote you and your accomplishments The apps will also be featured on the Redis Launchpad How to Participate in the Redis Hackathon on DEV Sign up for a free Redis Cloud account by clicking here Be sure to use the Redis Stack database in the cloud Create a free Redis database or use the special code DEVTO to get a credit on a paid account with a larger storage you ll want to go this route if your project features a large dataset Please note that you ll need to choose a paid plan to use this couponIf you prefer not to use the cloud you can install the Redis Stack Docker image instead Create a new and original app during the contest period for mobile desktop web or CLI using Redis that falls under one of the categories listed above Use one of the following languages C ASP NET CoreJava SpringJS TS Node jsPythonAny other language of your choice Note Redis OM library only supports the above languages but feel free to use any other libraries Use one of the following permissive licenses for your code MIT Apache BSD BSD or Commons Clause Share your code publicly on GitHub and ensure that your repository Includes a README using this template Includes at least one screenshot of the app and or architecture diagram Clearly shows the commands used to store and retrieve the data for each feature Example Example Describes how you store the dataDescribes how you read the dataIncludes a marketplace json file with the metadata of the app like app name language etc See the marketplace json files details here IMPORTANT Use this post template to officially submit your application for the hackathon Be sure to address every prompt and instruction in the template Be sure to publish your submission on DEV between August st and August th PM UTC and provide your app s URL screenshot description and source code️Heads up that you ll only be able to view our submission template linked above if you re logged into DEV Bonus Points additional prize per winner As an optional supplement to your project we invite you to create a video version of your submission post Our judges will be awarding “bonus points to anyone who creates a minute publicly viewable YouTube video explaining their project which can be embedded into your submission post on DEV instructions in the template These projects must have also won a Grand Prize or Runner Up award to receive this bonus cash In this video you must…Talk about your app projectTell us how your project stores and reads the data and what the data modeling is likeExplain the architecture of your appShow some of your data using RedisInsight And add a link to in the video description in the first line of the description“Bonus points in project consideration means that our judges will consider otherwise valid projects with the optional video add on FIRST when selecting winners Additional ResourcesThe Redis team has put together some resources to help you quickly get started If you still have questions feel free to ask them in the help thread or Redis Discord Sign up for a free Redis Cloud account using this link and use the Redis Stack database in the cloud For datasets gt GB please use Redis Stack on Docker Libraries JavaScript Redis OM Node video guide Python Redis OM Python video guide Java Redis OM Spring video guide C Redis OM NET video guide Redis Developer Hub for docs samples and tutorials Redis Stack getting started page RedisInsight Desktop GUI tool for inspecting the data Additional Notes and Rules We encourage you to share update posts on DEV using the redishackathon tag to keep us posted on your progress hint use series “series name in the markdown heading of all your Redis Hackathon related posts to link all content in a series Multiple submissions are allowedIf you collaborate with anyone please list their DEV handles in your submission post so we can award a profile badge to your entire team DEV does not handle prize splitting so in the event your project is named a Grand Prize winner or runner up you will need to split those amongst yourselves Thank you for understanding NO PURCHASE NECESSARY Open only to Contest entry period ends August th PM UTC Contest is void where prohibited or restricted by law or regulation All entries must be new projects and created during the hackathon period For Official Rules see Contest Announcement Page and General Contest Official Rules Community SupportTo ask any questions about Redis or about the rules of this contest leave a comment in the Redis Hackathon help thread Our team will be monitoring this space to answer your questions in collaboration with the Redis team Need some external motivation and guidance Who doesn t We encourage all participants to swing by our community discussion thread where you can share your ideas and get suggestions on improvements from the DEV community as you build your app You can also use this thread to share your progress along the way to get support from others Important Dates August Hackathon BeginsAugust Hackathon Submission Due at PM UTCAugust Submission judging beginsWinners will be selected and announced in the weeks following the final submission deadline We re so excited for you to join us for this brand new hackathon with our friends at Redis Have fun learn lots and keep us posted along the way Good luck and happy coding |
2022-08-18 17:26:38 |
海外TECH |
DEV Community |
Using HarperDB With Django |
https://dev.to/dennisivy11/using-harperdb-with-django-10m8
|
Using HarperDB With DjangoBefore you try to use HarperDB in your Django project there are some trade offs you should consider I wanna cover some of these first and then if you still decide HarperDB and Django are a fit we ll get into the how to If you re reading this there s a good chance you re coming to this article as a participant of my August Code Battle Hackathon so I will write with those participants in mind TradeoffsI ll start by saying that at this point in time HarperDB and Django are not exactly suited for each other Many of the issues are similar to what I said in my video amp article about why MongoDB and Django are not a fit but luckily for HarperDB its in a much better position With MongoDB the biggest issue is that there is no database driver for Django and there hasn t been a succesful implementation of converting Django queries into NoSQL queries As a result of this you lose A LOT of the features Django has built HarperDB has a simular issue There is no database driver at the moment so we run into the same issue we had with MongoDB In HarperDB s case it s a SQL amp NoSQL distributed database so building this driver is not an impossible task Lets hope they do it soon Meanwhile consider the following No more Django ORM ーWith no database adaptor we ll have to use the HarperDB python package instead of the Django ORM No More Admin Panel ーWithout an adaptor we cant run the proper migrations we need Database Connection ーThe DATABASES connection object in settings py does nothing for us without a database driver No more migrations ーCant run migrations without a database driver Authentication amp Models ーThis part I am still unsure about If we are no longer using the Django ORM how will authentication work with the user model This part may have to be re written from scratch My SuggestionUse FastAPI Flask or Custom Functions If you choose to use a lightweight framework you ll have the flexibility you need to make whatever database connection you want You could also bypass building a backend all together and try using HarperDB custom functions to build an API and connect to the database directly from your frontend How To GuideSource codeI ll assume you already have a HarperDB instance setup with a ready database and a blank Django App ready to go If not you can follow me in setting this up in the video tutorial for this article Install HarperDB PackageYou can install the HarperDB python package here This package will give us the tools we ll need to connect to our database and make queries pip install harperdb Connect to DatabaseLet s make this connection in settings py just above the default DATABASES object settings pyimport harperdb DB harperdb HarperDB url lt YOUR HARPERDB URL gt username lt YOUR HARPERDB USERNAME gt password lt YOUR HARPERDB PASSWORD gt Query DatabaseWe ll start accessing data in our views by first importing the DB variable from settings py and then accessing data directly views pyfrom django conf import settingsdb settings DBdef index request devs db search by value hackathon developers id get attributes context devs devs return render request base index html context Now to render this data in our template you would treat it like any other queryset passed through our context dictionary lt ul gt for dev in devs lt li gt dev name lt li gt endfor lt ul gt Adding CRUDReturn Single Itemdef dev profile request pk dev db search by hash hackathon developers pk get attributes context dev dev return render request base profile html context Creating Itemsfrom django shortcuts import render redirect def add profile request if request method POST data request POST db insert hackathon developers name data name return redirect index return render request base form html Updating Itemsdef update profile request pk if request method POST data request POST db update hackathon developers id pk name data name return redirect index dev db search by hash hackathon developers pk get attributes return render request base form html dev dev Deleting Itemsdef delete profile request pk if request method POST db delete hackathon developers pk return redirect index dev db search by hash hackathon developers pk get attributes return render request base delete html dev dev And thats it for the demo |
2022-08-18 17:18:02 |
海外TECH |
DEV Community |
Hosting Azure DevOps Pipelines agents on GitHub Codespaces |
https://dev.to/pwd9000/hosting-azure-devops-pipelines-agents-on-github-codespaces-4jm2
|
Hosting Azure DevOps Pipelines agents on GitHub Codespaces OverviewWelcome to another part of my series GitHub Codespaces Pro Tips In the last part we spoke about hosting your GitHub self hosted action runners on Codespaces Similarly to the last post we will cover how you can utilise your GitHub Codespace compute power by running an Azure Pipelines agent inside of the Codespace at the same time We will be using a custom docker image that will automatically provision a self hosted Azure Pipelines agent and register it against your Azure DevOps projects agent pool at the same time as provisioning the Codespace We will also look at the Codespace lifecycle By default any Active codespaces that becomes idle will go into a hibernation mode after minutes to save on compute costs so we will look at how this timeout can be configured and extended if needed Getting startedAll of the code samples and examples are also available on my GitHub Codespaces Demo Repository Also have a look at this blog post Integrating Azure DevOps with GitHub Hybrid Model where I show how to use GitHub Codespaces with Azure DevOps as we will be building this solution based on the hybrid model described in that post Since Codespaces Dev containers are based on docker images we will create a custom linux docker image that will start and bootstrap an Azure DevOps Pipelines agent as the codespace starts up Azure DevOps Pre requirementsFirst we will create an agent pool inside of our Azure DevOps project so that we can register self hosted Azure Pipeline agents Navigate to your Azure DevOps Organization settings Select Agent pools under Pipelines on the left hand side tab Click on Add pool Select Self hosted as the pool type give the pool a Name Description and set the relevant Pipeline permissions Click on Create Add the agent pool to any of your projects by navigating to the Project settings gt Agent pools gt Add pool Select Existing under Pool to link and select the pool we created with the relevant Pipeline permissions Next we will create a Personal Access Token PAT which we will use to register the pipelines agents against the agent pool See creating a personal access token on how to create an Azure DevOps PAT token PAT tokens are only displayed once and are sensitive so ensure they are kept safe The minimum permission scopes required on the PAT token to register a self hosted Azure Pipelines agent are Agent Pools read manage make sure all the other boxes are cleared If it s a deployment group agent for the scope select Deployment group read manage instead and make sure all the other boxes are cleared Select Show all scopes at the bottom of the Create a new personal access token window to see the complete list of scopes Copy the token You ll use this token when you configure the agent Tip I recommend only using short lived PAT tokens and generating new tokens whenever new agent registrations are required Create GitHub Codespaces secretsNext we will navigate to our GitHub repository where we will use Codespaces and create a few codespace secrets these secrets are environment variables that will be used in our codespaces when we spin them up later Navigate to the GitHub repository Settings and select Secrets gt Codespaces Create the following secrets SecretValueDescriptionADO ORGYour org nameName of your Azure DevOps OrganizationADO PATYour PAT tokenAzure DevOps Personal Access Token created to register agent against agent poolADO POOL NAMEYour Agent pool nameThe name of the Azure DevOps agent pool to register agents against Codespace Dev Container ConfigurationNext we will create the following folder structure tree in the root of our GitHub repository In your GitHub repository create a sub folder under devcontainer in my case I have called my codespace configuration folder codespaceADOagent Create the following Dockerfile You can pick any Debian Ubuntu based image FROM mcr microsoft com vscode devcontainers base bullseye Optional Install zshARG INSTALL ZSH true Optional Upgrade OS packages to their latest versionsARG UPGRADE PACKAGES false Install needed packages and setup non root user Use a separate RUN statement to add your own dependencies ARG USERNAME vscodeARG USER UID ARG USER GID USER UIDCOPY library scripts sh tmp library scripts RUN bash tmp library scripts common debian sh INSTALL ZSH USERNAME USER UID USER GID UPGRADE PACKAGES true true cd into the user directory download and unzip the Azure DevOps agentRUN cd home vscode amp amp mkdir azure pipelines amp amp cd azure pipelines input Azure DevOps agent argumentsARG ARCH x ARG AGENT VERSION RUN cd home vscode azure pipelines amp amp curl O L AGENT VERSION vsts agent linux ARCH AGENT VERSION tar gz amp amp tar xzf home vscode azure pipelines vsts agent linux ARCH AGENT VERSION tar gz amp amp home vscode azure pipelines bin installdependencies sh copy over the start sh scriptCOPY library scripts start sh home vscode azure pipelines start sh Apply ownership of home folderRUN chown R vscode vscode make the script executableRUN chmod x home vscode azure pipelines start sh Clean upRUN rm rf var lib apt lists tmp library scriptsThen create a devcontainer json file See my previous blog post on how this file can be amended with additional features and extensions name AzurePipelines dockerFile Dockerfile Configure tool specific properties customizations Configure properties specific to VS Code vscode Add the IDs of extensions you want installed when the container is created extensions ms vscode azurecli ms vscode powershell hashicorp terraform esbenp prettier vscode tfsec tfsec Use forwardPorts to make a list of ports inside the container available locally forwardPorts Use postStartCommand to run commands each time the container is successfully started postStartCommand home vscode azure pipelines start sh Comment out to connect as root instead More info remoteUser vscode Amend Azure Pipelines agent version and arch type with ARCH and AGENT VERSION build args UPGRADE PACKAGES true ARCH x AGENT VERSION features terraform latest azure cli latest git lfs latest github cli latest powershell latest NOTE You can amend the ADO Pipelines agent version and architecture by amending the build args attributes ARCH and AGENT VERSION Amend Azure Pipelines agent version and arch type with ARCH and AGENT VERSION build args UPGRADE PACKAGES true ARCH x AGENT VERSION Next we will create a folder with a few scripts that will be used by our docker image Create a folder called library scripts and place the following two script inside start sh and common debian sh Let s take a closer look at each of the scripts common debian sh This script will install additional debian based tooling onto the dev container start sh start sh bin bash Pulled from GitHub Codespace secretsADO ORG ADO ORGADO PAT ADO PATADO POOL NAME ADO POOL NAME Derived environment variablesHOSTNAME hostname AGENT SUFFIX ADO agent AGENT NAME HOSTNAME AGENT SUFFIX ADO URL ADO ORG Ignore sensitive tokens from capabilities export VSO AGENT IGNORE ADO PAT GH TOKEN GITHUB CODESPACE TOKEN GITHUB TOKEN home vscode azure pipelines config sh unattended agent AGENT NAME url ADO URL auth PAT token ADO PAT pool ADO POOL NAME acceptTeeEula home vscode azure pipelines run shThe second script will start up with the Codespace Dev container and bootstraps the ADO Pipeline agent when the Codespace starts Notice that we need to provide the script with some parameters Pulled from GitHub Codespace secretsADO ORG ADO ORGADO PAT ADO PATADO POOL NAME ADO POOL NAMEThese parameters environment variables are used to configure and register the self hosted agent against the Azure DevOps Project agent pool we created earlier NOTE You can store sensitive information such as tokens that you want to access in your codespaces via environment variables We already configured this earlier but for more information see secrets for codespaces Deploying the CodespaceAs you can see in the screenshot below my Azure DevOps project does not have any self hosted agents configured on the agent pool Navigate to your repository click on the lt gt Code dropdown and select the Codespaces tab select the Advanced option to Configure and create codespace Select the relevant Branch Region Machine type and for the Dev container configuration select the codespaceADOagent config we created and click on Createcodespace It takes a few minutes to build and start the container but you can view the logs whilst the codespace is provisioning in real time To speed up codespace creation repository administrators can enable Codespaces prebuilds for a repository For more information see About GitHub Codespaces prebuilds Once the codespace is provisioned you can see the hostname of the underlying compute by typing in the terminal hostname Navigate to your Azure Devops agent pool and under the Agents tab notice that there is now a self hosted Azure Pipelines agent registered that matches the Codepsace hostname Managing Codespace Azure Pipelines lifecycleWhen you stop your codepsace the self hosted agent will not be removed but will only go into an Offline state and when you start the codespace up again the Azure Pipeline agent will be available again Also as mentioned by default any Active codespaces that are not stopped manually will be idle and go into a hibernation mode after minutes to save on compute costs Let s take a look at how we can amend codespaces lifecycle In the upper right corner of any page click your profile photo then click Settings and in the Code planning and automation section of the sidebar click Codespaces Under Default idle timeout enter the time that you want then click Save The time must be between minutes and minutes hours ConclusionAs you can see it is pretty easy to run self hosted Azure Pipeline agents inside of your Codespace and utilize the compute power of the dev container itself By doing this we can solve a few problems with one solution Cost Not wasting cost and compute power by adding compute separately for self hosted DevOps agents alongside Codespaces Administration Having both services running on the same compute and sharing the same configuration and tooling saves time on administration and maintenance Availability Having self hosted DevOps agents available as part of the running codespace IMPORTANT Do note that making use of Demands is very important when triggring running pipelines against DevOps Pipeline agents on a Codespace to make sure you are running your pipelines against the correct codespace agent ExampleDemands and capabilities are designed for use with self hosted agents so that jobs can be matched with an agent that meets the requirements of the job If you have multiple agents with different users and Codespaces in the same pool you may want to run your pipelines against specific codespaces using demands for example pool name MyPool demands GITHUB USER equals Pwd ML equals check for GitHub user HOSTNAME equals codespaces def equals check for hostname matching my CodespaceBy using Demands you can ensure that your pipelines will run against the intended Codespace You can check your agent capabilities to use in demands by navigating and click on your DevOps agent Then select the Capabilities tab I hope you have enjoyed this post and have learned something new You can also find the code samples used in this blog post on my published Github page ️ AuthorLike share follow me on GitHub Twitter LinkedIn Marcel LFollow Microsoft DevOps MVP Cloud Solutions amp DevOps Architect Technical speaker focused on Microsoft technologies IaC and automation in Azure Find me on GitHub |
2022-08-18 17:15:09 |
海外TECH |
DEV Community |
I have designed and developed the simplest document scanner app. |
https://dev.to/marianvelani/i-have-designed-and-developed-the-simplest-document-scanner-app-56k3
|
I have designed and developed the simplest document scanner app Go to Playstore•Auto crop to pdf•Magic Filters •Compress•Rearrange page sequence •Replace and retake page•Add from gallery simultaneously •Save as image or Pdf•QR code scanner •UPI Code support•QR code Creator •Barcode scanner •Pdf viewer with night mode•Reading mode•Night Mode•Simple and beautifulGET APP |
2022-08-18 17:06:06 |
Apple |
AppleInsider - Frontpage News |
Apple Card issuer Goldman Sachs ranks first in credit card satisfaction survey |
https://appleinsider.com/articles/22/08/18/apple-card-issuer-goldman-sachs-ranks-first-in-credit-card-satisfaction-survey?utm_medium=rss
|
Apple Card issuer Goldman Sachs ranks first in credit card satisfaction surveyGoldman Sachs Apple s financial partner and issuer of the Apple Card has ranked first in customer satisfaction in a J D Power survey for the second year in a row Apple CardAmong midsize issuers Goldman Sachs topped the charts with a customer satisfaction rating of in the J D Power U S Credit Card Satisfaction Study Apple touted in a press release on Thursday Goldman Sachs also ranked first in in the same survey Read more |
2022-08-18 17:19:38 |
海外TECH |
Engadget |
Snap reportedly gives up on its selfie drone just four months after its debut |
https://www.engadget.com/snap-pixy-selfie-drone-development-end-172809304.html?src=rss
|
Snap reportedly gives up on its selfie drone just four months after its debutIt s been less than four months since Snap unveiled a selfie drone called Pixy but it seems the company is already giving up on the device CEO Evan Spiegel told employees that Snap is halting further work on Pixy amid a reprioritization of resources according to The Wall Street Journal The drone can take off from and land in your hand It has four preset flight paths and can capture photos and videos that you can transfer to and share on Snapchat For now at least Pixy is still available to buy from Snap s website The Journal suggests Snap will keep selling Pixy for the time being Engadget has asked Snap for comment Like many other companies Snap has been feeling the brunt of a broader economic slowdown In July it posted its weakest quarterly sales growth to date which sunk its share price by around percent Snap s stock has fallen by around percent over the last year The company also said last month that it would significantly slow down hiring Several major tech companies have been shifting priorities in recent months Meta for instance reportedly shelved plans for a smartwatch with two cameras and it s said to be refocusing Portal devices as enterprise products Others have slowed downhiring plans and laidoffemployees |
2022-08-18 17:28:09 |
金融 |
金融庁ホームページ |
つみたてNISA対象商品届出一覧について更新しました。 |
https://www.fsa.go.jp/policy/nisa2/about/tsumitate/target/index.html
|
対象商品 |
2022-08-18 17:50:00 |
ニュース |
BBC News - Home |
Five key takeaways from this year's A-level results |
https://www.bbc.co.uk/news/education-62519873?at_medium=RSS&at_campaign=KARANGA
|
covid |
2022-08-18 17:34:10 |
ニュース |
BBC News - Home |
Rishi Sunak: I can still win Tory leadership race |
https://www.bbc.co.uk/news/uk-politics-62591870?at_medium=RSS&at_campaign=KARANGA
|
clear |
2022-08-18 17:47:21 |
ニュース |
BBC News - Home |
US World War One wreck found by divers off Cornwall |
https://www.bbc.co.uk/news/uk-england-cornwall-62597453?at_medium=RSS&at_campaign=KARANGA
|
jacob |
2022-08-18 17:30:39 |
ニュース |
BBC News - Home |
Anteater rescued from wildfire by Bolivian firefighters |
https://www.bbc.co.uk/news/world-latin-america-62598381?at_medium=RSS&at_campaign=KARANGA
|
bolivian |
2022-08-18 17:27:48 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【精神科医が教える】「失敗を繰り返してしまう人」に共通する“心のクセ”とは? - こころの葛藤はすべて私の味方だ。 |
https://diamond.jp/articles/-/308091
|
精神科医 |
2022-08-19 02:55:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【『徹子の部屋』で話題】 アメリカの小学生が学んでいる作文の方法で 会社員の“プレゼン能力”がみるみる高まる! - 私がハーバードで学んだ世界最高の「考える力」 |
https://diamond.jp/articles/-/307785
|
【『徹子の部屋』で話題】アメリカの小学生が学んでいる作文の方法で会社員の“プレゼン能力がみるみる高まる私がハーバードで学んだ世界最高の「考える力」大分県で生まれ育ち、小・中・高と地元の公立校、塾通いも海外留学経験もないまま、ハーバード大学に現役合格した『私がハーバードで学んだ世界最高の「考える力」』の著者・廣津留すみれさん。 |
2022-08-19 02:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【ご神仏に愛される人】嫌いな人、イヤな気分になったことを考えて憂鬱な時にはご神仏の名前を唱えるといい、納得の理由とは - 神さま仏さまがこっそり教えてくれたこと |
https://diamond.jp/articles/-/307974
|
神さま仏さま |
2022-08-19 02:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「才能が伸びる子」の親がしている1つの習慣【書籍オンライン編集部セレクション】 - 子育てベスト100 |
https://diamond.jp/articles/-/307965
|
加藤紀子 |
2022-08-19 02:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「月400万円払うから、あなたのブログに広告を載せたい」ブログこそ最強の副業である - ブログで5億円稼いだ方法 |
https://diamond.jp/articles/-/308237
|
理由 |
2022-08-19 02:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
豪、ガス輸出規制を検討 世界需給さらに逼迫も - WSJ発 |
https://diamond.jp/articles/-/308307
|
輸出規制 |
2022-08-19 02:03:00 |
コメント
コメントを投稿