GitHub finally moved to serverless.
submitted by /u/Alarming-Spinach1039 [link] [留言]
找到 2544 篇相关文章
submitted by /u/Alarming-Spinach1039 [link] [留言]
I've now routed five different AI coding tools through a proxy layer. Each one broke differently. None of them told me why. Writing this partly as a reference for myself, partly because the failure modes turn out to be genuinely interesting — they say a lot about how these tools are built. Claude Code: reads config once, then never again The simplest of the five. Config lives in ~/.claude/settings.json , two keys get modified: env.ANTHROPIC_BASE_URL env.ANTHROPIC_AUTH_TOKEN The failure mode: it reads that file exactly once, at startup. Change it while a session is running and nothing happens. No warning, no reload. This is the single most common "the switch is on but nothing works" report, across every tool. Close all windows, open a fresh one. One thing I appreciate: it only touches those two keys, backs up the original, and restores it exactly when you flip the switch off. Codex: doesn't read the model from your request This one is architecturally weird and cost me an hour. Every other tool specifies which model it wants in the request. Codex doesn't. It picks from its own internal model catalog. Consequence: if you don't explicitly select a model, it sits on a default internal GPT model that the market can't serve. And you don't get "please select a model" — you get a string of failures with no stated cause. The config it writes: ~/.codex/config.toml → model_provider, [model_providers.asale], model, model_catalog_json ~/.codex/auth.json → OPENAI_API_KEY Note model_catalog_json . That's the part that makes your selection show up in the app's model menu. And the desktop app reads that catalog at startup , so a model written while it's running won't appear until you restart. Two separate restart requirements stacked on each other. Credit where due: it preserves your existing comments and formatting in config.toml . Not every tool does. Gemini CLI: loses to your own shell config Config goes into ~/.gemini/.env . Two keys added, nothing else touched. The failure mode
I recently found myself in one of those classic developer rabbit holes. A friend asked me if I knew their Chinese zodiac sign, and instead of just Googling it like a normal person, I thought: "I could build a tool for this." Because apparently I enjoy reinventing wheels. The twist? I wanted it to work entirely in the browser. No API calls, no server, no database. Just a date input and some JavaScript logic. The challenge was figuring out how to accurately compute Chinese zodiac signs, the Chinese lunar calendar year, and the traditional Ganzhi (干支) system without pulling in a massive calendar library. The Problem with Existing Solutions My first instinct was to search for an API. There are plenty of Chinese calendar APIs out there, but they all had issues: Most require API keys and rate limiting Many are Chinese-language only, which is fine for me but not great for a broader audience They're overkill for what should be a simple calculation Some have questionable accuracy for historical dates I also looked at JavaScript libraries like lunar-javascript and chinese-calendar . They're comprehensive, but they're also huge. For a simple "what's my zodiac sign" tool, pulling in a 100KB+ library felt like using a flamethrower to light a candle. The Math Behind the Madness Here's what I discovered: the Chinese zodiac and Ganzhi calculations are surprisingly straightforward if you understand the underlying math. The Zodiac: Simple Modulo Arithmetic The 12 Chinese zodiac animals follow a cycle that aligns with the 12-year Jupiter cycle. The calculation is embarrassingly simple: const ZODIAC = [ ' 鼠 ' , ' 牛 ' , ' 虎 ' , ' 兔 ' , ' 龙 ' , ' 蛇 ' , ' 马 ' , ' 羊 ' , ' 猴 ' , ' 鸡 ' , ' 狗 ' , ' 猪 ' ]; const zodiac = ZODIAC [( year - 4 ) % 12 ]; That's it. The year 4 AD was the first year of the Rat, so everything since then follows a simple modulo pattern. The Ganzhi System: Two Interlocking Cycles The Ganzhi (干支) system combines the 10 Heavenly Stems (天干) with the 12 Earthly Branches (地支
submitted by /u/No_Value_6697 [link] [留言]
This is a new series that answers the question, “what’s next after the mastery of Rust language syntax?”. In this series, We build a production-ready containerized RESTful API server application using Axum, Tokio, Tower, Serde, Toasty ORM, Garde, Utoipa with Docker and PostgreSQL. Hyper, Axum, Tokio and Tower: The most prominent HTTP server ecosystem at the time of writing. Toasty ORM: The most promising Object-Relational Mapper (ORM), built by the creators of Tokio and Axum. Serde and Utoipa: The most prominent serialization framework and OpenAPI 3.1 specification generator. Garde: The most promising and most feature-rich validation library in Rust at the time of writing. Documentation/ Labs: https://learning-rust.github.io/labs/building-a-containerized-restful-api submitted by /u/dumindunuwan [link] [留言]
AI agents can only use tools as reliably as those tools are described. That’s why I built ToolReady AI —a free tool that reviews MCP and AI-agent tool schemas, identifies reliability problems, and recommends specific fixes. A function might work perfectly when a developer calls it directly, yet still fail when an agent has to decide when to call it, which arguments to provide, and what values are safe. In many cases, the problem is not the underlying API. It is the tool schema placed between the API and the model. Here are seven issues worth checking before releasing an MCP or AI-agent tool. A description that is too vague Descriptions such as "Searches documents" do not give an agent enough routing context. The description should identify the supported content, expected result, important limits, and a clear use case. Better: «Search indexed support documents and return the most relevant text excerpts. Use this when answering questions about product setup or troubleshooting. Do not use it for account-specific or real-time billing information.» No boundary conditions A useful description should also explain when the tool should not be used. Exclusions help an agent distinguish similar tools and avoid calls that cannot succeed. Examples include: Do not use for personal account data. Do not use when the user requests current inventory. Do not use for destructive actions without confirmation. Undocumented inputs An input name such as "query", "id", or "limit" may seem obvious to its author, but the agent still has to guess the required meaning and format. Each property should explain: What the value represents The expected format A realistic example Any important constraints Missing required fields If the schema does not identify the minimum necessary inputs as required, an agent may send an empty or incomplete call that cannot produce a useful result. For example: { "type": "object", "properties": { "query": { "type": "string", "description": "Natural-language search q
I made a video explaining a concept I love called macros, which allow you to add your own syntax to a language. Languages like Rust, Lean, and lisp have them. The goal with the video is to make you feel like you could've discovered macros yourself. I'm new at making educational content like this, but I'm planning on making many more programming language videos like this one on my channel. Any thoughts, constructive criticism, or advice is more than welcome! Hope you all enjoy submitted by /u/quasar_tree [link] [留言]
🚀 SoloEngine v0.4.0 Release — Context Compaction, Browser/Terminal Panels, Token Statistics...
I posted this video a few years ago showing how to use the YouTube API and it's still working! I have the title of the video and it's thumbnail auto update based on views. It's almost at 1k submitted by /u/jarreed0 [link] [留言]
xUnit 4.0.0 makes full test-case parallelization an explicit option. That is useful, but xUnit 4 ParallelMode.All changes a quiet assumption in many suites: tests in the same class, including separate rows of one theory, may now overlap. A static fake, shared fixture, temporary file, or database record that was safe under collection-level parallelism can become a race. I treat this as an isolation change, not a speed switch. Before enabling it across a suite, I want a deterministic failure that proves the risk and a deterministic check for each guardrail. What xUnit 4 ParallelMode.All changes The xUnit.net v3 4.0.0 release notes describe full test-case parallelization as a new feature. The default is still ParallelMode.Collections , so upgrading does not silently enable the broader mode. I have to opt in at the assembly level: using Xunit.Sdk ; using Xunit.v3 ; [ assembly : Parallelization ( Mode = ParallelMode . All , MaxThreads = 2 , Algorithm = ParallelAlgorithm . Conservative )] With Collections , tests within a collection are serialized. With All , every test case is eligible to run beside every other test case. That includes two cases from the same class and two pre-enumerated rows from the same theory. The official parallel test execution guide documents the modes, algorithms, and available opt-out scopes. I set MaxThreads = 2 in the sample so the scheduling condition is easy to inspect. It is a demonstration setting, not a recommendation for CI. The right value depends on available CPU, memory, and the external systems touched by the tests. Before changing the mode, I scan for mutable static fields, IClassFixture and ICollectionFixture implementations, fixed file names, environment-variable changes, test servers bound to fixed ports, and records addressed by shared IDs. I also check theory data sources for objects that rows can mutate. That inventory tells me whether the resource should become concurrency-safe, receive a unique per-test identity, or stay beh
Opening hook The silence in the room was absolute, save for the rhythmic scratching of pens against paper during a final exam. I was three rows back, feeling confident, until my phone decided to vibrate against the wooden desk. It wasn't a subtle hum; it was a rhythmic, aggressive buzz that echoed like a snare drum in a cathedral. Every single head turned in my direction. I scrambled to silence the device, but in my panic, I fumbled the power button. That moment of pure, unadulterated embarrassment was the catalyst for everything I have built since. The problem We live in an age where our devices are supposed to be smart, yet they consistently fail at the most basic context-aware tasks. We have high-end processors, sophisticated neural engines, and sophisticated sensor arrays, but we still have to manually toggle a 'silent' switch before entering a meeting, a lecture, or a mosque. The friction isn't just the act of flipping a switch; it is the cognitive load of remembering to do it and, more importantly, remembering to turn it back on afterward. I spent months living with the anxiety of a phone that might ring at the worst possible time. I tried existing automation tools, but they were either bloated, relied on cloud-based tracking that hammered my battery, or lacked the granular control I needed for specific locations. Most apps that promised location-based sound management were either imprecise or drained my battery by keeping the GPS radio active around the clock. I didn't want a heavy-duty tracking app; I wanted a silent, background-native utility that respected the hardware constraints of the Android platform while solving the specific problem of environmental sound management. The technical decision / implementation When I started building Muffle, my primary constraint was the battery. Android users are rightfully protective of their background processes, and if my app showed up as a primary battery consumer in settings, it was effectively useless. I had to de
How I Cut LLM Token Usage by Up to 60% in Production If you work with LLM APIs (OpenAI, Anthropic, Gemini), you know the pain: every call costs money, and a big chunk of that cost is pure waste — verbose prompts, code pasted with no filtering, repeated context the model doesn't even need to understand the task. That's why I built PromptShrink: a prompt pre-processor that trims the excess before it ever hits the API, without losing what actually matters for the model to understand. The real problem Every time you feed a code snippet or a long prompt to an LLM, you're paying per token, not per character. Comments, whitespace, formatting meant for humans — all of that is dead weight the model doesn't need to do its job. At scale (thousands of calls per month), that adds up to a real bill. What PromptShrink does Packages entire repositories, minifying code and stripping comments, ready to paste as context into any LLM Simulates real dollar savings, comparing your current spend against the optimized version Visualizes everything on a dashboard — tokens saved, % reduction, active rules Plugs straight into your code via a Python SDK Becomes a browser extension, adding a "Shrink" button directly on ChatGPT, Claude.ai, Google AI Studio, and Poe In practice bash Package an entire project into optimized context promptshrink repo --path ./src --save-to-file context.txt Simulate monthly savings promptshrink calc --calls 100000 --tokens 800 --model gpt-4o Running calc on a scenario of [insert your real number here, e.g. "100k calls/month with gpt-4o"], the estimated savings came out to [$X per month] — just by trimming what's unnecessary before it reaches the model. Try it out The project is open source, with a CLI, a FastAPI backend, and a Python SDK. If you're running LLMs in production and want to stop paying for tokens that add zero value, check it out: 🔗 github.com/HeloisaPeGarcia/PromptShrink Feedback and PRs are very welcome — this is my first published project like this,
Python manages memory automatically, freeing developers from manual allocation and deallocation. It does this through two complementary mechanisms: reference counting and a generational garbage collector for cyclic references. This article covers how garbage collection works in CPython. In other implementations such as PyPy, it works under a different mechanism Reference Counting: The Primary Mechanism Every object in Python carries a reference count, a tally of how many references point to it. This count increments when: A new reference is assigned ( y = x ) It's stored in a container (list, dict, etc.) The object is passed into a function It decrements when: A reference goes out of scope A reference is reassigned del is manually called on a reference import sys x = [] y = x z = { " y " : y } print ( sys . getrefcount ( x )) # 4 (x + y + z + the arg to getrefcount) y = 1 del z print ( sys . getrefcount ( x )) # 2 (x + the arg to getrefcount) When the count hits zero, CPython deallocates the object immediately . This is a key difference from garbage-collected languages like Java, JS or the PyPy implementation, where collection timing is unpredictable. The Problem: Reference Cycles Reference counting alone cannot handle cyclic references, where objects reference each other and keep their counts above zero even when unreachable from the program: class MyClass : def __init__ ( self ): self . ref = None a = MyClass () b = MyClass () a . ref = b b . ref = a del a del b # a and b still reference each other -> the refcount never reaches 0 This causes a memory leak. The Solution: Generational Garbage Collector To catch scenarios like the above, Python includes a separate cyclic garbage collector, implemented in the gc module. It's based on the generational hypothesis : most objects die young, so recently created objects are checked more frequently than long-lived ones. Objects are organized into three generations : Generation Description Collection Frequency 0 Newly created
Block scope is an important concept in JavaScript. It means that a variable can be accessed only inside the block where it is declared. A block is usually written using curly braces { } . Blocks can be found in if statements, loops, functions, and other parts of JavaScript code. In JavaScript, let and const are block-scoped variables. For example: { let name = " Abishek " ; console . log ( name ); } Output: Abishek Here, the variable name can be used inside the block. If we try to use it outside the block, JavaScript will give an error because the variable is not available outside its block. The same rule applies to const . if ( true ) { const age = 22 ; console . log ( age ); } Output: 22 The variable age can only be accessed inside the if block. However, var works differently. It is not block-scoped . It is function-scoped. For example: if ( true ) { var city = " Chennai " ; } console . log ( city ); Output: Chennai This code works because var can be accessed outside the if block. If we try the same thing with let : if ( true ) { let city = " Chennai " ; } console . log ( city ); Output: ReferenceError: city is not defined This happens because city is block-scoped and cannot be accessed outside the if block. Block scope is useful because it prevents variables from being accidentally used or changed outside the area where they are needed. It also makes code easier to understand and maintain. So, the main thing to remember is: let and const have block scope, while var has function scope. In modern JavaScript, let and const are generally preferred over var .
So a bit of context, I've been doing testing for V.E.L.O.C.I.T.Y. Drone and initially, I just copied over a binary, but I wanted it to be a bit easier to setup, so I thought I'd make an installer for it, so it can register as a system tray app. So naturally, I looked up what's the best installer and up popped Inno Setup 7. So I used it and it worked fine I guess, then I saw they apparently charge $155 for individuals, up to $1195 for unlimited users and that locks you to a version, if you want a new version, you need to buy a new license... So per my usual, I built my own. It's smaller (tool), faster and completely cross-platform, using zstd with adjustable compression ratio, dependency checking, bundling, CI/CD updating, Delta-Updating, adding MSI compliance for managed deployments too and a few more nice to have features. I'm releasing it under Apache 2.0, so it's actually free and completely open-source, use it commercially, start the next Microsoft and release a billion copies using it, you don't owe me a penny. My reason for creating it, is like so many other times, I found that the industry gatekeeps actually making money out of software, tooling should be free, so the real products can be made, without any hidden fees. So my question to everyone is, do you need an installer? And have you been burnt in the past by hidden costs from 'open-source' releases that charge you once you hit a revenue floor?
submitted by /u/IcyAnywhere9603 [link] [留言]
submitted by /u/BrewedDoritos [link] [留言]
When I first got interested in cybersecurity, I thought it was all about tools. Nmap, Metasploit, Wireshark, Burp Suite. I downloaded them all, watched tutorials, and felt like a hacker. But the first time I tried to customize a scan or parse a weird log file, I hit a wall. I didn't know how to code. And in cybersecurity, that's like trying to be a chef without knowing how to use a knife. This article is for people who want to move beyond clicking buttons. Whether you're a beginner deciding where to start or a security analyst who wants to automate boring tasks, programming will change how you work. I'll cover why programming matters, what languages to learn, the concepts you'll actually use, projects to build, and how to think like both an attacker and a defender. Why programming isn't optional anymore Cybersecurity used to be more forgiving. You could run a vulnerability scanner, read the report, and call it a day. But threats have gotten more complex, and so have the defenses. Today, you need to: · Write scripts to analyze thousands of log lines in seconds. · Automate repetitive tasks like phishing email analysis or IP reputation checks. · Understand the code behind vulnerabilities so you can explain them to developers. · Build custom tools when existing ones don't fit your environment. · Test your own code for flaws before attackers find them. If you can't read or write code, you're limited to what someone else built. That's not a career; that's a hobby. Programming gives you the ability to solve problems no tool can solve out of the box. What "programming for cybersecurity" actually means It's not software engineering. You don't need to build a full web application or master design patterns. Instead, you use code as a tool for investigation, automation, and exploitation (ethically, of course). Different roles need different levels of programming: · SOC analysts might write Python scripts to correlate logs or query APIs. · Penetration testers write proof-of-conc
The Sliding Window pattern is one of the most vital algorithmic techniques for optimizing array and string problems. Instead of repeatedly processing overlapping subarrays - which leads to brute-force quadratic O(N^2) or O(N*K) complexities, the sliding window technique reuses previous computations to achieve linear time complexity $O(N)$ . In this guide, we will break down the mechanics, core variations, identification rules, real-world applications, and a curated list of 18 LeetCode problems with key solution strategies. 💡 What is the Sliding Window Pattern? A sliding window performs operations over a contiguous sub-segment (subarray or substring) of data structure. As the window "slides" across the array from left to right, elements entering and leaving the window are updated incrementally. Time Complexity Comparison Brute-Force Nested Loops: O(N^2) or O(N * K) Sliding Window Strategy: O(N) (each element is processed at most twice: once entering and once leaving) 🛠️ Recognition & Identification Rules When to Use Sliding Window Contiguous Input: The problem requires evaluating contiguous subarrays or substrings. Window Metric Criteria: You need to calculate statistics such as minimum/maximum length, sum, average, or character frequency targets. Monotonicity Property: Expanding the window strictly increases (or maintains) a target metric, while shrinking the window strictly decreases it (e.g., sum > K or at most K distinct elements over positive numbers). When NOT to Use Sliding Window Negative Numbers in Sum Constraints: If an array contains negative numbers and you are tracking a cumulative sum, expanding the window does not monotonically increase the sum. Use Prefix Sum + HashMap instead. Non-Contiguous Sequences: If the problem asks for subsequences (where elements do not need to be adjacent), sliding window fails. Non-Monotonic Metrics: If moving pointers does not give a predictable increase or decrease in your decision metric. 🔄 Fixed vs. Variable Length Slid
submitted by /u/Jwosty [link] [留言]