並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 25 件 / 25件

新着順 人気順

if elif else statement in pythonの検索結果1 - 25 件 / 25件

  • 大実験!ChatGPTは競プロの問題を解けるのか (2024年5月版) - E869120's Blog

    1. はじめに 2024 年 5 月 14 日、OpenAI 社から新たな生成 AI「GPT-4o」が発表され、世界に大きな衝撃を与えました。これまでの GPT-4 よりも性能を向上させただけでなく1、音声や画像のリアルタイム処理も実現し、さらに応答速度が大幅に速くなりました。「ついにシンギュラリティが来てしまったか」「まるで SF の世界を生きているような感覚だ」という感想も見受けられました。 しかし、いくら生成 AI とはいえ、競技プログラミングの問題を解くのは非常に難しいです。なぜなら競技プログラミングでは、問題文を理解する能力、プログラムを実装する能力だけでなく、より速く答えを求められる解法 (アルゴリズム) を考える能力も要求されるからです。もし ChatGPT が競技プログラミングを出来るようになれば他のあらゆるタスクをこなせるだろう、と考える人もいます。 それでは、現代最強の

      大実験!ChatGPTは競プロの問題を解けるのか (2024年5月版) - E869120's Blog
    • ソースコード & ドキュメントに対応したGraph RAGの実装(Tree-sitter + LightRAG)

      (module (function_definition (identifier) # ← ここに関数名「sample_func」が含まれます (parameters) (block (expression_statement (call (identifier) (argument_list (string)))))) (expression_statement (call (identifier) (argument_list)))) ノードが色々取れましたが、「function_definition」が関数、その子である「identifier」が関数名を表すため、 function_definition == 子ノード ==> identifier となっている箇所を探索すれば抽出できます(関数ではあっても「lambda」など異なる場合もあります)。 今回は上記のようにTree-si

        ソースコード & ドキュメントに対応したGraph RAGの実装(Tree-sitter + LightRAG)
      • Writing a C compiler in 500 lines of Python

        A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python1, after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog

        • Ruby Parser開発日誌 (1) - かねこにっき

          Error Tolerant parserに関するアイデア 9月半ばに行われたRubyKaigi 2022以来、3ヶ月くらいError Tolerant parserについて調べたり考えたり実装をしたりしています。 途中でもいいからなにかにアウトプットしておくとよいというアドバイスをもらったので、今現在の状況や考えていることを書いておこうと思います。 Error Tolerant parserとは? どうしてそれが欲しいの? 通常parserはユーザーの入力を受け取り その入力がそのプログラミング言語にとって、validなものか否かをチェック validな場合、その後の工程にとって都合のいいデータ構造(例えばAST)に変換し、後工程に渡す invalidな場合、Syntax Errorをレポートする といった処理を行います。 しかしIDEやLSP(Language Server Proto

            Ruby Parser開発日誌 (1) - かねこにっき
          • Amazon SESとAmazon Bedrockで問い合わせメールの一次対応を自動化する | DevelopersIO

            「メールでのやり取りなんてレガシーだよね」? いえいえ、生成AIを使えばまだまだ可能性が見えてきます。 みなさん、こんにちは! 福岡オフィスの青柳です。 みなさん、生成AIを使って業務改善してますか? (挨拶) 今回は、「改善したい業務」の上位にランクインしているであろう (俺調べ) 「問い合わせメール対応」を、生成AIを使って自動化・効率化してみたいと思います。 やりたいこと 「問い合わせメール」の対応窓口が抱える課題 利用者から問い合わせを受けた際、なるべく早く「あなたの問い合わせを認識していますよ」という点を利用者に知らせてあげると、利用者は安心しますし、問い合わせ窓口に対する信頼感も向上すると思います。 そのため、問い合わせ窓口では「できるだけ早く一次応答を返す」ことを目標にしている場合も多いかと思います。 しかし、多忙なサポート担当者にとっては様々な対応に追われて、どうしても一次

              Amazon SESとAmazon Bedrockで問い合わせメールの一次対応を自動化する | DevelopersIO
            • Python 3.13 gets a JIT

              Happy New Year everyone! In late December 2023 (Christmas Day to be precise), CPython core developer Brandt Bucher submitted a little pull-request to the Python 3.13 branch adding a JIT compiler. This change, once accepted would be one of the biggest changes to the CPython Interpreter since the Specializing Adaptive Interpreter added in Python 3.11 (which was also from Brandt along with Mark Shann

                Python 3.13 gets a JIT
              • 4 Pandas Anti-Patterns to Avoid and How to Fix Them

                pandas is a powerful data analysis library with a rich API that offers multiple ways to perform any given data manipulation task. Some of these approaches are better than others, and pandas users often learn suboptimal coding practices that become their default workflows. This post highlights four common pandas anti-patterns and outlines a complementary set of techniques that you should use instea

                  4 Pandas Anti-Patterns to Avoid and How to Fix Them
                • Implementing Logic Programming

                  Most of my readers are probably familiar with procedural programming, object-oriented programming (OOP), and functional programming (FP). The majority of top programming languages on all of the language popularity charts (like TIOBE) support all three to some extent. Even if a programmer avoided one or more of those three paradigms like the plague, they’re likely at least aware of them and what th

                    Implementing Logic Programming
                  • Building a Toy Programming Language in Python

                    I thought it would be fun to go outside of my comfort zone of web development topics and write about something completely different and new, something I have never written about before. So today, I'm going to show you how to implement a programming language! The project will parse and execute programs written in a simple language I called my (I know it's a lame name, but hey, it is "my" language).

                      Building a Toy Programming Language in Python
                    • カスタムリソースでAWS IAM Access Analyzerのアーカイブルールを自動で適用してみる - NRIネットコムBlog

                      本記事は AWSアワード受賞者祭り 17日目の記事です。 ✨🏆 16日目 ▶▶ 本記事 ▶▶ 18日目 🏆✨ はじめに アーカイブルールとは アーカイブルール概要 アーカイブルールを作成しても既存の結果には適用されない カスタムリソースによるアーカイブルールの適用 カスタムリソースとは カスタムリソースの実行タイミング CloudFormationに対してレスポンスが必要 テンプレート CloudFormationテンプレート ダミーパラメータを設定する ServiceTimeoutを利用する カスタムリソースのLambda関数のコード デプロイ手順 終わりに はじめに こんにちは、藤本です。 この度、「2025 Japan AWS Jr. Champions」、「2025 Japan All AWS Certifications Engineers」に選出いただきました。 「2025

                        カスタムリソースでAWS IAM Access Analyzerのアーカイブルールを自動で適用してみる - NRIネットコムBlog
                      • SESでバウンスメールを確認する方法をいくつか試してみた | DevelopersIO

                        こんにちは、コンサル部@大阪オフィスのTodaです。 Amazon Simple Email Service(以降SES)は任意のアプリケーションからメール配信をする際、おすすめのサービスになります。 メール配信はエンドユーザ様から指定頂いた、メールアドレスに対しておこないますが、入力ミスによる受信失敗(バウンスメール)、迷惑メール報告(苦情メール)が発生する場合があり管理が必要になります。 今回は、簡易に運営者側でバウンスメールに気づける方法を試してみます。 バウンスメール対策の重要性 SESではサービスを利用して送信したメールの中でバウンスメールと苦情メールの計測をしており、一定以上になった場合、レビュー対象や配信の停止がおこなわれます。処理を維持をするためバウンスメールの対応が必要になります。 ■ バウンスに関するよくある質問 から引用 https://docs.aws.amazon

                          SESでバウンスメールを確認する方法をいくつか試してみた | DevelopersIO
                        • Rust on MIPS64 Windows NT 4.0

                          Introduction Some part of me has always been fascinated with coercing code to run in weird places. I scratch this itch a lot with my security research projects. These often lead me to writing shellcode to run in kernels or embedded hardware, sometimes with the only way being through an existing bug. For those not familiar, shellcode is honestly hard to describe. I don’t know if there’s a very form

                            Rust on MIPS64 Windows NT 4.0
                          • AWS公式のECSハンズオンがとても良かった!! - Qiita

                            はじめに お疲れ様です。矢儀 @yuki_ink です。 こちらのAWS公式ハンズオンをやってみました。 ECSとFargate/EC2を利用した環境構築から、CI/CDパイプラインを利用したデプロイまで、一通り体験できる素晴らしいハンズオンでした。 次のようなみなさんにおすすめです。 ECSを知識として知ってはいるが、実際に触ったことがない コンテナの何が優れているのか、実感を持っては理解できない CI/CDパイプラインでコンテナをデプロイしてみたい ハンズオンで構築する環境の構成イメージはこちら。 1. VS Code Serverの構築 このハンズオンでは、開発環境として Visual Studio Code Server (VS Code Server) を利用するとのことで、まず、CloudFormationでVS Code Serverを構築していきます。 ハンズオンページの

                              AWS公式のECSハンズオンがとても良かった!! - Qiita
                            • Vim9 script for Python Developers · GitHub

                              vim9script4pythondevelopers.md Vim9 script for Python Developers Vim9 script�Vim script��������������������������������������������������系��� def������義����������Vim script��vim9script�����使����������(vim9script���

                                Vim9 script for Python Developers · GitHub
                              • Python behind the scenes #11: how the Python import system works

                                If you ask me to name the most misunderstood aspect of Python, I will answer without a second thought: the Python import system. Just remember how many times you used relative imports and got something like ImportError: attempted relative import with no known parent package; or tried to figure out how to structure a project so that all the imports work correctly; or hacked sys.path when you couldn

                                • Introducing Amazon Kinesis Data Analytics Studio – Quickly Interact with Streaming Data Using SQL, Python, or Scala | Amazon Web Services

                                  AWS News Blog Introducing Amazon Kinesis Data Analytics Studio – Quickly Interact with Streaming Data Using SQL, Python, or Scala The best way to get timely insights and react quickly to new information you receive from your business and your applications is to analyze streaming data. This is data that must usually be processed sequentially and incrementally on a record-by-record basis or over sli

                                    Introducing Amazon Kinesis Data Analytics Studio – Quickly Interact with Streaming Data Using SQL, Python, or Scala | Amazon Web Services
                                  • ブラックジャックを完璧にプレーイングするPythonプログラムを組んで、儲けることができるか検証した結果 - Qiita

                                    連続スプリット ブラックジャックではたまに連続で同じ数字が来ることがあります。そして数字によっては連続でスプリットをするべき場面があります。例えば2枚とも8だった場合は絶対にスプリットを選ぶべきですが、もし独立した手にまた8が来てしまったらさらにスプリットをして、保有している手を3つにするといった場面が発生することがあります。著者も一度連続でエースが4回来て、連続スプリットで自分の目の前に4つの手があったときはパニクりました。なんせ最初の掛け金の4倍をかけたことになり、勝てば一攫千金、負ければ大損をしてしまうからです。結果はご想像にお任せします。 こちらも最初どのように実装するべきか悩みましたが、2次元配列に新しくその数字を要素として追加し、元の配列ではその数字を消せばいいだけでした。 if地獄 ゲームをしっかり実装できたところで、次は上の図のベーシックストラテジーチャートの動きをなぞるコ

                                      ブラックジャックを完璧にプレーイングするPythonプログラムを組んで、儲けることができるか検証した結果 - Qiita
                                    • Amazon Inspectorの検出結果をリソース単位でまとめてメール通知する方法 | DevelopersIO

                                      はじめに 以前、Amazon Inspectorの検出結果をAWS Security Hubを経由してメール通知する方法をご紹介しました。 Inspectorは脆弱性を検出するたびに結果を作成するため、1つのリソースに対して複数の脆弱性が見つかった場合、その数だけメール通知が発生してしまいます。例えば、100個の脆弱性が検出されると、100通のメールが送信される状況でした。 本記事では、脆弱性ごとの通知ではなく、1リソースごとに検出結果をまとめて1回の通知で済ませる方法をご紹介します。 構成は以下のとおりです。 本実装は、以下の流れで処理を行います。 Inspectorで検出結果が作成され、Security Hub経由でEventBridgeが起動します。 Firehose ストリームに検出結果が一時保存されます。 Firehose ストリームは、指定したバッファ期間内に受信したイベントを

                                        Amazon Inspectorの検出結果をリソース単位でまとめてメール通知する方法 | DevelopersIO
                                      • OracleのSQLをそのままBigQueryで動かしたいんですよ、絶対に。 - エムスリーテックブログ

                                        【Unit4 ブログリレー9日目】 何言ってるんですかね。でも、見てみたいかも。こんにちは、エムスリーエンジニアリンググループの福林 (@fukubaya) です。 OracleのSQLに手を加えることなくBigQueryで実行させたいことってよくありますよね(ない)。今回はその手法を紹介します。 渋谷公会堂は、東京都渋谷区宇田川町にある公会堂。本文には関係ありません。 帳票環境のBigQuery移行とチーム横断での取り組み なぜSQL変換が必要なのか - bashを駆使してSQLを組み立てる地獄 段階的移行のための並行実行環境の構築 並行実行環境のアーキテクチャ SQL変換の課題と初期アプローチ SQLをparseして変換する sqlparse ConvertSQLクラスの実装 関数変換の詳細実装 変換処理の全体的な流れ パターンマッチングによる変換 個別変換ルール(スクリプト固有) s

                                          OracleのSQLをそのままBigQueryで動かしたいんですよ、絶対に。 - エムスリーテックブログ
                                        • XBRL から財務諸表を抽出する | sasakiy84.net

                                          概要 arelle の使い方を示しつつ、XBRL からきちんとリンクファイルを使って階層構造をとってきて、それに対応するインスタンスを取得する方法を示す。 どちらかといえば、経済学徒ではなく、エンジニア寄りのバックグラウンドを持つ人向けに書いている。 背景 最近、財務諸表の勉強をしていて、いろんな企業の財務諸表を一括で見たいと思った。 読んでいた解説が、財務諸表を視覚化して説明するタイプのものだったので、会計データをとってきて、それを D3.js で描画することを考えた。 結果、作成した財務諸表可視化アプリの方はある程度できていて、以下のリンクから閲覧できる。 https://financial-statements-visualization.sasakiy84.net/ sasakiy84/xbrl-extractor (XBRL 抽出コード) ただし、まだ少し大きめのバグが残っていた

                                            XBRL から財務諸表を抽出する | sasakiy84.net
                                          • Exhaustive Union Matching in Python - Preferred Networks Research & Development

                                            Pattern matching on algebraic data types is a powerful technique to process a given input and many programming languages have adopted it in one way or another. A check on whether a given match is “exhaustive”, i.e., covers all possible inputs, is helpful to avoid bugs when the set of possible inputs is extended; for example, when new enumeration values are added. In this blog post I will first bri

                                              Exhaustive Union Matching in Python - Preferred Networks Research & Development
                                            • Python behind the scenes #12: how async/await works in Python

                                              Mark functions as async. Call them with await. All of a sudden, your program becomes asynchronous – it can do useful things while it waits for other things, such as I/O operations, to complete. Code written in the async/await style looks like regular synchronous code but works very differently. To understand how it works, one should be familiar with many non-trivial concepts including concurrency,

                                              • Automated Hydroponic System Build – Projects | Kyle Gabriel

                                                Last Updated: August 28, 2022 Hydroponic farming is a method of growing crops without soil, with the main benefits of environmental and nutrient control, water conservation, and reduction of labor. This technique relies on a number of technologies that the principles of automation can be applied in order to improve yield and consistency. In this article and accompanying video, I’ll show you how to

                                                • Amplified exposure: How AWS flaws made Amplify IAM roles vulnerable to takeover | Datadog Security Labs

                                                  research Amplified exposure: How AWS flaws made Amplify IAM roles vulnerable to takeover April 15, 2024 aws vulnerability disclosure Key Points We identified two variants of a vulnerability in AWS Amplify that exposed identity and access management (IAM) roles associated with Amplify projects, allowing them to become assumable by anyone in the world. If the authentication component was removed fro

                                                    Amplified exposure: How AWS flaws made Amplify IAM roles vulnerable to takeover | Datadog Security Labs
                                                  • Schedule Amazon RDS stop and start using AWS Lambda | Amazon Web Services

                                                    AWS Database Blog Schedule Amazon RDS stop and start using AWS Lambda Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. Traditional relational databases require time spent on capacity planning, maintenance, backup, and recovery; a substantial amount of a database administrator’s time is lost to these tasks. Amazon RDS he

                                                      Schedule Amazon RDS stop and start using AWS Lambda | Amazon Web Services
                                                    1