並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 24 件 / 24件

新着順 人気順

python program for if elif elseの検索結果1 - 24 件 / 24件

  • 大実験!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

        • 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
            • python_modules.pdf

              Python3 OpenCV / Pillow / pygame / Eel / PyDub / NumPy / matplotlib / SciPy / SymPy / gmpy2 / hashlib, passlib / Cython / Numba / ctypes / PyInstaller / curses / tqdm / JupyterLab / json / psutil / urllib / zenhan / jaconv Copyright © 2017-2025, Katsunori Nakamura 2025 8 19 Python ‘ .py’ Python Python Windows PSF Python py .py Enter macOS Linux PSF Python python3 .py Enter Anaconda Prompt Python p

              • My thoughts on writing a Minecraft server from scratch (in Bash)

                My thoughts on writing a Minecraft server from scratch (in Bash) For the past year or so, I've been thinking about writing a Minecraft server in Bash as a thought excercise. I once tried that before with the Classic protocol (the one from 2009), but I quickly realized there wasn't really a way to properly parse binary data in bash. Take the following code sample: function a() { read -n 2 uwu echo

                • 入門 Python 3 第2版

                  データサイエンスやウェブ開発、セキュリティなど、さまざまな分野で人気を獲得してきているPython。本書は、ベストセラー『入門 Python 3』の6年ぶりの改訂版で、プログラミング初級者を対象としたPythonの入門書です。プログラミングおよびPythonの基礎から、ウェブ、データベース、ネットワーク、並行処理といった応用まで、実践を見据えたPythonプログラミングをわかりやすく丁寧に説明します。Python 3.9に対応し、f文字列などの新機能も追加され大幅にボリュームアップしました。Pythonの機能をひと通り網羅し、リファレンスとしても便利です。 正誤表 書籍発行後に気づいた誤植や更新された情報を掲載しています。お手持ちの書籍では、すでに修正が施されている場合がありますので、書籍最終ページの奥付でお手持ちの書籍の刷数をご確認の上、ご利用ください。 第1刷正誤表 ※2022年4月更

                    入門 Python 3 第2版
                  • Dynamic Programming is not Black Magic - Quentin Santos

                    This year’s Advent of Code has been brutal (compare the stats of 2023 with that of 2022, especially day 1 part 1 vs. day 1 part 2). It included a problem to solve with dynamic programming as soon as day 12, which discouraged some people I know. This specific problem was particularly gnarly for Advent of Code, with multiple special cases to take into account, making it basically intractable if you

                      Dynamic Programming is not Black Magic - Quentin Santos
                    • 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
                      • Agents for Amazon Bedrock now support memory retention and code interpretation (preview) | Amazon Web Services

                        AWS News Blog Agents for Amazon Bedrock now support memory retention and code interpretation (preview) With Agents for Amazon Bedrock, generative artificial intelligence (AI) applications can run multistep tasks across different systems and data sources. A couple of months back, we simplified the creation and configuration of agents. Today, we are introducing in preview two new fully managed capab

                          Agents for Amazon Bedrock now support memory retention and code interpretation (preview) | Amazon Web Services
                        • 12 Languages in 12 Months

                          I stumbled across Exercism last year and was immediately charmed. It's a website devoted to teaching programming languages. It's got a great UI, offers free mentoring (by a human!), and is entirely open source. Last January, they announced a new program called 12in23, where they challenged participants to try 12 new programming languages in 2023. Each month would have a theme (such as "Analytical

                            12 Languages in 12 Months
                          • 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

                            • A Deep Dive into eBPF: Writing an Efficient DNS Monitoring.

                              eBPF / XDP is an in-kernel virtual machine, provides a high-level library, instruction set and an execution environment inside the Linux kernel. It’s used in many Linux kernel subsystems, most prominently networking, tracing, debugging and security. Including to modify the processing of packets in the kernel and also allows the programming of network devices such as SmartNICs. Use cases in eBPF im

                                A Deep Dive into eBPF: Writing an Efficient DNS Monitoring.
                              • Splatoon2で表示される文字をフォントから学習してTesseraactでOCRする - 粗大メモ置き場

                                概要 背景 目指すところ 筆者の開発環境 OCR環境を整えてSplatoon2のフォントを学習する TesseractとPyOCR環境のインストール 学習用ツールjTessBoxEditorのインストール Splatoon2のフォントをDLしてくる Splatoon2のフォントを学習する 学習の実行 結果だけ欲しい人用 OpenCVとPILを用いてOCR結果を表示 PyOCRのimage_to_stringでOCRする PyOCRの検出結果を描画する OpenCV画像に日本語テキストを書き込む これらの機能のまとめ その他コツ 適用結果とその比較 スペシャル情報 試合時間・カウント ルール名・タイトル おわりに TODO 超余談:Gistにバイナリを上げる方法 概要 Splatoon2の録画の動画からカウントや時間,スペシャルなどの情報を抽出するためにOCRを行う コンテンツ Tesser

                                  Splatoon2で表示される文字をフォントから学習してTesseraactでOCRする - 粗大メモ置き場
                                • 【LlamaIndex】Indexにクエリした際に回答で参考にした箇所(リファレンス)を取得する方法 | DevelopersIO

                                  はじめに 新規事業統括部Passregiチームの山本です。 最近、OpenAIのAPIが公開されたこともあり、効率的に情報を見つけ出す手助けをするための方法として、文章や資料に関する質問に回答できるチャットボットが採用されることが増えてきました。チャットボットが回答する際に、単に直接的な答えだけを返答するのでも良いですが、どこの文章を参考にしたか(=リファレンス)も合わせて回答すれば、ユーザは一次情報を読むことができたり、周辺の情報も合わせて見ることができるので、より安心して利用できそうです。 今回は、LlamaIndexでリファレンスした箇所を把握する方法を調べましたので、そのコードを共有します。 (補足) 文章ファイルの内容に関する質問に回答するチャットボット作成するために、ChatGPTなどのAPIのクエリにその文章の内容を入力として加える方法があります。 その際の課題として以下のよ

                                    【LlamaIndex】Indexにクエリした際に回答で参考にした箇所(リファレンス)を取得する方法 | DevelopersIO
                                  • Zig言語 : Zig言語に遭遇した時のメモ 2021-12

                                    Zig言語 : Zig言語に遭遇した時のメモ 2021-12 はじまり Nim言語の作者がZig言語使って何かやってるというフォーラムの書き込みを見たので Zig言語を調べてみた時のメモ 関連ファイル一式 このページで出てくるソースファイルは以下で取得可能です $ git clone --recursive https://github.com/dinau/zigLearn.git 全てのフォルダにMakefileがあるので$ makeコマンドでビルド可能です zig-0.9.0用です zig-0.14.0-dev...用に修正しました (2024/10) Hello world を実行してみる https://zig-play.dev/ フィボナッチ数列 実際に実行してみる (Runボタンを押す) // zig-0.8.1 2021/12 // fib/src/main.zig cons

                                    • Metashapeで全天球画像をキューブマップに変換

                                      Metashapeは全天球画像(エクイレクタングラー)の処理に対応していますが、アライメント結果を他のSfM系ソフトで利用する場合は、全天球画像のままでは渡すことが出来ません。 postshot、RealityCapture、Inria 3D Gaussian Splatting等は全天球画像には対応していないためです。 しかし先日smert999氏が「Agisoft_metashape_convert_to_cubemap」を公開されました! Metashapeでアライメントした全天球画像を、そのアライメント結果を維持したままキューブマップに変換できるというものです。 Theta, Insta360等で360度動画/全天球画像撮影 → Metashapeでアライメント → キューブマップ変換 → RealityCaptureで活用・postshotで3DGS生成 といったワークフローが可

                                        Metashapeで全天球画像をキューブマップに変換
                                      • 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,

                                        • Build and deploy ML inference applications from scratch using Amazon SageMaker | Amazon Web Services

                                          Artificial Intelligence Build and deploy ML inference applications from scratch using Amazon SageMaker As machine learning (ML) goes mainstream and gains wider adoption, ML-powered inference applications are becoming increasingly common to solve a range of complex business problems. The solution to these complex business problems often requires using multiple ML models and steps. This post shows y

                                            Build and deploy ML inference applications from scratch using Amazon SageMaker | Amazon Web Services
                                          • PEN-200-2022受講記 & OSCP合格記 - プログラム系統備忘録ブログ

                                            PEN-200-2022コースを受講し、OSCP試験に合格できました。コースや試験の概要、これから取り組む方へのアドバイス、備忘録等の記事です。 なお、本文でも言及しますが、PEN-200コースの内容が改定されたり、OSCP試験の出題範囲が変更されたり、Bonus Pointの取得条件が変更されたりします。受講の際はご自身で最新情報をご確認ください。 分かる人向けの結果概要 PEN-200とは 私の事前知識 PEN-200コース内容やOSCP試験内容、Bonus Point条件の変化 PEN-200-2022からPEN-200-2023への変化 Bonus Pointの獲得条件の変化 OSCP試験のマシン構成の変化 PEN-200コース受講記 Exercise関係 Lab関係 サポート関係 OSCP試験受験記 OSCP試験の申込み proctoringソフトウェアの動作確認 その他受験前の

                                              PEN-200-2022受講記 & OSCP合格記 - プログラム系統備忘録ブログ
                                            • Blender CUI ベイク(Physics)とその進捗表示 - Qiita

                                              chcp 65001 @echo off set FILENAME=ここにファイル名 set FILEPATH=C:\tmp\ set BLENDER="C:\Program Files\Blender Foundation\Blender 3.5\blender.exe" set BPY="C:\Users\niuin\OneDrive\blender\scripts\ptcachebake.py" %BLENDER% -b "%FILEPATH%%FILENAME%.blend" --python %BPY% pause chcp 65001: 文字コード指定。日本語が含まれると文字化けするので必須です。 @￰echo off: 冗長なコマンド入力の復唱を省略します。 FILENAME: .blendファイル名を指定して下さい(拡張子不要) FILEPATH: .blendファイルまで

                                                Blender CUI ベイク(Physics)とその進捗表示 - Qiita
                                              • Following up on the Python JIT

                                                Performance of Python programs has been a major focus of development for the language over the last five years or so; the Faster CPython project has been a big part of that effort. One of its subprojects is to add an experimental just-in-time (JIT) compiler to the language; at last year's PyCon US, project member Brandt Bucher gave an introduction to the copy-and-patch JIT compiler. At PyCon US 20

                                                • PythonでExcelを読み込みするだけ【コピペOK】業務効率UP術 - 赤兎馬おじさんの足跡 ~経験値のお裾分け~

                                                  PythonでExcelを読み込みするだけで業務効率UPできるアイデアはある? プログラミング初心者でも自在に編集できるカンタンな方法は? GUIで見やすく、コピペで使えるPythonのサンプルコードとか落ちてない? こんな疑問にお答えします。 当ブログにお立ち寄り頂きまして、ありがとうございます!m(_ _)m こう見えて実は、飽き性で非エンジニアのくせしてPython学習をはじめて5カ月目に突入したことに気付いた赤兎馬おじさん(@sekitoba1007)です。 無料で使えるPythonはプログラミング初心者にも比較的わかりやすく、AIだけでなく幅広く利用できるので業務効率アップにも便利で人気がありますよね! パソコンを日頃から使っている人は、何気なく繰り返している機械的な作業も多いはず。 ファイルやフォルダをあちこち探したりいちいちクリックして起動させたりする作業は、あまり効率的とは

                                                    PythonでExcelを読み込みするだけ【コピペOK】業務効率UP術 - 赤兎馬おじさんの足跡 ~経験値のお裾分け~
                                                  1