IT |
気になる、記になる… |
Nothingの新型ワイヤレスイヤホン「ear (stick)」、充電ケースだけでなくイヤホン本体も新しくなっていることが判明 |
https://taisy0.com/2022/09/23/162586.html
|
earstic |
2022-09-23 14:23:05 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Python(Django)でSNSアプリケーションの開発Part1 ~サイト全体像と環境構築~ |
https://qiita.com/Taku_nakahara/items/50ee5d98a7e86fcd8475
|
django |
2022-09-23 23:47:56 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
connpassイベントの人気ランキングを閲覧できるサイトをstreamlitで実装してみた |
https://qiita.com/UT_BackendEngineer/items/24457ab85e7fe7d444dd
|
connpassap |
2022-09-23 23:43:15 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
[python] 複雑なエクセルデータをpandasで処理する。 |
https://qiita.com/junzai/items/fd626f8a71a15cabd91a
|
pandas |
2022-09-23 23:35:56 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
paizaラーニング レベルアップ問題集 ソートメニュー応用編 JavaScript ソートによる高速化まとめ |
https://qiita.com/ZampieriIsa/items/05b291663d04fa2469f3
|
javascript |
2022-09-23 23:17:33 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Python(Django)でSNSアプリケーションの開発Part1 ~サイト全体像と環境構築~ |
https://qiita.com/Taku_nakahara/items/50ee5d98a7e86fcd8475
|
django |
2022-09-23 23:47:56 |
技術ブログ |
Developers.IO |
ダミーのデータを返すREST APIをAPI GatewayのMock Integrationで作ってテストで使う |
https://dev.classmethod.jp/articles/create-a-rest-api-that-returns-dummy-data-with-api-gateways-mock-integration-and-use-it-for-testing/
|
apigateway |
2022-09-23 14:49:33 |
海外TECH |
DEV Community |
Build a custom Go linter in 5 minutes |
https://dev.to/geoffreycopin/build-a-custom-go-linter-in-5-minutes-mh9
|
Build a custom Go linter in minutesCreating a custom linter can be a great way to enforce coding standards and detect code smells In this tutorial we ll use Sylver s a source code query engine to build a custom Golang linter in just a few lines of code Sylver s main interface is a REPL console in which we can load the source code of our project to query it using a SQL like query language called SYLQ Once we ll have authored SYLQ queries expressing our linting rules we ll be able to save them into a ruleset that can be run like a traditional linter InstallationIf sylver version doesn t output a version number gt go to to download a fresh copy of the software Starting the REPLStarting the REPL is as simple as invoking the following command at the root of your project sylver query files go spec golang yamlThe REPL can be exited by pressing Ctrl C or typing quit at the prompt We can now execute SYLQ queries by typing the code of the query followed by a For instance to retrieve all the struct declarations match StructType The results of the query will be formatted as follow StructType association go StructType schema index go StructType schema index go StructType tests group by test go StructType schema check go The code of a given struct declaration can be displayed by typing print followed by the node alias for instance print The parse tree can be displayed using the print ast command for instance print ast Rule detect struct declarations with too many fieldsFor our first rule we d like to flag struct declarations that have more than fields The first step is to get familiar with the tree structure of struct declarations so let s print a StructType along with its ast λ gt print struct Name string Total int λ gt print ast StructType fields List lt FieldSpec gt FieldSpec names List lt Identifier gt Identifier Name type TypeIdent name Identifier string FieldSpec names List lt Identifier gt Identifier Total type TypeIdent name Identifier int The fields of the struct are stored in a field aptly named fields that holds a list of FieldSpec nodes This means that the nodes violating our rule are all the StructType nodes for which the fields list has a length higher than This can be easily expressed in SYLQ match StructType s when s fields length gt Rule suggest the usage of assignment operatorsFor our second linting rule we d like to identify assignments that could be simplified by using an assignment operator like such as x x Let s explore the parse tree of a simple assignment λ gt print err nilλ gt print ast AssignStmt lhs List lt Expr gt Identifier err rhs List lt Expr gt NilLit nil So we want to retrieve the AssignStmt nodes for which the rhs field contains a Binop that has lhs as its left operand Also the left hand side of the assignment must contain a single expression This can be written as match AssignStmt a when a lhs length amp amp a rhs is BinOp b when b left text a lhs text Rule incorrect usage of the make builtin functionFor our last linting rule we want to identify incorrect usage of the make function where the length is higher than the capacity as this probably indicates a programming error Here is the parse tree of a call to make λ gt print make string len value λ gt print ast CallExpr fun Identifier make args List lt GoNode gt SliceType elemsType TypeIdent name Identifier string IntLit CallExpr fun Identifier len args List lt GoNode gt Identifier value Here are the conditions that violating nodes will meet The test of fun is makeThe args list contains elementsThe last two arguments are int literalsThe third argument capacity is smaller than the second length Let s encode this in SYLQ match CallExpr c when c fun text make amp amp c args length amp amp c args is IntLit amp amp c args is IntLit amp amp c args text to int lt c args text to int Creating the rulesetThe following ruleset uses our linting rules id customLinterlanguage golang yaml rules id largeStruct message struct has many fields severity info query match StructType s when s fields length gt id assignOp message assignment should use an assignment operator severity warning note According to our style guide assignment operators should be preferred query gt match AssignStmt a when a lhs length amp amp a rhs is BinOp b when b left text a lhs text id makeCapacityErr message capacity should be higher than length severity error query gt match CallExpr c when c fun text make amp amp c args length amp amp c args is IntLit amp amp c args is IntLit amp amp c args text to int lt c args text to int Assuming that it is stored in a file called custom linter yaml at the root of our project we can run it with the following command sylver ruleset run files go rulesets custom linter yaml |
2022-09-23 14:37:29 |
海外TECH |
DEV Community |
Production Ready GraphQL for AWS & Serverless |
https://dev.to/roman_abdulmanov/production-ready-graphql-for-aws-serverless-54be
|
Production Ready GraphQL for AWS amp Serverless What is this post about Many articles have been written on implementing a serverless GraphQL API using AWS But there is almost nothing about how to make it production ready for websites This article will also be valid for API Gateway ToolsYou can use different tools AWS SAM Serverless Framework Pulumi Terraform pure AWS CDK or something else Ultimately it s not all that important The main thing is that you do it not manually Everything must be automated for repeatability Otherwise you won t be able to build a reliable CI CD process I like this plugin that will make your life easier It will help you set up AppSync manage API keys configure WAF etc Typical architectureMost articles end up with a below architecture service or website that directly calls the AppSync API The downside of this solution is that the API is susceptible to DDoS attacks which can significantly increase your monthly bills Improved architectureThe obvious solution is to add a firewall with request limiting It will also help if you want to block GraphQL introspection And this could be the end but this solution has one unpleasant flaw for websites preflight request Preflight requestSince your site and API are on different domains the browser will make additional request to the server BEFORE any other requests This may come as an unexpected surprise since the initial request can take almost twice as long Example Details additional milliseconds to wait for the request to complete As I already wrote since your domain is hosted on mydomain com and the API is on https ID appsync api REGION amazonaws com the browser will attempt to do additional validation for CORS by sending this request before the first call to the domain hosting the API The browser caches this request for a while but if this is a public page and many people visit this site for the first time then they will experience this problem It also starts repeating after some time when the cache expires Potential solution №The first thing that comes to mind if you are unfamiliar with preflight requests is that they can probably be disabled if the backend sets some header Unfortunately this is not possible Potential solution №Maybe I can use a simple request to workaround this restriction This will not work if you have non standard headers e g Authorization you will also have to set the wrong content type Even if it works this does not look like a production ready solution and can be blocked by AWS browsers anytime Potential solution №You can try to use iframe technique but it will not work for non subdomain urls we will talk about this later and it will make the loading even slower because instead of a very fast request you will have slow iframe loading Potential solution №Can I use custom domains Unfortunately this is not possible too You can t use the same domain for API e g just mydomain com It will work only with sub domain e g api mydomain com Browsers check for the same URL origin so you can t use anything other than mydomain com something SolutionIf we are talking about AWS and Serverless the most affordable solution is to use AWS CloudFront We can create two behaviors and redirect traffic to the correct Origin depending on the path pattern For this to work CloudFront must have the correct certificates configured to accept requests using your DNS name This solution will solve the original problem there are no more preflight requests or some kind of hacks The edge location of the servers would be an additional bonus Which will reduce the connection time of clients with the endpoint The additional configuration of CloudFront Origin Shield will allow you to speed up traffic to AppSync or other service by using an internal faster network Caveat №We have implemented this architecture Since WAF works based on the IP address of the caller it will not be the client s address but CloudFront s Therefore the request limit can be hit much faster and affect all users in the same location To solve this we can use the X Forwarded For header to receive client IPs from CloudFront But this will make our AppSync API insecure and if someone finds out the unique address of our endpoint they can attack through it Therefore it is more reliable to make two firewalls Migrate the old one to handle requests in front of CloudFront And make a new one between CloudFront and AppSync that will prohibit all requests not from CloudFront make it directly inaccessible To set up New WAF you can deny all requests by default and allow only those that contain some secret header with a value that is configured on CloudFront WAF documentation for details CloudFormation Rules name Secret action Allow priority statement byteMatchStatement searchString secret fieldToMatch singleHeader name Secret textTransformations priority type NONE positionalConstraint EXACTLY Caveat №You should use the default сache policy see below even if you don t cache anything POST requests are never cached Because if you disable it request compression will not work Caveat №If you have more than one endpoint you will not be able to set up a redirect because you cannot have two identical path patterns graphql To resolve this you can use some unique paths and setup CloudFront functions to redirect requests to the correct path for the Origin CloudFormation CloudFrontGraphQLFunction Type AWS CloudFront Function Properties Name self provider stackName graphql redirect AutoPublish true FunctionCode Sub function handler event var request event request request uri graphql return request FunctionConfig Runtime cloudfront js Caveat №When developing locally you may have problems with the frontend and CORS This is because the first response of the preflight request from localhost to the API does not contain all the required headers even if you set the appropriate policy CloudFront will add access control allow origin but Chrome also needs headers and methods To avoid the need to use additional extensions like this You can configure additional headers using the CloudFront function CloudFrontGraphQLCorsFunction Type AWS CloudFront Function Properties Name self provider stackName graphql cors AutoPublish true FunctionCode Sub function handler event var response event response var headers response headers headers access control allow origin value headers access control allow headers value headers access control allow methods value return response FunctionConfig Runtime cloudfront js ConclusionThis approach should work not only with AppSync but also with other services such as API Gateway If you have any questions please write and I will gladly try to answer Thanks |
2022-09-23 14:06:58 |
Apple |
AppleInsider - Frontpage News |
How to use the Depth app on Apple Watch Ultra |
https://appleinsider.com/inside/apple-watch-ultra/tips/how-to-use-the-depth-app-on-apple-watch-ultra?utm_medium=rss
|
How to use the Depth app on Apple Watch UltraThe Apple Watch Ultra comes with an exclusive Depth app for underwater recreational activities such as snorkeling Here s how to use it Inside the Depth app on Apple Watch UltraApple s support page cautions that the Depth app is not a dive computer It doesn t provide decompression stop information gas analysis or other data scuba divers need Read more |
2022-09-23 14:38:02 |
海外TECH |
CodeProject Latest Articles |
Get AWS CloudWatch log group with PowerShell Core |
https://www.codeproject.com/Articles/5342925/Get-AWS-CloudWatch-log-group-with-PowerShell-Core
|
Get AWS CloudWatch log group with PowerShell CoreThe post describes functions which manipulate CloudWatch log group by PowerShell Core with AWS CLI v Read More Get AWS CloudWatch log group with PowerShell Core |
2022-09-23 14:20:00 |
海外科学 |
NYT > Science |
3 Chimpanzees Kidnapped for Ransom From Congo Sanctuary |
https://www.nytimes.com/2022/09/23/science/chimps-kidnapping-congo.html
|
Chimpanzees Kidnapped for Ransom From Congo SanctuaryIn a country where wildlife trafficking already runs rampant conservationists fear that ransoming of animals may become a common tactic used by criminals |
2022-09-23 14:35:21 |
ニュース |
BBC News - Home |
Chancellor Kwasi Kwarteng hails 'new era' as he unveils tax cuts |
https://www.bbc.co.uk/news/uk-politics-63005302?at_medium=RSS&at_campaign=KARANGA
|
announces |
2022-09-23 14:31:43 |
ニュース |
BBC News - Home |
Pound sinks as investors question huge tax cuts |
https://www.bbc.co.uk/news/business-63009173?at_medium=RSS&at_campaign=KARANGA
|
finances |
2022-09-23 14:17:05 |
ニュース |
BBC News - Home |
Ronaldo charged by FA over fan phone incident |
https://www.bbc.co.uk/sport/football/63012264?at_medium=RSS&at_campaign=KARANGA
|
Ronaldo charged by FA over fan phone incidentManchester United forward Cristiano Ronaldo is charged by the Football Association over footage which appeared to show him knocking a phone out of a fan s hand |
2022-09-23 14:22:13 |
ニュース |
BBC News - Home |
Molly Russell inquest: Instagram clips seen by teen 'most distressing' |
https://www.bbc.co.uk/news/uk-england-london-62998484?at_medium=RSS&at_campaign=KARANGA
|
distressing |
2022-09-23 14:11:33 |
ニュース |
BBC News - Home |
Dame Vera Baird: Victims' champion resigns, claiming her role was sidelined |
https://www.bbc.co.uk/news/uk-63009853?at_medium=RSS&at_campaign=KARANGA
|
needs |
2022-09-23 14:10:32 |
ニュース |
BBC News - Home |
Woman jailed for dark web hitman murder plot |
https://www.bbc.co.uk/news/uk-england-beds-bucks-herts-63010910?at_medium=RSS&at_campaign=KARANGA
|
franks |
2022-09-23 14:26:06 |
ニュース |
BBC News - Home |
'We'll be lucky to keep our heads above water' |
https://www.bbc.co.uk/news/business-63007990?at_medium=RSS&at_campaign=KARANGA
|
budget |
2022-09-23 14:11:58 |
北海道 |
北海道新聞 |
田中、女子1500メートルV 全日本実業団陸上第1日 |
https://www.hokkaido-np.co.jp/article/735482/
|
長良川競技場 |
2022-09-23 23:21:00 |
北海道 |
北海道新聞 |
故郷追われる悲哀伝える 「クナシリ」続編、根室で撮影 監督「元島民、自分に重なる」 |
https://www.hokkaido-np.co.jp/article/735481/
|
撮影監督 |
2022-09-23 23:19:00 |
北海道 |
北海道新聞 |
中日の福留「僕は幸せ者」 日米24年目、本拠地で別れ |
https://www.hokkaido-np.co.jp/article/735480/
|
福留孝介 |
2022-09-23 23:17:00 |
北海道 |
北海道新聞 |
斎藤佑樹さん、ドームで写真展開催 24日から |
https://www.hokkaido-np.co.jp/article/735479/
|
斎藤佑樹 |
2022-09-23 23:12:00 |
北海道 |
北海道新聞 |
日本ハム「足」の五十幡が復帰(23日) |
https://www.hokkaido-np.co.jp/article/735476/
|
日本ハム |
2022-09-23 23:06:00 |
コメント
コメントを投稿