並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 110件

新着順 人気順

python if else break loopの検索結果1 - 40 件 / 110件

  • Minimal safe Bash script template

    Published on December 14, 2020   ·   Updated on December 16, 2020 Bash scripts. Almost anyone needs to write one sooner or later. Almost no one says “yeah, I love writing them”. And that’s why almost everyone is putting low attention while writing them. I won’t try to make you a Bash expert (since I’m not a one either), but I will show you a minimal template that will make your scripts safer. You

      Minimal safe Bash script template
    • MCPでLLMに行動させる - Terraformを例とした tfmcp の紹介 - じゃあ、おうちで学べる

      はじめに こんにちは!今回は、私が最近開発した tfmcp というツールを紹介します。これは Terraform を LLM(大規模言語モデル)から操作できるようにするツールで、Model Context Protocol (MCP) を活用しています。 github.com このブログが良ければ読者になったり、GitHub リポジトリにStarをいただけると開発の励みになります。nwiizoをフォロワーしてくれるのもありがたいです。より良いツール開発のためのフィードバックもお待ちしています! MCP とは何か? 記事を始める前に、まず MCP (Model Context Protocol) について簡単に説明しましょう。MCP についてより詳しい情報は、公式ドキュメント modelcontextprotocol.io や Anthropic の Model Context Protoc

        MCPでLLMに行動させる - Terraformを例とした tfmcp の紹介 - じゃあ、おうちで学べる
      • CPUエミュレータをRustで自作する - Don't Repeat Yourself

        この記事は Rust Advent Calendar 2020 ならびに CyberAgent Developers Advent Calendar 25日目の記事です。 今年のはじめの頃になりますが、『CPUの創り方』という本に載っている TD4 という CPU を実装してみました。TD4 は「とりあえず動作するだけの4bit CPU」の略です。この本に載っている CPU エミュレータを実際に実装してみました。ただし、本書には GUI が載っていましたが、それは省略しました。 CPUの創りかた 作者:渡波 郁発売日: 2003/10/01メディア: 単行本(ソフトカバー) 「最近話題の RISC-V などの CPU エミュレータを作ってみたいものの、いきなり作るにはハードルが高い。何か簡単なもので素振りをして CPU の動作の仕組みをまずは知りたい」という方にはかなりオススメできる教材だ

          CPUエミュレータをRustで自作する - Don't Repeat Yourself
        • N番目の素数を求める - すぎゃーんメモ

          SNSなどで話題になっていたので調べてみたら勉強になったのでメモ。 環境 Pythonでの実装例 例1 例2 例3 エラトステネスの篩 Rustでの実装例 試し割り法 エラトステネスの篩 アトキンの篩 おまけ: GMP Benchmark 高速化のテクニック 上限個数を見積もる Wheel factorization オチ Repository References 環境 手元のMacBook Pro 13-inchの開発機で実験した。 2.8 GHz Intel Core i7 16 GB 2133 MHz LPDDR3 Pythonでの実装例 例1 最も単純に「2以上p未満のすべての数で割ってみて余りが0にならなかったら素数」とする、brute force 的なアプローチ。 import cProfile import io import pstats import sys def m

            N番目の素数を求める - すぎゃーんメモ
          • とほほのRust入門 - とほほのWWW入門

            Rustとは インストール Hello world Cargoプロジェクト キーワード コメント(//) 値 変数・定数(let, mut, const) 型 基本の型(bool, i16, char, str...) 型変換(as) 構造体(struct) 共用体(union) 列挙型(enum) タプル(tup) 配列(array) ベクタ(vec) ハッシュマップ(HashMap) 文字列(&str, String) 演算子(+ - ...) ヒープ領域(Box) スライス(&var[n..m]) 関数(fn) クロージャー(|...|{...}) マクロ(macro_rules!) 制御構文 条件分岐(if) 繰り返し(while) 繰り返し(for) ループ(loop) ループ制御(break, continue) マッチ(match) インプリメンテーション(impl) トレイ

            • 防衛省サイバーコンテスト 2025 writeup - st98 の日記帳 - コピー

              2/2に12時間というちょうどよい競技時間で開催された。21時終了だったけれども、11時45分ぐらいに最速で全完して1位🎉 第1回以来4年ぶりの優勝だ。昨年大会の第4回ではヒントの閲覧数で優勝を逃してしまって悔しい思いをしたので、雪辱を果たすことができ嬉しい。開始直後からずっと1位を独走できており、450名以上のプレイヤーがいる中で圧勝だったのも嬉しい。 昨年度や一昨年度はバルクが作問を担当していたが、今回はAGESTが担当していた。これまでの問題と比較すると全体的に易化したように思うが、解くにあたって発想の大きな飛躍を必要とするいわゆる「エスパー要素」のある問題はごく一部を除いて存在しておらず*1、よかったと思う。また、昨年度・一昨年度に引き続きwriteupは公開可能というのもよかった。 戦略というほどの戦略は立てていなかったけれども、とりあえずWebを見た後は全カテゴリを上から見て

                防衛省サイバーコンテスト 2025 writeup - st98 の日記帳 - コピー
              • Microsoft Power Automate DesktopでRPAを実現してみる | 🌴 officeの杜 🥥

                自分自身の個人的意見としては、エンドユーザコンピューティングは大いに結構だと思ってるけれど、一方で日本でジリジリと熱さが消えつつある国内の有象無象のRPAについては滅んだほうが良いとも思ってる。理由は後述するとして、本日良いニュースが発表されました。Power Automate Desktopについて追加費用無し無償で利用可能になるとのこと。これは既にあるMicrosoft365のEnterpriseプランなどに標準で利用できてるPower Automateのデスクトップ版のようで、Windows10に標準でついてくるようになるとのこと。 ということで、現時点のMicrosoft365で使えてるPower Automate Desktopを使ってみて、どんな感じなのか?またリリース後にその違いなどをここに記述していこうかなと思っています。また、Seleniumベースのウェブ自動化についても

                  Microsoft Power Automate DesktopでRPAを実現してみる | 🌴 officeの杜 🥥
                • The Prompt Engineering Playbook for Programmers

                  Developers are increasingly relying on AI coding assistants to accelerate our daily workflows. These tools can autocomplete functions, suggest bug fixes, and even generate entire modules or MVPs. Yet, as many of us have learned, the quality of the AI’s output depends largely on the quality of the prompt you provide. In other words, prompt engineering has become an essential skill. A poorly phrased

                    The Prompt Engineering Playbook for Programmers
                  • GPT in 60 Lines of NumPy | Jay Mody

                    January 30, 2023 In this post, we'll implement a GPT from scratch in just 60 lines of numpy. We'll then load the trained GPT-2 model weights released by OpenAI into our implementation and generate some text. Note: This post assumes familiarity with Python, NumPy, and some basic experience with neural networks. This implementation is for educational purposes, so it's missing lots of features/improv

                    • 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

                      • LogLog Games

                        The article is also available in Chinese. Disclaimer: This post is a very long collection of thoughts and problems I've had over the years, and also addresses some of the arguments I've been repeatedly told. This post expresses my opinion the has been formed over using Rust for gamedev for many thousands of hours over many years, and multiple finished games. This isn't meant to brag or indicate su

                        • Functional programming is finally going mainstream

                          Functional programming is finally going mainstream Object-oriented and imperative programming aren’t going away, but functional programming is finding its way into more codebases. Klint Finley // July 12, 2022 Paul Louth had a great development team at Meddbase, the healthcare software company he founded in 2005. But as the company grew, so did their bug count. That’s expected, up to a point. More

                            Functional programming is finally going mainstream
                          • RubyのGVLを消し去りたいあなたへ(翻訳)|TechRacho by BPS株式会社

                            概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: So You Want To Remove The GVL? | byroot’s blog 原文公開日: 2025/01/29 原著者: byroot -- Railsコアコミッター、Rubyコミッターであり、ShopifyのRuby/Railsインフラチームのシニアスタッフエンジニアです 日本語タイトルは内容に即したものにしました。 GVLは「グローバルVMロック」の略ですが、「ジャイアントVMロック」とされることもあります。 参考: Rubyの(グローバル)VMロックをトレースする(翻訳) 参考: スレッド (Ruby 3.4 リファレンスマニュアル) 私がやりたいのは、Pitchforkに関する記事を書いて、これがどんな理由でできたのか、なぜ現在のような形になったのか、そして今後どうなるのかについて説明することです。しかし

                              RubyのGVLを消し去りたいあなたへ(翻訳)|TechRacho by BPS株式会社
                            • Changing std::sort at Google’s Scale and Beyond

                              TL;DR; We are changing std::sort in LLVM’s libcxx. That’s a long story of what it took us to get there and all possible consequences, bugs you might encounter with examples from open source. We provide some benchmarks, perspective, why we did this in the first place and what it cost us with exciting ideas from Hyrum’s Law to reinforcement learning. All changes went into open source and thus I can

                                Changing std::sort at Google’s Scale and Beyond
                              • Weird Lexical Syntax

                                I just learned 42 programming languages this month to build a new syntax highlighter for llamafile. I feel like I'm up to my eyeballs in programming languages right now. Now that it's halloween, I thought I'd share some of the spookiest most surprising syntax I've seen. The languages I decided to support are Ada, Assembly, BASIC, C, C#, C++, COBOL, CSS, D, FORTH, FORTRAN, Go, Haskell, HTML, Java,

                                  Weird Lexical Syntax
                                • Golang Mini Reference 2022: A Quick Guide to the Modern Go Programming Language (REVIEW COPY)

                                  Golang Mini Reference 2022 A Quick Guide to the Modern Go Programming Language (REVIEW COPY) Harry Yoon Version 0.9.0, 2022-08-24 REVIEW COPY This is review copy, not to be shared or distributed to others. Please forward any feedback or comments to the author. • feedback@codingbookspress.com The book is tentatively scheduled to be published on September 14th, 2022. We hope that when the release da

                                  • krish's blog • Parsing JSON in 500 lines of Rust

                                    Last semester at university, I took a course called "Syntax-Based Tools and Compilers". It focused on building a scanner, parser, compiler, and so on for a language called PL0. We used Python in the course, but I was really interested in learning Rust at the time. So, I decided to embark on a side project (yes, another one!). This time, I wanted to build a JSON parser in Rust. My goal was to test

                                      krish's blog • Parsing JSON in 500 lines of Rust
                                    • Parsing SQL - Strumenta

                                      The code for this tutorial is on GitHub: parsing-sql SQL is a language to handle data in a relational database. If you worked with data you have probably worked with SQL. In this article we will talk about parsing SQL. It is in the same league of HTML: maybe you never learned it formally but you kind of know how to use it. That is great because if you know SQL, you know how to handle data. However

                                        Parsing SQL - Strumenta
                                      • [ローカル環境] faster-whisperを利用してリアルタイム文字起こしに挑戦 - Qiita

                                        Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? はじめに WhisperAPI を利用せずにローカル環境でリアルタイム文字起こしに挑戦してみました。 本家Whisperだと音声ファイル形式以外の入力がうまくいかなかったため、faster-whisper を利用しました。 手探りで挑戦しましたので、何かご指摘がありましたらお教えいただければ幸いです。 効率的に文字起こしを行うための関連記事 [ローカル環境] faster-whisper を利用してリアルタイム文字起こしに挑戦2 [Windows] 文字起こしにデスクトップ音を利用する試み faster-whisperのパラメータを調べ

                                          [ローカル環境] faster-whisperを利用してリアルタイム文字起こしに挑戦 - Qiita
                                        • 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
                                          • WSL2でDeepSeek-R1-Distill-Qwen-32B-Japaneseをllama.cppで試してみる|noguchi-shoji

                                            株価を暴落させているDeepSeekの蒸溜モデルをCyberAgentさんが追加学習したモデルであるDeepSeek-R1-Distill-Qwen-32B-Japanese。これをmomongaさんが量子化したモデル、を試してみます。 momongaさん、ありがとうございます。 使用するPCはドスパラさんの「GALLERIA UL9C-R49」。スペックは ・CPU: Intel® Core™ i9-13900HX Processor ・Mem: 64 GB ・GPU: NVIDIA® GeForce RTX™ 4090 Laptop GPU(16GB) ・GPU: NVIDIA® GeForce RTX™ 4090 (24GB) ※外付け ・OS: Ubuntu22.04 on WSL2(Windows 11) です。 1. llama.cppのセットアップllama-cpp-pyth

                                              WSL2でDeepSeek-R1-Distill-Qwen-32B-Japaneseをllama.cppで試してみる|noguchi-shoji
                                            • Kalyn: a self-hosting compiler for x86-64

                                              Over the course of my Spring 2020 semester at Harvey Mudd College, I developed a self-hosting compiler entirely from scratch. This article walks through many interesting parts of the project. It’s laid out so you can just read from beginning to end, but if you’re more interested in a particular topic, feel free to jump there. Or, take a look at the project on GitHub. Table of contents What the pro

                                              • Patterns for Building LLM-based Systems & Products

                                                Patterns for Building LLM-based Systems & Products [ llm engineering production 🔥 ] · 66 min read Discussions on HackerNews, Twitter, and LinkedIn “There is a large class of problems that are easy to imagine and build demos for, but extremely hard to make products out of. For example, self-driving: It’s easy to demo a car self-driving around a block, but making it into a product takes a decade.”

                                                  Patterns for Building LLM-based Systems & Products
                                                • LLM音声対話システムの応答を高速化してみた | CyberAgent Developers Blog

                                                  はじめまして、CyberAgent AI Lab Intaractive Agentチームの技術研究員の大平といいます。 この記事は CyberAgent Developers Advent Calendar 2023 1日目の記事です。 ChatGPTの登場以降、自然なチャット対話はAPI呼び出しだけで簡単に実装できるようになりました。 更に人間のようなインタラクションを実現しようとすれば、音声対話に発展させたいと思う方も多いかと思われます。 しかし実際にLLMを使って音声対話システムを構築してみると、そのレスポンスの遅さに不満を感じることになります。 この記事ではよくあるシンプルなLLMを用いた音声対話に対していくつかの工夫を施し、その応答速度をできるだけ早めてみようという試みになります。 よくある構成として、以下を用います。 音声認識 Google STT LLM ChatGPT 3

                                                    LLM音声対話システムの応答を高速化してみた | CyberAgent Developers Blog
                                                  • A Walk with LuaJIT

                                                    The following is a chronicle of implementing a general purpose zero-instrumentation BPF based profiler for LuaJIT. Some assumptions are made about what this entails and it may be helpful to read some of our other work in this area. One major change from prior efforts is that instead of working with the original Parca unwinder we are now working with the OpenTelemetry eBPF profiler. If you missed t

                                                      A Walk with LuaJIT
                                                    • 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

                                                      • 0.8.0 Release Notes ⚡ The Zig Programming Language

                                                        Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

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

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

                                                            SESでバウンスメールを確認する方法をいくつか試してみた | DevelopersIO
                                                          • Advent of Code on the Nintendo DS

                                                            It is December. That means annoying Christmas things are everywhere, including but not limited to the annual programming semi-competition known as Advent of Code. The problem with Advent of Code is that it is a waste of time. Most of the puzzles are in the realm of either string processing (somewhat applicable to programming), logic puzzles (not really applicable to most programming), or stupid go

                                                            • So You Want To Remove The GVL?

                                                              I want to write a post about Pitchfork, explaining where it comes from, why it is like it is, and how I see its future. But before I can get to that, I think I need to share my mental model on a few things, in this case, Ruby’s GVL. For quite a long time, it has been said that Rails applications are mostly IO-bound, hence Ruby’s GVL isn’t that big of a deal and that has influenced the design of so

                                                              • The Go Programming Language and Environment – Communications of the ACM

                                                                Go is a programming language created at Google in late 2007 and released as open source in November 2009. Since then, it has operated as a public project, with contributions from thousands of individuals and dozens of companies. Go has become a popular language for building cloud infrastructure: Docker, a Linux container manager, and Kubernetes, a container deployment system, are core cloud techno

                                                                • ​Getting Started with Python

                                                                  Python is a powerful programming language that provides many packages that we can use. Using the versatile Python programming language, we can develop the following: AutomationDesktop applicationAndroidWebIoT home automationData Science and the list goes on.In this article, our primary focus will be knowing how to start learning Python and the essentials required to be a data scientist. Below is t

                                                                    ​Getting Started with Python
                                                                  • M5StickCで室温を監視しSlackへ通知する - 虎の穴開発室ブログ

                                                                    こんにちは。インフラ担当のサカガミです。 今回は室温を監視して Slack へ通知するシステムを作った話です。 きっかけ 弊社のシステムは基本的にクラウドかデータセンター内にあるオンプレミスのサーバを利用していますが、 一部のサーバは業務上の理由により事業所内に設置されています。 サーバが設置されている区画は常時エアコンにより冷却され、室温が25度程度に保たれています。 しかしながら、先日エアコンが不調により停止し、室温が28度まで上昇するという問題が発生しました。 当日は偶然私が出社していたため即時対応し事なきを得ましたが、 普段はリモートワークのためエアコンが故障しても気付くことができません。 遠隔地からでも室温を監視できるシステムの必要性を感じました。 室温を監視するにあたり通知機能のある温度計を探しましたが、 単体のスマホと連動させるタイプのものが多く 複数人のチームへ通知できるも

                                                                      M5StickCで室温を監視しSlackへ通知する - 虎の穴開発室ブログ
                                                                    • Here’s how I use LLMs to help me write code

                                                                      11th March 2025 Online discussions about using Large Language Models to help write code inevitably produce comments from developers who’s experiences have been disappointing. They often ask what they’re doing wrong—how come some people are reporting such great results when their own experiments have proved lacking? Using LLMs to write code is difficult and unintuitive. It takes significant effort

                                                                        Here’s how I use LLMs to help me write code
                                                                      • 0.10.0 Release Notes ⚡ The Zig Programming Language

                                                                        Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

                                                                        • Andrej Karpathy — AGI is still a decade away

                                                                          The Andrej Karpathy episode. Andrej explains why reinforcement learning is terrible (but everything else is much worse), why model collapse prevents LLMs from learning the way humans do, why AGI will just blend into the previous ~2.5 centuries of 2% GDP growth, why self driving took so long to crack, and what he sees as the future of education. Watch on YouTube; listen on Apple Podcasts or Spotify

                                                                            Andrej Karpathy — AGI is still a decade away
                                                                          • PytorchのTransformersのT5を使って要約モデルを作る - 見習いデータサイエンティストの隠れ家

                                                                            インターネットの世界にニュースが溢れる昨今、満足度が高いものを的確に読みたいという方も多いかと思います。そのためには、見るニュースをどれにするか判断することが必要になります。そこで、ニュース全体の主旨を短い文章で表す要約の価値が高まっています。 自然言語処理における要約は、大きく2つに分けられます。それは、抽出型と抽象型です。抽出型は、文章の中から重要な文を抜き出すことで要約を作ります。要約として選ばれた文は元の文章にあるものなので、方向性が大きく異ることや誤字脱字がうまれる可能性は低いです。しかし、要約として選ばれた文のそれぞれは関係があるわけではないので、流暢な要約にならないことも多いです。それに対して、抽象型は人間が作るように要約としての文章の流暢さを考慮しながら作ります。本来人間がほしい要約はこちらになりますが、抽出型に比べると難易度が上がり、全く意味がわからない文章になる可能性も

                                                                              PytorchのTransformersのT5を使って要約モデルを作る - 見習いデータサイエンティストの隠れ家
                                                                            • Highlights from the Claude 4 system prompt

                                                                              25th May 2025 Anthropic publish most of the system prompts for their chat models as part of their release notes. They recently shared the new prompts for both Claude Opus 4 and Claude Sonnet 4. I enjoyed digging through the prompts, since they act as a sort of unofficial manual for how best to use these tools. Here are my highlights, including a dive into the leaked tool prompts that Anthropic did

                                                                                Highlights from the Claude 4 system prompt
                                                                              • Accelerate Python code 100x by import taichi as ti | Taichi Docs

                                                                                Python has become the most popular language in many rapidly evolving sectors, such as deep learning and data sciences. Yet its easy readability comes at the cost of performance. Of course, we all complain about program performance from time to time, and Python should certainly not take all the blame. Still, it's fair to say that Python's nature as an interpreted language does not help, especially

                                                                                • Python behind the scenes #13: the GIL and its effects on Python multithreading

                                                                                  As you probably know, the GIL stands for the Global Interpreter Lock, and its job is to make the CPython interpreter thread-safe. The GIL allows only one OS thread to execute Python bytecode at any given time, and the consequence of this is that it's not possible to speed up CPU-intensive Python code by distributing the work among multiple threads. This is, however, not the only negative effect of