並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 228件

新着順 人気順

syntax for if else in pythonの検索結果1 - 40 件 / 228件

  • Command Line Interface Guidelines

    Contents Command Line Interface Guidelines An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day. Authors Aanand Prasad Engineer at Squarespace, co-creator of Docker Compose. @aanandprasad Ben Firshman Co-creator Replicate, co-creator of Docker Compose. @bfirsh Carl Tashian Offroad Engineer at Smallstep, first e

      Command Line Interface Guidelines
    • 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
      • とほほのHaskell入門 - とほほのWWW入門

        概要 Haskellとは 関数型言語 純粋関数型言語 インストール Haskell Stack Hello world 基本 予約語 コメント ブロック レイアウト 入出力 型 変数 数値 文字(Char) 文字列(String) エスケープシーケンス リスト([...]) タプル((...)) 演算子 関数 演算子定義 再帰関数 ラムダ式 パターンマッチ ガード条件 関数合成(.) 引数補足(@) 制御構文 do文 let文 if文 case文 where文 import文 ループ データ型 データ型(列挙型) データ型(タプル型) データ型(直和型) 新型定義 (newtype) 型シノニム (type) 型クラス (class) メイビー(Maybe) ファンクタ(Functor) アプリケイティブ(Applicative) モナド(Monad) モジュール (module) 高階関

        • 【2020年】CTF Web問題の攻撃手法まとめ - こんとろーるしーこんとろーるぶい

          はじめに 対象イベント 読み方、使い方 Remote Code Execution(RCE) 親ディレクトリ指定によるopen_basedirのバイパス PHP-FPMのTCPソケット接続によるopen_basedirとdisable_functionsのバイパス JavaのRuntime.execでシェルを実行 Cross-Site Scripting(XSS) nginx環境でHTTPステータスコードが操作できる場合にCSPヘッダーを無効化 GoogleのClosureLibraryサニタイザーのXSS脆弱性 WebのProxy機能を介したService Workerの登録 括弧を使わないXSS /記号を使用せずに遷移先URLを指定 SOME(Same Origin Method Execution)を利用してdocument.writeを順次実行 SQL Injection MySQ

            【2020年】CTF Web問題の攻撃手法まとめ - こんとろーるしーこんとろーるぶい
          • ChatGPT APIを取り巻くライブラリ 〜LangChainとguidanceの紹介 | gihyo.jp

            こんにちは! 逆瀬川(@gyakuse)です! 前回はOpenAIが公開しているChat APIとWhisper APIを用いて議事録文字起こしアプリケーションを作ってみました。今回は、Chat APIを便利に使うためのライブラリであるLangChainとguidanceを紹介していきます。 なぜ便利に使うためのライブラリが必要なのか? 単純にChat APIにリクエストを送るだけであれば、各言語に用意されたライブラリを使うだけで良いでしょう。たとえば、Pythonにおいてはopenai-pythonが用意されています。前回紹介したとおり、Chat APIを使うだけなら以下のようなリクエストを作るだけで済みます。 import openai openai.api_key = "sk-..." # APIキー completion = openai.ChatCompletion.create

              ChatGPT APIを取り巻くライブラリ 〜LangChainとguidanceの紹介 | gihyo.jp
            • Python普及しろ協会に入会したい

              この記事はタナイ氏によるPython滅ぼす協会に入会したいを読んでから執筆したものです。 この記事の趣旨はPython滅ぼす協会に入会したいに対する反論という形をとりながら、タナイ氏により「バカの言語」と揶揄され、「使ってエンジニアを名乗るというのは」「滑稽」とまで言われたPythonの立場を再考することです。 追記 本記事は「Pythonはこれだけ優れた言語だからみんな使おう!」というものではなく「言うほど酷くないと思うよ」程度のものです。 型アノテーションがあるからと言って静的型付けを軽視しているわけでもなければ、map関数をもってmapメソッドを不要だと言っているわけでもありません。 この記法は嫌い〜この記法が好き〜と表明することは個人の自由ですが、同様に「この記法は実はこういう意味があって〜」という意見があればそれを聞いた上で、物事を判断して欲しいです。もちろん、聞いても意見が変わ

                Python普及しろ協会に入会したい
              • Building a tiny Linux from scratch

                Last week, I built a tiny Linux system from scratch, and booted it on my laptop! Here’s what it looked like: Let me tell you how I got there. I wanted to learn more about how the Linux kernel works, and what’s involved in booting it. So I set myself the goal to cobble together the bare neccessities required to boot into a working shell. In the end, I had a tiny Linux system with a size of 2.5 MB,

                  Building a tiny Linux from scratch
                • プロと読み解く Ruby 3.1 NEWS - クックパッド開発者ブログ

                  技術部の笹田(ko1)と遠藤(mame)です。クックパッドで Ruby (MRI: Matz Ruby Implementation、いわゆる ruby コマンド) の開発をしています。お金をもらって Ruby を開発しているのでプロの Ruby コミッタです。 本日 12/25 に、ついに Ruby 3.1.0 がリリースされました(Ruby 3.1.0 リリース )。今年も Ruby 3.1 の NEWS.md ファイルの解説をします。NEWS ファイルとは何か、は以前の記事を見てください。 プロと読み解く Ruby 2.6 NEWS ファイル - クックパッド開発者ブログ プロと読み解くRuby 2.7 NEWS - クックパッド開発者ブログ プロと読み解くRuby 3.0 NEWS - クックパッド開発者ブログ 本記事は新機能を解説することもさることながら、変更が入った背景や苦労な

                    プロと読み解く Ruby 3.1 NEWS - クックパッド開発者ブログ
                  • Welcome to Comprehensive Rust 🦀 - Comprehensive Rust 🦀

                    Welcome to Comprehensive Rust 🦀 This is a free Rust course developed by the Android team at Google. The course covers the full spectrum of Rust, from basic syntax to advanced topics like generics and error handling. The latest version of the course can be found at https://google.github.io/comprehensive-rust/. If you are reading somewhere else, please check there for updates. The course is availab

                    • Agentic Coding Recommendations

                      There is currently an explosion of people sharing their experiences with agentic coding. After my last two posts on the topic, I received quite a few questions about my own practices. So, here goes nothing. Preface For all intents and purposes, here’s what I do: I predominently use Claude Code with the cheaper Max subscription for $100 a month 1. That works well for several reasons: I exclusively

                        Agentic Coding Recommendations
                      • GPT-5 の新パラメータとツール|npaka

                        以下の記事が面白かったので、簡単にまとめました。 ・GPT-5 New Params and Tools - OpenAI Cookbook 1. verbosity1-1. 概要「verbosity」は、出力トークン数を調節できます。 ・low : 簡潔なUX、簡潔な文章 ・medium (デフォルト) : バランスの取れた詳細 ・high : 詳細な情報。監査、教育、引き継ぎに最適 1-2. verbosityの効果の確認プロンプトを一定に保ったまま、「verbosity」を変更することで、効果を確認できます。 response = client.responses.create( model="gpt-5", input="人生、宇宙、そして万物に関する究極の問いに対する答えは何でしょうか?", text={ "verbosity": "low" } ) print(response

                          GPT-5 の新パラメータとツール|npaka
                        • プロと読み解くRuby 3.4 NEWS - STORES Product Blog

                          プロと読み解くRuby 3.4 NEWS テクノロジー部門技術基盤グループの笹田(ko1)と遠藤(mame)です。Ruby (MRI: Matz Ruby Implementation、いわゆる ruby コマンド) の開発をしています。お金をもらって Ruby を開発しているのでプロの Ruby コミッタです。 本日 12/25 に、恒例のクリスマスリリースとして、Ruby 3.4.0 がリリースされました(Ruby 3.4.0 リリース )。今年も STORES Product Blog にて Ruby 3.4 の NEWS.md ファイルの解説をします(ちなみに、STORES Advent Calendar 2024 の記事になります。他も読んでね)。NEWS ファイルとは何か、は以前の記事を見てください。 プロと読み解く Ruby 2.6 NEWS ファイル - クックパッド開発者

                            プロと読み解くRuby 3.4 NEWS - STORES Product Blog
                          • 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
                            • OOP: the worst thing that happened to programming

                              > BTC: bc1qs0sq7agz5j30qnqz9m60xj4tt8th6aazgw7kxr ETH: 0x1D834755b5e889703930AC9b784CB625B3cd833E USDT(Tron): TPrCq8LxGykQ4as3o1oB8V7x1w2YPU2o5n Ton: UQAtBuFWI3H_LpHfEToil4iYemtfmyzlaJpahM3tFSoxomYQ Doge: D7GMQdKhKC9ymbT9PtcetSFTQjyPRRfkwTdismiss OOP: the worst thing that happened to programming [2/24/2025] In this article, we will try to understand why OOP is the worst thing that happened to prog

                                OOP: the worst thing that happened to programming
                              • Fish 4.0: The Fish Of Theseus

                                About two years ago, our head maintainer @ridiculousfish opened what quickly became our most-read pull request: #9512 - Rewrite it in Rust Truth be told, we did not quite expect that to be as popular as it was. It was written as a bit of an in-joke for the fish developers first, and not really as a press release to be shared far and wide. We didn’t post it anywhere, but other people did, and we go

                                • Introducing Ezno

                                  Ezno is an experimental compiler I have been working on and off for a while. In short, it is a JavaScript compiler featuring checking, correctness and performance for building full-stack (rendering on the client and server) websites. This post is just an overview of some of the features I have been working on which I think are quite cool as well an overview on the project philosophy ;) It is still

                                    Introducing Ezno
                                  • Mojo may be the biggest programming language advance in decades – fast.ai

                                    I remember the first time I used the v1.0 of Visual Basic. Back then, it was a program for DOS. Before it, writing programs was extremely complex and I’d never managed to make much progress beyond the most basic toy applications. But with VB, I drew a button on the screen, typed in a single line of code that I wanted to run when that button was clicked, and I had a complete application I could now

                                      Mojo may be the biggest programming language advance in decades – fast.ai
                                    • 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) - かねこにっき
                                        • Your URL Is Your State

                                          Couple of weeks ago when I was publishing The Hidden Cost of URL Design I needed to add SQL syntax highlighting. I headed to PrismJS website trying to remember if it should be added as a plugin or what. I was overwhelmed with the amount of options in the download page so I headed back to my code. I checked the file for PrismJS and at the top of the file, I found a comment containing a URL: /* http

                                          • 型安全かつシンプルなAgentフレームワーク「PydanticAI」の実装を解剖する - ABEJA Tech Blog

                                            はじめに こちらはABEJAアドベントカレンダー2024 12日目の記事です。 こんにちは、ABEJAでデータサイエンティストをしている坂元です。最近はLLMでアプローチしようとしていたことがよくよく検証してみるとLLMでは難しいことが分かり急遽CVのあらゆるモデルとレガシーな画像処理をこれでもかというくらい詰め込んだパイプラインを実装することになった案件を経験して、LLMでは難しそうなことをLLM以外のアプローチでこなせるだけの引き出しとスキルはDSとしてやはり身に付けておくべきだなと思うなどしています(LLMにやらせようとしていることは大抵難しいことなので切り替えはそこそこ大変)。 とはいうものの、Agentの普及によってより複雑かつ高度な推論も出来るようになってきています。弊社の社内外のプロジェクト状況を見ていても最近では単純なRAG案件は減りつつあり、計画からアクションの実行、結果

                                              型安全かつシンプルなAgentフレームワーク「PydanticAI」の実装を解剖する - ABEJA Tech Blog
                                            • Moving off of TypeScript

                                              We Love You, TypeScriptFor nearly five years now, Motion has operated in a large TypeScript monorepo. At its peak, it was roughly ~2.5 million lines of code after excluding comments, node_modules, etc. To manage this, we used Vercel’s rather excellent Turborepo build system. This is not a blog post hating on TypeScript — quite the opposite! Motion would likely not even have survived until today wi

                                                Moving off of TypeScript
                                              • ISUCON13にLLM活用担当で参戦しました - LayerX エンジニアブログ

                                                こんにちは、LayerX CTOの@y_matsuwitterです。最近はパン作りにハマっています。無心に小麦と酵母の声を聞くことで精神の安寧を求めています。 この記事は LayerXテックアドカレ2023 19日目の記事です。前回は @shota_tech が「Go の linter 雰囲気で使っていたから調べ直した #LayerXテックアドカレ」を書いてくれました。次回はEMオフィスの@serimaより「Engineering Officeの話」がポストされる予定なのでご期待ください。 ISUCON13 昨日開催のISUCONに参加してきました。とても楽しい問題ですし、これだけの人数での開催を支えている運営の皆さんには頭が上がりません。個人でもLayerXとしてもスポンサーさせていただきました。ありがとうございます! 10年近く一緒に出場している.datというチームで、私はプロンプトを

                                                  ISUCON13にLLM活用担当で参戦しました - LayerX エンジニアブログ
                                                • Lessons from Writing a Compiler

                                                  The prototypical compilers textbook is: 600 pages on parsing theory. Three pages of type-checking a first-order type system like C. Zero pages on storing and checking the correctness of declarations (the “symbol table”). Zero pages on the compilation model, and efficiently implementing separate compilation. 450 pages on optimization and code generation. The standard academic literature is most use

                                                  • Interview with Ryan Dahl, Node.js & Deno creator by Evrone

                                                    In an interview with Evrone, Ryan Dahl speaks about the main challenges in Deno, the future of JavaScript and TypeScript, and tells how he would have changed his approach to Node.js if he could travel back in time. We met with Ryan Dahl, the creator of Node.js, to discuss the origins of the platform, its impact on JavaScript, and his thoughts on its future. In the interview he also reflected on hi

                                                      Interview with Ryan Dahl, Node.js & Deno creator by Evrone
                                                    • Prototyping in Rust | corrode Rust Consulting

                                                      Programming is an iterative process - as much as we would like to come up with the perfect solution from the start, it rarely works that way. Good programs often start as quick prototypes. The bad ones stay prototypes, but the best ones evolve into production code. Whether you’re writing games, CLI tools, or designing library APIs, prototyping helps tremendously in finding the best approach before

                                                        Prototyping in Rust | corrode Rust Consulting
                                                      • Replit — Comparing Code Editors: Ace, CodeMirror and Monaco

                                                        EngInfraAce, CodeMirror, and Monaco: A Comparison of the Code Editors You Use in the Browser I’ve been working on Replit for roughly six years now, and as the team has grown, I’ve focused on the IDE (what we call the workspace) portion of the product. Naturally, I was increasingly preoccupied with the code editor. While we’ve considered creating a code editor that meets our needs, the complexity i

                                                          Replit — Comparing Code Editors: Ace, CodeMirror and Monaco
                                                        • Rewriting the Ruby parser

                                                          At Shopify, we have spent the last year writing a new Ruby parser, which we’ve called YARP (Yet Another Ruby Parser). As of the date of this post, YARP can parse a semantically equivalent syntax tree to Ruby 3.3 on every Ruby file in Shopify’s main codebase, GitHub’s main codebase, CRuby, and the 100 most popular gems downloaded from rubygems.org. We recently got approval to merge this work into C

                                                            Rewriting the Ruby parser
                                                          • Tools: Code Is All You Need

                                                            If you’ve been following me on Twitter, you know I’m not a big fan of MCP (Model Context Protocol) right now. It’s not that I dislike the idea; I just haven’t found it to work as advertised. In my view, MCP suffers from two major flaws: It isn’t truly composable. Most composition happens through inference. It demands too much context. You must supply significant upfront input, and every tool invoc

                                                              Tools: Code Is All You Need
                                                            • Data Contractに向けたProtocol Buffersの調査 - yasuhisa's blog

                                                              背景: データ品質を担保するにはデータソースの品質が重要 データソースの品質を担保する手段としてのData Contract Data Contractの表現方法の一つとしてのProtocol Buffers Data ContractとしてProtocol Buffersを使う データの入出力を一箇所に集約、Protocol Buffersで抑えるパターン ストレージのスキーマをProtocol Buffersで抑えるパターン 発展的な話題 & 読書会の案内 参考文献 背景: データ品質を担保するにはデータソースの品質が重要 私はデータエンジニアをしており、DWHやデータマートのデータ品質について考えることが多い。BigQueryなどにデータが取り込まれた後のレイヤリングやテスト、改善に向けたデータ品質の可視化について、以前発表した。 データが取り込まれた後の整理は進んでいるものの、やは

                                                                Data Contractに向けたProtocol Buffersの調査 - yasuhisa's blog
                                                              • Announcing TypeScript 4.8 - TypeScript

                                                                Today we’re excited to announce the release of TypeScript 4.8! If you’re not yet familiar with TypeScript, it’s a language that builds on JavaScript and adds syntax for types. These types let you put your expectations and assumptions into your code, and those assumptions can then be checked by the TypeScript type-checker. This checking can help avoid typos, calling uninitialized values, mixing up

                                                                  Announcing TypeScript 4.8 - TypeScript
                                                                • The yaml document from hell

                                                                  written by Ruud van Asseldonk published 11 January 2023 For a data format, yaml is extremely complicated. It aims to be a human-friendly format, but in striving for that it introduces so much complexity, that I would argue it achieves the opposite result. Yaml is full of footguns and its friendliness is deceptive. In this post I want to demonstrate this through an example. This post is a rant, and

                                                                  • March 2025 (version 1.99)

                                                                    Update 1.99.1: The update addresses these security issues. Update 1.99.2: The update addresses these issues. Update 1.99.3: The update addresses these issues. Downloads: Windows: x64 Arm64 | Mac: Universal Intel silicon | Linux: deb rpm tarball Arm snap Welcome to the March 2025 release of Visual Studio Code. There are many updates in this version that we hope you'll like, some of the key highligh

                                                                      March 2025 (version 1.99)
                                                                    • RFC 9562: Universally Unique IDentifiers (UUIDs)

                                                                       Internet Engineering Task Force (IETF) K. Davis Request for Comments: 9562 Cisco Systems Obsoletes: 4122 B. Peabody Category: Standards Track Uncloud ISSN: 2070-1721 P. Leach University of Washington May 2024 Universally Unique IDentifiers (UUIDs) Abstract This specification defines UUIDs (Universally Unique IDentifiers) -- also known as GUIDs (Globally Unique IDentifiers) -- and a Uniform Resou

                                                                        RFC 9562: Universally Unique IDentifiers (UUIDs)
                                                                      • The Roc Programming Language

                                                                        Examples Roc is a young language. It doesn't even have a numbered release yet, just nightly builds! However, it can already be used for several things if you're up for being an early adopter— with all the bugs and missing features which come with that territory. Here are some examples of how it can be used today. Command-Line Interfaces main! = |args| Stdout.line!("Hello!") You can use Roc to crea

                                                                        • Perl 5.32の連鎖比較(Chained comparisons)はどの様に実装されているのか - Acme::AnaTofuZ->new;

                                                                          この記事はPerl Advent Calendar 2020と琉大 Advent Calendar 2020の11日目の記事です。 PerlはPerl5になって長いですが、現在の最新の安定版のバージョンは5.32です。 Perl5.32で取り入れられた(厳密には5.31からですが)のおもしろ機能として連鎖比較(Chained comparisons)が存在します。 今までPerlで数値などが特定の範囲に含まれているかどうかをif文で判定するには次の様に書く必要がありました。 if (10 < $n && $n <= 20) これがこう書ける様になります!!! if ( 10 < $n <= 20 ) {...} 便利!!!!!!!!!!!!!!!!!!!!!!!! ...........というわけで、この便利な連鎖比較がどの様に実装されているかを探検してみます。 言語処理系の実装 さて今か

                                                                            Perl 5.32の連鎖比較(Chained comparisons)はどの様に実装されているのか - Acme::AnaTofuZ->new;
                                                                          • 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
                                                                            • CUPID: for joyful coding

                                                                              What started as lighthearted iconoclasm, poking at the bear of SOLID, has developed into something more concrete and tangible. If I do not think the SOLID principles are useful these days, then what would I replace them with? Can any set of principles hold for all software? What do we even mean by principles? I believe that there are properties or characteristics of software that make it a joy to

                                                                              • The Best AI Coding Tools in 2025

                                                                                What used to take an entire development sprint now ships in a single afternoon. The numbers prove it: according to Stack Overflow's 2024 Developer Survey of over 65,000 developers, 76% are now using or planning to use AI coding assistants in their development process—up from 70% the previous year. The shift from "AI is a novelty" to "AI is how developers code" happened faster than anyone predicted

                                                                                  The Best AI Coding Tools in 2025
                                                                                • 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