並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 238件

新着順 人気順

example program for if else in pythonの検索結果1 - 40 件 / 238件

  • 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
      • 【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問題の攻撃手法まとめ - こんとろーるしーこんとろーるぶい
        • 防衛省サイバーコンテスト 2025 writeup - st98 の日記帳 - コピー

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

            防衛省サイバーコンテスト 2025 writeup - st98 の日記帳 - コピー
          • 大実験!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
            • 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
              • 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

                • Docker is deleting Open Source organisations - what you need to know

                  Coming up with a title that explains the full story here was difficult, so I'm going to try to explain quickly. Yesterday, Docker sent an email to any Docker Hub user who had created an "organisation", telling them their account will be deleted including all images, if they do not upgrade to a paid team plan. The email contained a link to a tersely written PDF (since, silently edited) which was mi

                    Docker is deleting Open Source organisations - what you need to know
                  • Don't write clean code, write CRISP code — Bitfield Consulting

                    I’m sure we’re all in favour of “clean code”, but it’s one of those motherhood-and-apple-pie things that no one can reasonably disagree with. Who wants to write dirty code, unless maybe it’s for a porn site? The problem, of course, is that few of us can agree on what “clean code” means, and how to get there. A rule like “methods should only do one thing”, looks great on a T-shirt, but it’s not so

                      Don't write clean code, write CRISP code — Bitfield Consulting
                    • 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

                        • How I Hacked my Car

                          Note: As of 2022/10/25 the information in this series is slightly outdated. See Part 5 for more up to date information. The Car⌗ Last summer I bought a 2021 Hyundai Ioniq SEL. It is a nice fuel-efficient hybrid with a decent amount of features like wireless Android Auto/Apple CarPlay, wireless phone charging, heated seats, & a sunroof. One thing I particularly liked about this vehicle was the In-V

                          • 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
                            • The End of Programming – Communications of the ACM

                              The end of classical computer science is coming, and most of us are dinosaurs waiting for the meteor to hit. I came of age in the 1980s, programming personal computers such as the Commodore VIC-20 and Apple ][e at home. Going on to study computer science (CS) in college and ultimately getting a Ph.D. at Berkeley, the bulk of my professional training was rooted in what I will call “classical” CS: p

                              • 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

                                • Announcing WASIX · Blog · Wasmer

                                  Announcing WASIXWASIX extends the WASI proposal to build useful and productive applications today with full POSIX compatibility Today we are very excited to launch a new initiative that will start shaping the future of WebAssembly on both the browser and the server. WASI was announced about 4 years ago and was a great push to move the Wasm community forward. It got everyone so excited that even So

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

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

                                      型安全かつシンプルなAgentフレームワーク「PydanticAI」の実装を解剖する - ABEJA Tech Blog
                                    • Every System is a Log: Avoiding coordination in distributed applications

                                      Every System is a Log: Avoiding coordination in distributed applications How Restate works, Part 1Posted January 22, 2025 by Stephan Ewen and Jack Kleeman and Giselle van Dongen ‐ 13 min read Building resilient distributed applications remains a tough challenge. It should be possible to focus almost entirely on the business logic and the complexity inherent to the domain. Instead, you need to revi

                                        Every System is a Log: Avoiding coordination in distributed applications
                                      • 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

                                        • Tales of the M1 GPU - Asahi Linux

                                          Hello everyone, Asahi Lina here!✨ marcan asked me to write an article about the M1 GPU, so here we are~! It’s been a long road over the past few months and there’s a lot to cover, so I hope you enjoy it! What’s a GPU?You probably know what a GPU is, but do you know how they work under the hood? Let’s take a look! Almost all modern GPUs have the same main components: A bunch of shader cores, which

                                            Tales of the M1 GPU - Asahi Linux
                                          • 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
                                            • The Scary Thing About Automating Deploys - Engineering at Slack

                                              Most of Slack runs on a monolithic service simply called “The Webapp”. It’s big – hundreds of developers create hundreds of changes every week. Deploying at this scale is a unique challenge. When people talk about continuous deployment, they’re often thinking about deploying to systems as soon as changes are ready. They talk about microservices and 2-pizza teams (~8 people). But what does continuo

                                              • 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
                                                  • The New Internet: Tailscale's Vision for the Future of Connectivity

                                                    Avery Pennarun is the CEO and co-founder of Tailscale. A version of this post was originally presented at a company all-hands. We don’t talk a lot in public about the big vision for Tailscale, why we’re really here. Usually I prefer to focus on what exists right now, and what we’re going to do in the next few months. The future can be distracting. But increasingly, I’ve found companies are startin

                                                      The New Internet: Tailscale's Vision for the Future of Connectivity
                                                    • 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
                                                      • 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
                                                        • Taming Floating-Point Sums | orlp.net

                                                          Suppose you have an array of floating-point numbers, and wish to sum them. You might naively think you can simply add them, e.g. in Rust: fn naive_sum(arr: &[f32]) -> f32 { let mut out = 0.0; for x in arr { out += *x; } out } This however can easily result in an arbitrarily large accumulated error. Let’s try it out: naive_sum(&vec![1.0; 1_000_000]) = 1000000.0 naive_sum(&vec![1.0; 10_000_000]) = 1

                                                          • Terminal colours are tricky

                                                            Yesterday I was thinking about how long it took me to get a colorscheme in my terminal that I was mostly happy with (SO MANY YEARS), and it made me wonder what about terminal colours made it so hard. So I asked people on Mastodon what problems they’ve run into with colours in the terminal, and I got a ton of interesting responses! Let’s talk about some of the problems and a few possible ways to fi

                                                            • High throughput Fizz Buzz

                                                              Fizz Buzz is a common challenge given during interviews. The challenge goes something like this: Write a program that prints the numbers from 1 to n. If a number is divisible by 3, write Fizz instead. If a number is divisible by 5, write Buzz instead. However, if the number is divisible by both 3 and 5, write FizzBuzz instead. The goal of this question is to write a FizzBuzz implementation that go

                                                                High throughput Fizz Buzz
                                                              • Hyperlight Wasm: Fast, secure, and OS-free - Microsoft Open Source Blog

                                                                Last fall the Azure Core Upstream team introduced Hyperlight: an open-source Rust library you can use to execute small, embedded functions using hypervisor-based protection. Then, we showed how to run Rust functions really, really fast, followed by using C to run Javascript. In February 2025, the Cloud Native Computing Foundation (CNCF) voted to onboard Hyperlight into their Sandbox program. We’re

                                                                  Hyperlight Wasm: Fast, secure, and OS-free - Microsoft Open Source Blog
                                                                • Notes by djb on using Fil-C (2025)

                                                                  Notes by djb on using Fil-C (2025) I'm impressed with the level of compatibility of the new memory-safe C/C++ compiler Fil-C (filcc, fil++). Many libraries and applications that I've tried work under Fil-C without changes, and the exceptions haven't been hard to get working. I've started accumulating miscellaneous notes on this page regarding usage of Fil-C. My selfish objective here is to protect

                                                                  • Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction - cl-fast-ecs by Andrew

                                                                    Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction In this series of tutorials, we will delve into creating simple 2D games in Common Lisp. The result of the first part will be a development environment setup and a basic simulation displaying a 2D scene with a large number of physical objects. It is assumed that the reader is familiar with some high-level programming language, has a gener

                                                                      Gamedev in Lisp. Part 1: ECS and Metalinguistic Abstraction - cl-fast-ecs by Andrew
                                                                    • Running LLaMA 7B and 13B on a 64GB M2 MacBook Pro with llama.cpp

                                                                      Running LLaMA 7B and 13B on a 64GB M2 MacBook Pro with llama.cpp See also: Large language models are having their Stable Diffusion moment right now. Facebook's LLaMA is a "collection of foundation language models ranging from 7B to 65B parameters", released on February 24th 2023. It claims to be small enough to run on consumer hardware. I just ran the 7B and 13B models on my 64GB M2 MacBook Pro! I

                                                                        Running LLaMA 7B and 13B on a 64GB M2 MacBook Pro with llama.cpp
                                                                      • 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

                                                                        • 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

                                                                            • Python is a Compiled Language

                                                                              This blog post hopes to convince you that Python is a compiled language. And by “Python”, I don’t mean alternate versions of Python like PyPy, Mypyc, Numba, Cinder, or even Python-like programming languages like Cython, Codon, Mojo1—I mean the regular Python: CPython! The Python that is probably installed on your computer right now. The Python that you got when you searched “python” on Google and

                                                                              • Why Rust strings seem hard | Brandon's Website

                                                                                Why Rust strings seem hard April 13, 2021 Lately I've been seeing lots of anecdotes from people trying to get into Rust who get really hung up on strings (&str, String, and their relationship). Beyond Rust's usual challenges around ownership, there can be an added layer of frustration because strings are so easy in the great majority of languages. You just add them together, split them, whatever!

                                                                                • 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