repo
stringlengths
7
106
readme
stringlengths
21
477k
description
stringlengths
4
350
topics
stringlengths
2
244
releases
int64
0
1k
contributors
int64
0
10k
pulls
int64
0
13.8k
commits
int64
1
268k
issues
int64
0
14.5k
branches
int64
1
4.52k
workflows
int64
0
116
openai/openai-cookbook
โœจ Navigate at cookbook.openai.com Example code and guides for accomplishing common tasks with the OpenAI API . To run these examples, you'll need an OpenAI account and associated API key ( create a free account here ). Set an environment variable called OPENAI_API_KEY with your API key. Alternatively, in most IDEs such as Visual Studio Code, you can create an .env file at the root of your repo containing OPENAI_API_KEY=<your API key> , which will be picked up by the notebooks. Most code examples are written in Python, though the concepts can be applied in any language. For other useful tools, guides and courses, check out these related resources from around the web . Contributing The OpenAI Cookbook is a community-driven resource. Whether you're submitting an idea, fixing a typo, adding a new guide, or improving an existing one, your contributions are greatly appreciated! Before contributing, read through the existing issues and pull requests to see if someone else is already working on something similar. That way you can avoid duplicating efforts. If there are examples or guides you'd like to see, feel free to suggest them on the issues page . If you'd like to contribute new content, make sure to read through our contribution guidelines . We welcome high-quality submissions of new examples and guides, as long as they meet our criteria and fit within the scope of the cookbook. The contents of this repo are automatically rendered into cookbook.openai.com based on registry.yaml .
Examples and guides for using the OpenAI API
openai,chatgpt,gpt-4,openai-api
0
1,142
743
859
35
23
2
immich-app/immich
High performance self-hosted photo and video management solution Catalร  Espaรฑol Franรงais Italiano ๆ—ฅๆœฌ่ชž ํ•œ๊ตญ์–ด Deutsch Nederlands Tรผrkรงe ไธญๆ–‡ ะ ัƒััะบะธะน Portuguรชs Brasileiro Svenska ุงู„ุนุฑุจูŠุฉ Disclaimer โš ๏ธ The project is under very active development. โš ๏ธ Expect bugs and breaking changes. โš ๏ธ Do not use the app as the only way to store your photos and videos. โš ๏ธ Always follow 3-2-1 backup plan for your precious photos and videos! Content Official Documentation Roadmap Demo Features Introduction Installation Contribution Guidelines Documentation You can find the main documentation, including installation guides, at https://immich.app/. Demo You can access the web demo at https://demo.immich.app For the mobile app, you can use https://demo.immich.app/api for the Server Endpoint URL bash title="Demo Credential" The credential email: demo@immich.app password: demo Spec: Free-tier Oracle VM - Amsterdam - 2.4Ghz quad-core ARM64 CPU, 24GB RAM Activities Features | Features | Mobile | Web | | :--------------------------------------------- | -------- | ----- | | Upload and view videos and photos | Yes | Yes | | Auto backup when the app is opened | Yes | N/A | | Prevent duplication of assets | Yes | Yes | | Selective album(s) for backup | Yes | N/A | | Download photos and videos to local device | Yes | Yes | | Multi-user support | Yes | Yes | | Album and Shared albums | Yes | Yes | | Scrubbable/draggable scrollbar | Yes | Yes | | Support raw formats | Yes | Yes | | Metadata view (EXIF, map) | Yes | Yes | | Search by metadata, objects, faces, and CLIP | Yes | Yes | | Administrative functions (user management) | No | Yes | | Background backup | Yes | N/A | | Virtual scroll | Yes | Yes | | OAuth support | Yes | Yes | | API Keys | N/A | Yes | | LivePhoto/MotionPhoto backup and playback | Yes | Yes | | Support 360 degree image display | No | Yes | | User-defined storage structure | Yes | Yes | | Public Sharing | No | Yes | | Archive and Favorites | Yes | Yes | | Global Map | Yes | Yes | | Partner Sharing | Yes | Yes | | Facial recognition and clustering | Yes | Yes | | Memories (x years ago) | Yes | Yes | | Offline support | Yes | No | | Read-only gallery | Yes | Yes | | Stacked Photos | Yes | Yes | Contributors Star History
High performance self-hosted photo and video management solution.
backup-tool,mobile-app,photo-gallery,photos,self-hosted,videos,flutter,nestjs,nodejs,google-photos-alternative
189
490
4,497
4,603
423
69
15
AykutSarac/jsoncrack.com
JSON Crack (formerly JSON Visio) The open-source JSON Editor. Learn more ยป Discord ยท Website ยท Issues ยท VS Code About the Project More Than a JSON Editor JSON Crack is a free, open-source data visualization app capable of visualizing data formats such as JSON, YAML, XML, CSV and more, into interactive graphs. With its intuitive and user-friendly interface, JSON Crack makes it easy to explore, analyze, and understand even the most complex data structures. Whether you're a developer working on a large-scale project or a data enthusiast looking to uncover hidden insights, JSON Crack has the tools and features you need to unlock the full potential of your data. Dark mode. Graph & Tree view modes. Transform & filter data with AI. Export to PNG, SVG, JPEG & clipboard. Zoom and panning support with touch gestures. Supports data formats like JSON, YAML, CSV, XML, TOML... JQ, JSON Schema, Decode JWT, Generate Types and interfaces. Wide range of tools - search graph, json path, validate, save to cloud... Embeddable iframe widgets. Recognition Built With Next.js Reaflow React.js Tailwind CSS Supabase Stay Up-to-Date JSON Crack officially launched as v1.0 on the 17th of February 2022 and we've come a long way so far. Watch releases of this repository to be notified of future updates: Getting Started To get a local copy up and running, please follow these simple steps. Prerequisites Here is what you need to be able to run JSON Crack. Node.js (Version: >=18.x) Pnpm (recommended) Development Setup Clone the repo into a public GitHub repository (or fork https://github.com/AykutSarac/jsoncrack.com/fork). If you plan to distribute the code, read the LICENSE for additional details. sh git clone https://github.com/AykutSarac/jsoncrack.com.git Go to the project folder sh cd jsoncrack.com Install packages with yarn sh pnpm install Run the project ```sh pnpm dev # Running on http://localhost:3000/ ``` Docker ๐Ÿณ A Dockerfile is provided in the root of the repository. If you want to run JSON Crack locally: ```console Build a Docker image with: docker build -t jsoncrack . Run locally with docker run docker run -p 8888:8080 jsoncrack Run locally with docker-compose docker-compose up -d Go to http://localhost:8888 ``` Contributing Please see our contributing guide . Good First Issues We have a list of help wanted that contain small features and bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process. Contributors License Distributed under the AGPLv3 License . See LICENSE for more information.
โœจ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML, CSV and more, into interactive graphs.
json,tool,react,visualization,graph,nextjs,diagrams,csv,yaml
20
28
135
1,513
37
1
2
heyxyz/hey
Hey Decentralized, and permissionless social media app ๐ŸŒฟ hey.xyz ยป Discord โ€ข Issues ๐ŸŒฟ About Hey Hey is a cutting-edge social media application that leverages the power of Lens Protocol ๐ŸŒฟ to create a decentralized and permissionless platform for users to interact, share, and engage with one another. With a focus on privacy, security, and user control, Hey aims to revolutionize the social media landscape by providing a more transparent and equitable digital environment for its users. ๐Ÿ“ฆ Environments | Name | Link | | ------- | ----------------------- | | Mainnet | https://hey.xyz | | Testnet | https://testnet.hey.xyz | | Staging | https://staging.hey.xyz | โœ… Community For a place to have open discussions on features, voice your ideas, or get help with general questions please visit our community at Discord . ๐Ÿ“Š Repo Activity ๐Ÿ’• Contributors We love contributors! Feel free to contribute to this project but please read the Contributing Guidelines before opening an issue or PR so you understand the branching strategy and local development environment. โš–๏ธ License Hey is open-sourced software licensed under the ยฉ AGPLv3 .
Hey is a decentralized and permissionless social media app built with Lens Protocol ๐ŸŒฟ
web3,blockchain,graphql,hacktoberfest,nextjs,react,social-media,typescript,arweave,ipfs
31
102
3,481
11,511
54
4
7
CodeEditApp/CodeEdit
CodeEdit for macOS CodeEdit is a code editor built by the community, for the community, written entirely and unapologetically for macOS. Features include syntax highlighting, code completion, project find and replace, snippets, terminal, task running, debugging, git integration, code review, extensions, and more. [!IMPORTANT] CodeEdit is currently in development and not yet recommended for production use, however you can take part in shaping it's future by test-driving pre-release versions and submitting an issue to let us know what you think. Table of Contents Motivation Mission Community Activity Contributing Contributors Sponsors Backers License Motivation Most editors in use today rely on Electron or other cross-platform frameworks, limiting their ability to fully utilize system resources. While Xcode provides a native experience, it is specifically designed for projects targeting Apple platforms. We think developers working on projects not written for Apple platforms deserve that same macOS-native experience we get with Xcode while unlocking the full potential of the Mac. This raised the question "what if such an editor existed?", a question that led to the creation of this concept , which our project aims to make a reality. Mission It is our commitment to keep CodeEdit open source and free forever, supported by the community. Our goal is to maintain a lightweight experience, similar to TextEdit, while being able to scale up to a more feature-rich experience, comparable to Xcode, as necessary. We strive to remain true to Apple's human interface guidelines and development patterns, ensuring CodeEdit looks and feels like an application developed by Apple themselves, which includes a meticulous attention to detail. Community Join our growing community on Discord and GitHub Discussions where we discuss and collaborate on all things CodeEdit. Don't be shy, jump right in and be part of the discussion! [!NOTE] We hold a weekly meetup on Discord every Saturday at 3pm UTC where we discuss latests development, feature requests, goals, and priorities. Join us Activity Contributing Be part of the next revolution in code editing by contributing to the project. This is a community-led effort, so we welcome as many contributors who can help. Read the Contribution Guide for more information. This project spans multiple repositories so instead of browsing issues in the issues tab, it may be helpful to find an issue to get started on in our project board . For issues we want to focus on that are most relevant at any given time, please see the issues scoped to our current iteration here . Contributors Austin Condiff ๐ŸŽจ ๐Ÿ’ป Lukas Pistrol ๐Ÿš‡ โš ๏ธ ๐Ÿ’ป Khan Winter ๐Ÿ’ป ๐Ÿ› Matthijs Eikelenboom ๐Ÿ’ป ๐Ÿ› Wouter Hennen ๐Ÿ’ป Wesley De Groot ๐Ÿš‡ โš ๏ธ ๐Ÿ’ป KaiTheRedNinja ๐Ÿ’ป Pavel Kasila ๐Ÿš‡ โš ๏ธ ๐Ÿ’ป Marco Carnevali ๐Ÿš‡ โš ๏ธ ๐Ÿ’ป Nanashi Li ๐Ÿ’ป ninjiacoder ๐Ÿ’ป Cihat Gรผndรผz ๐Ÿ’ป Rehatbir Singh ๐Ÿ’ป Angelk90 ๐Ÿ’ป Stef Kors ๐Ÿ’ป Chris Akring ๐Ÿ’ป highjeans ๐Ÿ’ป Jason Platts ๐Ÿš‡ ๐Ÿ”Œ Rob Hughes ๐Ÿ’ป Lingxi Li ๐Ÿ’ป ๐Ÿ› HZ.Liu ๐Ÿ’ป ๐Ÿ› Richard Topchii ๐Ÿ’ป Pythonen ๐Ÿ’ป Javier Solorzano ๐Ÿ’ป ๐Ÿ› Cosmin Anghel ๐Ÿ’ป Shivesh ๐Ÿ’ป Andrey Plotnikov ๐Ÿ’ป POPOBE97 ๐Ÿ’ป nrudnyk ๐Ÿ’ป Ben Koska ๐Ÿ’ป evolify ๐Ÿ› Shibo Tong ๐Ÿ’ป Ethan Wong ๐Ÿ’ป Gabriel Moreno ๐Ÿ› Sizhe Zhao ๐Ÿ› Muhammed Mahmood ๐Ÿ’ป ๐Ÿšง Muescha ๐Ÿ’ป Alex Sinelnikov ๐Ÿ’ป Heewon Cho ๐Ÿ› Matt Kiazyk ๐Ÿ’ป DingoBits ๐Ÿ’ป Shoto Kobayashi ๐Ÿ› ๐Ÿ’ป Aaryan Kothari ๐Ÿ› Kyle ๐Ÿ’ป Nakaoka Rei ๐Ÿ’ป ๐Ÿ› Alex Deem ๐Ÿšง deni zakya ๐Ÿ› Ahmad Yasser ๐Ÿ› ezraberch ๐Ÿ’ป Elias Wahl ๐Ÿ› bombardier200 ๐Ÿ’ป Alex Yapryntsev ๐Ÿ’ป Code-DJ ๐Ÿ’ป ๐Ÿ› Neilzon Viloria ๐Ÿ› Cubik ๐Ÿ› ๐Ÿ’ป Renan Greca ๐Ÿ’ป maxkel ๐Ÿ› ๐Ÿ’ป Scrap ๐Ÿ’ป iggy890 ๐Ÿ’ป Sara Tavares ๐Ÿ› ๐Ÿ’ป luah5 ๐Ÿ’ป Evan Wang ๐Ÿ’ป Dscyre Scotti ๐Ÿ’ป Tomรกลก Boฤa ๐Ÿ› Ahmed Attalla ๐Ÿ› ๐Ÿ’ป Esteban Borai ๐Ÿ’ป avinizhanov ๐Ÿ› ๐Ÿ’ป kmohsin11 ๐Ÿ› Axel Martinez ๐Ÿ› ๐Ÿ’ป Federico Zivolo ๐Ÿ’ป Elvis Wong ๐Ÿ› ฤฐbrahim ร‡etin ๐Ÿ› phlpsong ๐Ÿ› Ahnaf Mahmud ๐Ÿ’ป Dan K ๐Ÿ’ป Roscoe Rubin-Rottenberg ๐Ÿ’ป Paul Ebose ๐Ÿ› Daniel Zhu ๐Ÿ› Simon Whitaker ๐Ÿ› Sponsors Support CodeEdit's development by becoming a sponsor . Backers Support CodeEdit's development by becoming a backer . Thanks to all of our other backers @ivanvorobei @albertorestifo @rkusa @cadenkriese @petrjahoda @allejo @frousselet @wkillerud License Licensed under the MIT license . Related Repositories CodeEditKit CodeEditTextView CodeEditSourceEditor CodeEditLanguages CodeEditCLI
CodeEdit App for macOS โ€“ Elevate your code editing experience. Open source, free forever.
macos,apple,code-edit,swift,swiftui,ipados,ios,open-source,ide,code-editor
29
124
940
2,005
194
17
10
paperless-ngx/paperless-ngx
Paperless-ngx Paperless-ngx is a document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper . Paperless-ngx is the official successor to the original Paperless & Paperless-ng projects and is designed to distribute the responsibility of advancing and supporting the project among a team of people. Consider joining us! Thanks to the generous folks at DigitalOcean , a demo is available at demo.paperless-ngx.com using login demo / demo . Note: demo content is reset frequently and confidential information should not be uploaded. Features Getting started Contributing Community Support Translation Feature Requests Bugs Related Projects Important Note This project is supported by: Features A full list of features and screenshots are available in the documentation . Getting started The easiest way to deploy paperless is docker compose . The files in the /docker/compose directory are configured to pull the image from GitHub Packages. If you'd like to jump right in, you can configure a docker compose environment with our install script: bash bash -c "$(curl -L https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/install-paperless-ngx.sh)" More details and step-by-step guides for alternative installation methods can be found in the documentation . Migrating from Paperless-ng is easy, just drop in the new docker image! See the documentation on migrating for more details. Documentation The documentation for Paperless-ngx is available at https://docs.paperless-ngx.com . Contributing If you feel like contributing to the project, please do! Bug fixes, enhancements, visual fixes etc. are always welcome. If you want to implement something big: Please start a discussion about that! The documentation has some basic information on how to get started. Community Support People interested in continuing the work on paperless-ngx are encouraged to reach out here on github and in the Matrix Room . If you would like to contribute to the project on an ongoing basis there are multiple teams (frontend, ci/cd, etc) that could use your help so please reach out! Translation Paperless-ngx is available in many languages that are coordinated on Crowdin. If you want to help out by translating paperless-ngx into your language, please head over to https://crwd.in/paperless-ngx, and thank you! More details can be found in CONTRIBUTING.md . Feature Requests Feature requests can be submitted via GitHub Discussions , you can search for existing ideas, add your own and vote for the ones you care about. Bugs For bugs please open an issue or start a discussion if you have questions. Related Projects Please see the wiki for a user-maintained list of related projects and software that is compatible with Paperless-ngx. Important Note Document scanners are typically used to scan sensitive documents like your social insurance number, tax records, invoices, etc. Paperless-ngx should never be run on an untrusted host because information is stored in clear text without encryption. No guarantees are made regarding security (but we do try!) and you use the app at your own risk. The safest way to run Paperless-ngx is on a local server in your own home with backups in place .
A community-supported supercharged version of paperless: scan, index and archive all your physical documents
angular,archiving,django,dms,document-management,document-management-system,machine-learning,ocr,optical-character-recognition,pdf
86
312
2,210
9,317
0
17
6
hyprwm/Hyprland
![Badge Workflow] [![Badge License]][License] ![Badge Language] [![Badge Pull Requests]][Pull Requests] [![Badge Issues]][Issues] ![Badge Hi Mom] Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks. It provides the latest Wayland features, is highly customizable, has all the eyecandy, the most powerful plugins, easy IPC, much more QoL stuff than other wlr-based compositors and more... --- **[ Install ][Install]**โ€ƒ **[ Quick Start ][Quick Start]**โ€ƒ **[ Configure ][Configure]**โ€ƒ **[ Contribute ][Contribute]** --- Features All of the eyecandy: gradient borders, blur, animations, shadows and much more A lot of customization Much more QoL stuff than other wlr-based compositors Custom bezier curves for the best animations Powerful plugin support Built-in plugin manager Tearing support for better gaming performance Easily expandable and readable codebase Fast and active development Not afraid to provide bleeding-edge features Config reloaded instantly upon saving Fully dynamic workspaces Two built-in layouts and more available as plugins Uses forked wlroots with QoL patches Global keybinds passed to your apps of choice Tiling/pseudotiling/floating/fullscreen windows Special workspaces (scratchpads) Window groups (tabbed mode) Powerful window/monitor/layer rules Socket-based IPC Native IME and Input Panels Support and much more... # Gallery ![Preview A] ![Preview B] ![Preview C] Special Thanks wlroots - For their amazing library tinywl - For showing how 2 do stuff Sway - For showing how 2 do stuff the overkill way Vivarium - For showing how 2 do stuff the simple way dwl - For showing how 2 do stuff the hacky way Wayfire - For showing how 2 do some graphics stuff
Hyprland is a highly customizable dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
wayland,wayland-compositor,compositor,wlroots,cpp23
77
314
1,204
4,879
909
100
9
pyscript/pyscript
PyScript What is PyScript Summary PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of Pyodide , MicroPython and WASM , and modern web technologies. To get started see the Beginning PyScript tutorial . For examples see here . Other useful resources: The official technical docs . Our current Home Page on the web. A free-to-use online editor for trying PyScript. Our community Discord Channel , to keep in touch . Every Tuesday at 15:30 UTC there is the PyScript Community Call on zoom, where we can talk about PyScript development in the open. Most of the maintainers regularly participate in the call, and everybody is welcome to join. Every other Thursday at 16:00 UTC there is the PyScript FUN call: this is a call in which everybody is encouraged to show what they did with PyScript. For more details on how to join the calls and up to date schedule, consult the official calendar: Google calendar in UTC time; iCal format . Longer Version PyScript is a meta project that aims to combine multiple open technologies into a framework that allows users to create sophisticated browser applications with Python. It integrates seamlessly with the way the DOM works in the browser and allows users to add Python logic in a way that feels natural both to web and Python developers. Try PyScript To try PyScript, import the appropriate pyscript files into the <head> tag of your html page: ```html ``` You can then use PyScript components in your html page. PyScript currently offers various ways of running Python code: <script type="py"> : can be used to define python code that is executable within the web page. <script type="py" src="hello.py"> : same as above, but the python source is fetched from the given URL. <script type="py" terminal> : same as above, but also creates a terminal where to display stdout and stderr (e.g., the output of print() ); input() does not work. <script type="py" terminal worker> : run Python inside a web worker: the terminal is fully functional and input() works. <py-script> : same as <script type="py"> , but it is not recommended because if the code contains HTML tags, they could be parsed wrongly. <script type="mpy"> : same as above but use MicroPython instead of Python. Check out the official docs for more detailed documentation. How to Contribute Read the contributing guide to learn about our development process, reporting bugs and improvements, creating issues and asking questions. Check out the developing process documentation for more information on how to setup your development environment. Governance The PyScript organization governance is documented in a separate repository. Release To cut a new release of PyScript simply add a new release while remembering to write a comprehensive changelog. A GitHub action will kick in and ensure the release is described and deployed to a URL with the pattern: https://pyscript.net/releases/YYYY.M.v/ (year/month/version - as per our CalVer versioning scheme). Then, the following three separate repositories need updating: Documentation - Change the version.json file in the root of the directory and then node version-update.js . Homepage - Ensure the version referenced in index.html is the latest version. PSDC - Use discord or Anaconda Slack (if you work at Anaconda) to let the PSDC team know there's a new version, so they can update their project templates.
Try PyScript: https://pyscript.com Examples: https://tinyurl.com/pyscript-examples Community: https://discord.gg/HxvBtukrg2
python,html,javascript,wasm
21
121
1,065
1,159
21
12
6
djsime1/awesome-flipperzero
A collection of Awesome resources for the Flipper Zero device. ๐Ÿ‘‹ New to Flipper Zero? Got questions? Check out the FAQ Document โ— ๐Ÿšซ Not affiliated with Flipper Devices Inc. Table of Contents (Expandable) Databases & Dumps - [General](#general) - [Sub-GHz](#sub-ghz) - [NFC/RFID](#nfcrfid) - [Infrared](#infrared) - [BadUSB](#badusb) - [Music](#music) - [Other](#other) Applications & Plugins - [General](#general-1) - [Sub-GHz](#sub-ghz-1) - [Infrared](#infrared-1) - [BadUSB](#badusb-1) - [GPIO](#gpio) - [Bluetooth](#bluetooth) - [Games](#games) - [Utility/Other](#utilityother) Firmwares & Tweaks - [Official firmware (ofw)](#official-firmware-ofw) - [Custom firmware (cfw)](#custom-firmware-cfw) - [Outdated/Unmaintained firmware](#outdatedunmaintained-firmware) Graphics & Animations - [Tutorials](#tutorials) - [Pre-made animations](#pre-made-animations) - [Utilities](#utilities) Modules & Cases - [Modules](#modules) - [Cases](#cases) - [Other](#other) Off-device & Debugging - [General](#general-2) - [Converters](#converters) - [Development](#development) - [Utility](#utility) Notes & References - [Disassembly/Repair](#disassemblyrepair) - [Guides](#guides) - [Specifications](#specifications) - [Other](#other-2) Databases & Dumps Got a need for speed? ๐Ÿ“ฅ Look at this for an archive containing every item listed below! General UberGuidoZ Playground Large collection of files, documentation, and dumps of all kinds. Sub-GHz FlipperZero-TouchTunes Dumps of TouchTune's remote. T119 bruteforcer Triggers Retekess T119 restaurant pagers. flipperzero-bruteforce Generate .sub files to brute force Sub-GHz OOK. Flipperzero-Concert-Bracelets Sub-GHz file to trigger event LED bracelets. NFC/RFID FlipperAmiibo Bank vault of Amiibos to Flipper's format. Infrared Flipper-IRDB Many IR dumps for various appliances. BadUSB My-Flipper-Shits Free and open-source [BadUSB] payloads for Flipper Zero. Flipper BadUSB Payloads Collection of payloads formatted to work on the Flipper Zero. UNC0V3R3D BadUSB collection Yet another BadUSB collection. FalsePhilosophers Flipper BadUSB Flipper zero community ducky payload repo. Music FlipperMusicRTTTL Collection of musics for FlipperZero Music Player. flipper-music-files Much smaller collection of musics for FlipperZero Music Player. Other FlipperZero-Goodies Intercom keys, scripts, etc. Flipper-StarNew Universal Intercom Keys. Applications & Plugins Try official apps ๐Ÿ“ฑ The Flipper Zero also has an official app store! General Officially maintained apps Official apps maintained by the Flipper Team and collaborators. All the plugins Large collection of applications including some not published in the official catalog Sub-GHz Spectrum analyzer Sub-GHz frequency spectrum analyzer. Infrared Xbox Controller Easy controller for Xbox One with IR XRemote Advanced IR remote app for Flipper Zero BadUSB COM Port Scanner Emulator Barcode Scanner Emulator. USB HID Autofire Send left-clicks as a USB HID device. Mouse jiggler Keeps PC screens on by acting as a moving mouse. GPIO NRF24 & Mousejacking (outdated) PoC NRF24 library and mousejack exploitation app. Sentry Safe Plugin that can open any Sentry Safe and Master Lock electronic safe without entering pin code. GPS Display data from a serial GPS module. Unitemp Temperature, humidity and pressure sensors reader (DHT11/22, DS18B20, BMP280, HTU21x and more) Servo Tester Servo Tester App Bluetooth USB Keyboard (outdated) A refactor of the BT remote to work over USB. Allows the Flipper to act as an USB HID keyboard. ble_spam_ofw Application that spams broadcast packets to Apple, Android, and Windows. Games Tetris A rudimentary Tetris game. Flappy Bird The name says it all. T-Rex Runner Flipper zero port of Chrome's game. floopper-bloopper LD#47 Game. Doom Doom-like clone for Flipper Zero. Minesweeper Minesweeper implementation. Reversi The classic Reversi game Utility/Other Flipper-Plugin-Tutorial Updated plugin tutorial based on new build methods. Flipper Authenticator Generate TOTP authentication codes. Tuning Fork Use your Flipper as a tuning fork. UPC-A Barcode Generator Can be used to create any UPC-A barcode. Dec/Hex Converter Small "real time" decimal/hexadecimal converter. MultiConverter Multi-unit converter that can be easily expanded with new units and conversion methods. bpm-tapper Tap along to a song to measure beats per minute. Flipp Pomodoro Pomodoro Timer Tool for productivity. Firmwares & Tweaks Hey you! ๐Ÿ”ฐ Click here for a feature comparison of these firmwares! Official firmware (ofw) Official firmware The source code for Flipper's stock firmware. Custom firmware (cfw) Momentum Feature-rich, stable and customizable Flipper firmware: a direct continuation of the Xtreme firmware. Xtreme Official fork with cleaned up codebase, more module extensions and custom assets. Unleashed Unlocked firmware with rolling codes support & community plugins, stable tweaks, and games. RogueMaster Fork of Unleashed firmware with custom graphics, experimental tweaks, community plugins and games. Dexv Xtreme fork; The "Will it blend?" of custom firmwares. Outdated/Unmaintained firmware SquachWare Fork of official firmware which adds custom graphics, community applications & files. Wetox Very similar to the official branch, with a few small tweaks. Muddled Forks Less-active firmware modifications. OpenHaystack BLE mod Very old PoC that makes Flipper behave like an AirTag. v1nc flipper zero firmware Unleashed fork with support for different Duckyscript keyboard layouts & community plugins. Graphics & Animations Tutorials Flipper Zero Animation Process Google Doc step by step from Talking Sasquach. Lab401 Animation Video YouTube video with a step by step from Talking Sasquach. Pre-made animations Talking Sasquach Animations Literally wrote the book on making animations. Kuronons Graphics Custom animations, passport backgrounds & profile pictures. Haseosama Animations Great collection of custom animations. Animations by stopoxy Another great custom animation collection. Wr3nch Animations Some custom animations and scripts. Dexv Graphics Custom animations and resources. DoobTheGoober Animations Custom animations from the creator of zip2Animation UberGuidoZ Graphics Brief description and links to resources, including PYX host. Animations by mnenkov A dump with animations and manifest creator for batch files. Oneamongthetrees Animations/Graphics Collection of custom animations and passport icons. Utilities Flipper Animation Manager Visualize and manage animations directly from your computer. H4XV's Gif2Anim Gif2FlipperAnimation Converter zip2Animation Utility to assist in creating animations. Modules & Cases Cases Ultimate Flipper Zero Case 3D printed case with room for 3rd party modules & 2x WiFi dev board slots. FlipperZero-Hardware 3D-Printable cases with custom iButton interface. Flipper Zero Cases 3D-Printable case & cover models. Pelican case Big case to hold Flipper and USB. Hard case Smaller than pelican case, but still bulky. WiFi Module v1 Case Small cover for the WiFi dev board. Skadis holder Flipper Zero holder for Ikea Skadis. Flipper Zero Car Mount Uses foam from the original box. Soft TPU cover Similar to the official silicone case. Flipper-Boy Flipper Zero Case with 22mm Watch Strap Adapter. Modules ESP32 Marauder on WiFi dev board Portable WiFi/Bluetooth pentesting. ESP32 Marauder guide video Companion video for the above link. FlipperZero-Protoboards-Kicad KiCad prototype boards. WiFi Scanner Module Scans for WiFi networks via a custom Wemos module board. WiFi Scanner Module Flasher Web flasher for module firmware above. WiFi DSTIKE Deauther Preforms WiFi deauth attacks via a custom ESP8266 module board. WiFi Deauther Module Flasher Web flasher for module firmware above. Flipper Zero Boards ESP32 and NRF24 daughterboards for the Flipper. Flipper-Zero-Backpacks Backpack addon boards with ESP32, Raspberry Pi, Protoboards etc. WiFi Devboard Pelican Case Top case that works with the 4mm FZ Pelican case. The Mayhem Fin ESP32 with WiFi, BT/BLE, Micro-SD, Camera, Flashlight, NRF24/CC1101, and more. Other Flipper Zero screen protector Official screen protector for the Flipper Zero. FlipperZero RGB backlight Replacing stock backlight with RGB Off-device & Debugging General Official Web Interface Web interface to interact with Flipper, including Paint and SUB/IR analyzer. Flipper Maker Generate Flipper Zero files on the fly. Flipper File Toolbox Scripts for generating Flipper data files. Converters OOK to .sub Python script to generate Flipper RAW .sub files from OOK bitstreams. csv2ir Script to convert IRDB CSV's to Flipper .ir files. AmiiboFlipperConverter Script that converts Amiibo's to Flipper format. VertProntoIR2FlipperIR Converts Vert Pronto IR codes to Flipper format. FlippMibo Yet another Amiibo to Flipper conversion script. ClassicConverter Converts Mifare Classic binary files to Flipper. ClassicConverterWeb Converts between Mifare Classic binary and Flipper NFC file. musicxml2fmf Converts MusicXML files to Flipper Music Format. BadUSB keyboard converter Payload converted for non-US keyboard layouts. flipper2mct A script to convert Flipper NFC files to Mifare Classic Tools format for MC 1k & 4k. SerialHex2FlipperZeroInfrared Convert IR serial messages into FlipperZero compatible IR files. Development flipperzero-sesproject Segger Embedded Studio project. flipper0 Rusty crate with safe interface to Flipper Firmware and autogen bindings underneath. flipperzero-rs Hand-crafted bindings to Flipper Firmware with custom build tool. fzfs Flipper Zero filesystem driver. FBT-AARCH64 A script that sets up FBT's toolchain on ARM devices. Utility FlipperScripts Modify the state and level of your dolphin. Viewing system logs Dump system logs to serial CLI. CLI Tools Python scripts to screenshot/stream screen. Fztea Connect to your Flipper's UI over serial or make it accessible via SSH. pyFlipper Unofficial CLI wrapper writter in Python. SUB Plotters / comparers Python package to plot and compare multiple .sub files. U2F SSH Keys U2F ECDSA SSH Key Generation using Flipper Zero. Pagger Sub-GHz generators for restaurants/kiosks paging systems. Notes & References Need help using your Flipper Zero? ๐Ÿ“• Give the official documentation a read! Disassembly/Repair Official battery self-repair guide How to troubleshoot battery issues. Official firmware recovery guide How to troubleshoot firmware issues. Flipper Zero disassembly guide Difficulty: Moderate, Time: 8-15 Minutes. Alternative disassembly video Third-party video for disassembling the Flipper. Reset forgotten PIN How to reset your device's PIN code. Guides Flipper Zero Hacking 101 Guides with screenshots, files, and general help. Atmanos Flipper Software Docs Flipper development tutorials and information. Flipper Zero GPIO Pinout Official GPIO pinouts. Flipper Skylanders How to read a Skylanders figure with Flipper. Application CI/CD Guide A complete guide on how to adopt flipper application to regular API changes. Specifications Add-on Modules GPIO Pinouts ESP32, ESP8266, ESP32-CAM, ESP32-WROOM, NRF24. Flipper Zero Dimensions Basic info on screen and case dimensions. Other Firmware roadmap (outdated?) Official stock firmware roadmap. Flipper Zero SW&HW keynote (outdated) Hardware & software architecture document. ๐Ÿ†• Want to make changes? โœจ You can Edit this file and open a Pull Request, or Start a discussion with your ideas. Read the Meta FAQ section for more info.
๐Ÿฌ A collection of awesome resources for the Flipper Zero device.
flipperzero,flipper-zero,awesome,awesome-list
0
37
112
90
0
4
0
ReVanced/revanced-manager
Continuing the legacy of Vanced ๐Ÿ’Š ReVanced Manager Application to use ReVanced on Android โ“ About ReVanced Manager is an application that uses ReVanced Patcher to patch Android apps. ๐Ÿ’ช Features Some of the features ReVanced Manager provides are: ๐Ÿ’‰ Patch apps : Apply any patch of your choice to Android apps ๐Ÿ“ฑ Portable : ReVanced Patcher that fits in your pocket ๐Ÿค— Simple UI : Quickly understand the ins and outs of ReVanced Manager ๐Ÿ› ๏ธ Customization : Configurable API, custom sources, language, signing keystore, theme and more ๐Ÿ”ฝ Download You can download the most recent version of ReVanced Manager at revanced.app/download or from GitHub releases . Learn how to use ReVanced Manager by following the documentation . ๐Ÿ“š Everything else ๐Ÿ“™ Contributing Thank you for considering contributing to ReVanced Manager. You can find the contribution guidelines here . ๐Ÿ› ๏ธ Building To build a ReVanced Manager, you can follow the documentation . ๐Ÿ“„ Documentation You can find the documentation for ReVanced Manager here . ๐Ÿ‘‹ Contributing Thank you for considering contributing to ReVanced Manager. You can find the contribution guidelines here . โš–๏ธ License ReVanced Manager is licensed under the GPLv3 license. Please see the license file for more information. tl;dr you may copy, distribute and modify ReVanced Manager as long as you track changes/dates in source files. Any modifications to ReVanced Manager must also be made available under the GPL, along with build & install instructions.
๐Ÿ’Š Application to use ReVanced on Android
revanced,manager,android,modding,patching,flutter,flutter-apps
146
60
624
1,168
114
16
5
Grasscutters/Grasscutter
EN | ็ฎ€ไธญ | ็นไธญ | FR | ES | HE | RU | PL | ID | KR | FIL/PH | NL | JP | IT | VI Attention: We always welcome contributors to the project. Before adding your contribution, please carefully read our Code of Conduct . Current features Logging in Combat Friends list Teleportation Gacha system Co-op partially works Spawning monsters via console Inventory features (receiving items/characters, upgrading items/characters, etc) Quick setup guide Note : For support please join our Discord . Quick Start (automatic) Get Java 17 Get MongoDB Community Server Get game version REL4.0.x (If you don't have a 4.0.x client, you can find it here and open any of the links to download it): 4.0.x Client-github 4.0.x Client-cloud drive Download the latest Cultivation version . Use the .msi installer. After opening Cultivation (as admin), press the download button in the upper right corner. Click Download All-in-One Click the gear in the upper right corner Set the game Install path to where your game is located. Set the Custom Java Path to C:\Program Files\Java\jdk-17\bin\java.exe Leave all other settings on default Click the small button next to launch. Click the launch button. Log in with whatever username you want. Password can be anything. Building Grasscutter uses Gradle to handle dependencies & building. Requirements: Java Development Kit 17 or higher Git NodeJS (Optional, for building the handbook) Clone shell git clone --recurse-submodules https://github.com/Grasscutters/Grasscutter.git cd Grasscutter Compile Note : Handbook generation may fail on some systems. To disable the handbook generation, append -PskipHandbook=1 to the gradlew jar command. Windows: shell .\gradlew.bat # Setting up environments .\gradlew jar Linux (GNU): bash chmod +x gradlew ./gradlew jar Compiling the Handbook (Manually) With Gradle: shell ./gradlew generateHandbook With NPM: shell cd src/handbook npm install npm run build You can find the output jar in the root of the project folder. Troubleshooting For a list of common issues and solutions and to ask for help, please join our Discord server and go to the support channel.
A server software reimplementation for a certain anime game.
java,kcp,server,private-server
20
192
1,227
2,313
138
6
6
android/nowinandroid
Now in Android App Learn how this app was designed and built in the design case study , architecture learning journey and modularization learning journey . This is the repository for the Now in Android app. It is a work in progress ๐Ÿšง. Now in Android is a fully functional Android app built entirely with Kotlin and Jetpack Compose. It follows Android design and development best practices and is intended to be a useful reference for developers. As a running app, it's intended to help developers keep up-to-date with the world of Android development by providing regular news updates. The app is currently in development. The prodRelease variant is available on the Play Store . Features Now in Android displays content from the Now in Android series. Users can browse for links to recent videos, articles and other content. Users can also follow topics they are interested in, and be notified when new content is published which matches interests they are following. Screenshots Development Environment Now in Android uses the Gradle build system and can be imported directly into Android Studio (make sure you are using the latest stable version available here ). Change the run configuration to app . The demoDebug and demoRelease build variants can be built and run (the prod variants use a backend server which is not currently publicly available). Once you're up and running, you can refer to the learning journeys below to get a better understanding of which libraries and tools are being used, the reasoning behind the approaches to UI, testing, architecture and more, and how all of these different pieces of the project fit together to create a complete app. Architecture The Now in Android app follows the official architecture guidance and is described in detail in the architecture learning journey . Modularization The Now in Android app has been fully modularized and you can find the detailed guidance and description of the modularization strategy used in modularization learning journey . Build The app contains the usual debug and release build variants. In addition, the benchmark variant of app is used to test startup performance and generate a baseline profile (see below for more information). app-nia-catalog is a standalone app that displays the list of components that are stylized for Now in Android . The app also uses product flavors to control where content for the app should be loaded from. The demo flavor uses static local data to allow immediate building and exploring of the UI. The prod flavor makes real network calls to a backend server, providing up-to-date content. At this time, there is not a public backend available. For normal development use the demoDebug variant. For UI performance testing use the demoRelease variant. Testing To facilitate testing of components, Now in Android uses dependency injection with Hilt . Most data layer components are defined as interfaces. Then, concrete implementations (with various dependencies) are bound to provide those interfaces to other components in the app. In tests, Now in Android notably does not use any mocking libraries. Instead, the production implementations can be replaced with test doubles using Hilt's testing APIs (or via manual constructor injection for ViewModel tests). These test doubles implement the same interface as the production implementations and generally provide a simplified (but still realistic) implementation with additional testing hooks. This results in less brittle tests that may exercise more production code, instead of just verifying specific calls against mocks. Examples: - In instrumentation tests, a temporary folder is used to store the user's preferences, which is wiped after each test. This allows using the real DataStore and exercising all related code, instead of mocking the flow of data updates. There are Test implementations of each repository, which implement the normal, full repository interface and also provide test-only hooks. ViewModel tests use these Test repositories, and thus can use the test-only hooks to manipulate the state of the Test repository and verify the resulting behavior, instead of checking that specific repository methods were called. To run the tests execute the following gradle tasks: testDemoDebug run all local tests against the demoDebug variant. connectedDemoDebugAndroidTest run all instrumented tests against the demoDebug variant. Note: You should not run ./gradlew test or ./gradlew connectedAndroidTest as this will execute tests against all build variants which is both unecessary and will result in failures as only the demoDebug variant is supported. No other variants have any tests (although this might change in future). Screenshot tests A screenshot test takes a screenshot of a screen or a UI component within the app, and compares it with a previously recorded screenshot which is known to be rendered correctly. For example, Now in Android has screenshot tests to verify that the navigation is displayed correctly on different screen sizes ( known correct screenshots ). Now In Android uses Roborazzi to run screenshot tests of certain screens and UI components. When working with screenshot tests the following gradle tasks are useful: verifyRoborazziDemoDebug run all screenshot tests, verifying the screenshots against the known correct screenshots. recordRoborazziDemoDebug record new "known correct" screenshots. Use this command when you have made changes to the UI and manually verified that they are rendered correctly. Screenshots will be stored in modulename/src/test/screenshots . compareRoborazziDemoDebug create comparison images between failed tests and the known correct images. These can also be found in modulename/src/test/screenshots . Note: The known correct screenshots stored in this repository are recorded on CI using Linux. Other platforms may (and probably will) generate slightly different images, making the screenshot tests fail. When working on a non-Linux platform, a workaround to this is to run recordRoborazziDemoDebug on the main branch before starting work. After making changes, verifyRoborazziDemoDebug will identify only legitimate changes. For more information about screenshot testing check out this talk . UI The app was designed using Material 3 guidelines . Learn more about the design process and obtain the design files in the Now in Android Material 3 Case Study (design assets also available as a PDF ). The Screens and UI elements are built entirely using Jetpack Compose . The app has two themes: Dynamic color - uses colors based on the user's current color theme (if supported) Default theme - uses predefined colors when dynamic color is not supported Each theme also supports dark mode. The app uses adaptive layouts to support different screen sizes . Find out more about the UI architecture here . Performance Benchmarks Find all tests written using Macrobenchmark in the benchmarks module. This module also contains the test to generate the Baseline profile. Baseline profiles The baseline profile for this app is located at app/src/main/baseline-prof.txt . It contains rules that enable AOT compilation of the critical user path taken during app launch. For more information on baseline profiles, read this document . [!NOTE] The baseline profile needs to be re-generated for release builds that touch code which changes app startup. To generate the baseline profile, select the benchmark build variant and run the BaselineProfileGenerator benchmark test on an AOSP Android Emulator. Then copy the resulting baseline profile from the emulator to app/src/main/baseline-prof.txt . Compose compiler metrics Run the following command to get and analyse compose compiler metrics: bash ./gradlew assembleRelease -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true The reports files will be added to build/compose-reports . The metrics files will also be added to build/compose-metrics . For more information on Compose compiler metrics, see this blog post . License Now in Android is distributed under the terms of the Apache License (Version 2.0). See the license for more information.
A fully functional Android app built entirely with Kotlin and Jetpack Compose
android,jetpack-compose,kotlin
2
117
998
2,268
137
111
2
samber/lo
lo - Iterate over slices, maps, channels... โœจ samber/lo is a Lodash-style Go library based on Go 1.18+ Generics. This project started as an experiment with the new generics implementation. It may look like Lodash in some aspects. I used to code with the fantastic "go-funk" package, but "go-funk" uses reflection and therefore is not typesafe. As expected, benchmarks demonstrate that generics are much faster than implementations based on the "reflect" package. Benchmarks also show similar performance gains compared to pure for loops. See below . In the future, 5 to 10 helpers will overlap with those coming into the Go standard library (under package names slices and maps ). I feel this library is legitimate and offers many more valuable abstractions. See also: samber/do : A dependency injection toolkit based on Go 1.18+ Generics samber/mo : Monads based on Go 1.18+ Generics (Option, Result, Either...) Why this name? I wanted a short name , similar to "Lodash" and no Go package currently uses this name. ๐Ÿš€ Install sh go get github.com/samber/lo@v1 This library is v1 and follows SemVer strictly. No breaking changes will be made to exported APIs before v2.0.0. This library has no dependencies outside the Go standard library. ๐Ÿ’ก Usage You can import lo using: go import ( "github.com/samber/lo" lop "github.com/samber/lo/parallel" ) Then use one of the helpers below: go names := lo.Uniq[string]([]string{"Samuel", "John", "Samuel"}) // []string{"Samuel", "John"} Most of the time, the compiler will be able to infer the type so that you can call: lo.Uniq([]string{...}) . Tips for lazy developers I cannot recommend it, but in case you are too lazy for repeating lo. everywhere, you can import the entire library into the namespace. go import ( . "github.com/samber/lo" ) I take no responsibility on this junk. ๐Ÿ˜ ๐Ÿ’ฉ ๐Ÿค  Spec GoDoc: https://godoc.org/github.com/samber/lo Supported helpers for slices: Filter Map FilterMap FlatMap Reduce ReduceRight ForEach Times Uniq UniqBy GroupBy Chunk PartitionBy Flatten Interleave Shuffle Reverse Fill Repeat RepeatBy KeyBy Associate / SliceToMap Drop DropRight DropWhile DropRightWhile Reject Count CountBy CountValues CountValuesBy Subset Slice Replace ReplaceAll Compact IsSorted IsSortedByKey Supported helpers for maps: Keys ValueOr Values PickBy PickByKeys PickByValues OmitBy OmitByKeys OmitByValues Entries / ToPairs FromEntries / FromPairs Invert Assign (merge of maps) MapKeys MapValues MapEntries MapToSlice Supported math helpers: Range / RangeFrom / RangeWithSteps Clamp Sum SumBy Supported helpers for strings: RandomString Substring ChunkString RuneLength Supported helpers for tuples: T2 -> T9 Unpack2 -> Unpack9 Zip2 -> Zip9 Unzip2 -> Unzip9 Supported helpers for channels: ChannelDispatcher SliceToChannel Generator Buffer BufferWithTimeout FanIn FanOut Supported intersection helpers: Contains ContainsBy Every EveryBy Some SomeBy None NoneBy Intersect Difference Union Without WithoutEmpty Supported search helpers: IndexOf LastIndexOf Find FindIndexOf FindLastIndexOf FindOrElse FindKey FindKeyBy FindUniques FindUniquesBy FindDuplicates FindDuplicatesBy Min MinBy Max MaxBy Last Nth Sample Samples Conditional helpers: Ternary TernaryF If / ElseIf / Else Switch / Case / Default Type manipulation helpers: IsNil ToPtr EmptyableToPtr FromPtr FromPtrOr ToSlicePtr ToAnySlice FromAnySlice Empty IsEmpty IsNotEmpty Coalesce Function helpers: Partial Partial2 -> Partial5 Concurrency helpers: Attempt AttemptWhile AttemptWithDelay AttemptWhileWithDelay Debounce DebounceBy Synchronize Async Transaction Error handling: Validate Must Try Try1 -> Try6 TryOr TryOr1 -> TryOr6 TryCatch TryWithErrorValue TryCatchWithErrorValue ErrorsAs Constraints: Clonable Filter Iterates over a collection and returns an array of all the elements the predicate function returns true for. go even := lo.Filter([]int{1, 2, 3, 4}, func(x int, index int) bool { return x%2 == 0 }) // []int{2, 4} [ play ] Map Manipulates a slice of one type and transforms it into a slice of another type: ```go import "github.com/samber/lo" lo.Map([]int64{1, 2, 3, 4}, func(x int64, index int) string { return strconv.FormatInt(x, 10) }) // []string{"1", "2", "3", "4"} ``` [ play ] Parallel processing: like lo.Map() , but the mapper function is called in a goroutine. Results are returned in the same order. ```go import lop "github.com/samber/lo/parallel" lop.Map([]int64{1, 2, 3, 4}, func(x int64, _ int) string { return strconv.FormatInt(x, 10) }) // []string{"1", "2", "3", "4"} ``` FilterMap Returns a slice which obtained after both filtering and mapping using the given callback function. The callback function should return two values: the result of the mapping operation and whether the result element should be included or not. go matching := lo.FilterMap([]string{"cpu", "gpu", "mouse", "keyboard"}, func(x string, _ int) (string, bool) { if strings.HasSuffix(x, "pu") { return "xpu", true } return "", false }) // []string{"xpu", "xpu"} [ play ] FlatMap Manipulates a slice and transforms and flattens it to a slice of another type. The transform function can either return a slice or a nil , and in the nil case no value is added to the final slice. go lo.FlatMap([]int{0, 1, 2}, func(x int, _ int) []string { return []string{ strconv.FormatInt(x, 10), strconv.FormatInt(x, 10), } }) // []string{"0", "0", "1", "1", "2", "2"} [ play ] Reduce Reduces a collection to a single value. The value is calculated by accumulating the result of running each element in the collection through an accumulator function. Each successive invocation is supplied with the return value returned by the previous call. go sum := lo.Reduce([]int{1, 2, 3, 4}, func(agg int, item int, _ int) int { return agg + item }, 0) // 10 [ play ] ReduceRight Like lo.Reduce except that it iterates over elements of collection from right to left. go result := lo.ReduceRight([][]int{{0, 1}, {2, 3}, {4, 5}}, func(agg []int, item []int, _ int) []int { return append(agg, item...) }, []int{}) // []int{4, 5, 2, 3, 0, 1} [ play ] ForEach Iterates over elements of a collection and invokes the function over each element. ```go import "github.com/samber/lo" lo.ForEach([]string{"hello", "world"}, func(x string, _ int) { println(x) }) // prints "hello\nworld\n" ``` [ play ] Parallel processing: like lo.ForEach() , but the callback is called as a goroutine. ```go import lop "github.com/samber/lo/parallel" lop.ForEach([]string{"hello", "world"}, func(x string, _ int) { println(x) }) // prints "hello\nworld\n" or "world\nhello\n" ``` Times Times invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with index as argument. ```go import "github.com/samber/lo" lo.Times(3, func(i int) string { return strconv.FormatInt(int64(i), 10) }) // []string{"0", "1", "2"} ``` [ play ] Parallel processing: like lo.Times() , but callback is called in goroutine. ```go import lop "github.com/samber/lo/parallel" lop.Times(3, func(i int) string { return strconv.FormatInt(int64(i), 10) }) // []string{"0", "1", "2"} ``` Uniq Returns a duplicate-free version of an array, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array. go uniqValues := lo.Uniq([]int{1, 2, 2, 1}) // []int{1, 2} [ play ] UniqBy Returns a duplicate-free version of an array, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array. It accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed. go uniqValues := lo.UniqBy([]int{0, 1, 2, 3, 4, 5}, func(i int) int { return i%3 }) // []int{0, 1, 2} [ play ] GroupBy Returns an object composed of keys generated from the results of running each element of collection through iteratee. ```go import lo "github.com/samber/lo" groups := lo.GroupBy([]int{0, 1, 2, 3, 4, 5}, func(i int) int { return i%3 }) // map[int][]int{0: []int{0, 3}, 1: []int{1, 4}, 2: []int{2, 5}} ``` [ play ] Parallel processing: like lo.GroupBy() , but callback is called in goroutine. ```go import lop "github.com/samber/lo/parallel" lop.GroupBy([]int{0, 1, 2, 3, 4, 5}, func(i int) int { return i%3 }) // map[int][]int{0: []int{0, 3}, 1: []int{1, 4}, 2: []int{2, 5}} ``` Chunk Returns an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements. ```go lo.Chunk([]int{0, 1, 2, 3, 4, 5}, 2) // [][]int{{0, 1}, {2, 3}, {4, 5}} lo.Chunk([]int{0, 1, 2, 3, 4, 5, 6}, 2) // [][]int{{0, 1}, {2, 3}, {4, 5}, {6}} lo.Chunk([]int{}, 2) // [][]int{} lo.Chunk([]int{0}, 2) // [][]int{{0}} ``` [ play ] PartitionBy Returns an array of elements split into groups. The order of grouped values is determined by the order they occur in collection. The grouping is generated from the results of running each element of collection through iteratee. ```go import lo "github.com/samber/lo" partitions := lo.PartitionBy([]int{-2, -1, 0, 1, 2, 3, 4, 5}, func(x int) string { if x < 0 { return "negative" } else if x%2 == 0 { return "even" } return "odd" }) // [][]int{{-2, -1}, {0, 2, 4}, {1, 3, 5}} ``` [ play ] Parallel processing: like lo.PartitionBy() , but callback is called in goroutine. Results are returned in the same order. ```go import lop "github.com/samber/lo/parallel" partitions := lop.PartitionBy([]int{-2, -1, 0, 1, 2, 3, 4, 5}, func(x int) string { if x < 0 { return "negative" } else if x%2 == 0 { return "even" } return "odd" }) // [][]int{{-2, -1}, {0, 2, 4}, {1, 3, 5}} ``` Flatten Returns an array a single level deep. go flat := lo.Flatten([][]int{{0, 1}, {2, 3, 4, 5}}) // []int{0, 1, 2, 3, 4, 5} [ play ] Interleave Round-robin alternating input slices and sequentially appending value at index into result. ```go interleaved := lo.Interleave([]int{1, 4, 7}, []int{2, 5, 8}, []int{3, 6, 9}) // []int{1, 2, 3, 4, 5, 6, 7, 8, 9} interleaved := lo.Interleave([]int{1}, []int{2, 5, 8}, []int{3, 6}, []int{4, 7, 9, 10}) // []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} ``` [ play ] Shuffle Returns an array of shuffled values. Uses the Fisher-Yates shuffle algorithm. go randomOrder := lo.Shuffle([]int{0, 1, 2, 3, 4, 5}) // []int{1, 4, 0, 3, 5, 2} [ play ] Reverse Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on. โš ๏ธ This helper is mutable . This behavior might change in v2.0.0 . See #160 . go reverseOrder := lo.Reverse([]int{0, 1, 2, 3, 4, 5}) // []int{5, 4, 3, 2, 1, 0} [ play ] Fill Fills elements of array with initial value. ```go type foo struct { bar string } func (f foo) Clone() foo { return foo{f.bar} } initializedSlice := lo.Fill([]foo{foo{"a"}, foo{"a"}}, foo{"b"}) // []foo{foo{"b"}, foo{"b"}} ``` [ play ] Repeat Builds a slice with N copies of initial value. ```go type foo struct { bar string } func (f foo) Clone() foo { return foo{f.bar} } slice := lo.Repeat(2, foo{"a"}) // []foo{foo{"a"}, foo{"a"}} ``` [ play ] RepeatBy Builds a slice with values returned by N calls of callback. ```go slice := lo.RepeatBy(0, func (i int) string { return strconv.FormatInt(int64(math.Pow(float64(i), 2)), 10) }) // []string{} slice := lo.RepeatBy(5, func(i int) string { return strconv.FormatInt(int64(math.Pow(float64(i), 2)), 10) }) // []string{"0", "1", "4", "9", "16"} ``` [ play ] KeyBy Transforms a slice or an array of structs to a map based on a pivot callback. ```go m := lo.KeyBy([]string{"a", "aa", "aaa"}, func(str string) int { return len(str) }) // map[int]string{1: "a", 2: "aa", 3: "aaa"} type Character struct { dir string code int } characters := []Character{ {dir: "left", code: 97}, {dir: "right", code: 100}, } result := lo.KeyBy(characters, func(char Character) string { return string(rune(char.code)) }) //map[a:{dir:left code:97} d:{dir:right code:100}] ``` [ play ] Associate (alias: SliceToMap) Returns a map containing key-value pairs provided by transform function applied to elements of the given slice. If any of two pairs would have the same key the last one gets added to the map. The order of keys in returned map is not specified and is not guaranteed to be the same from the original array. ```go in := []*foo{{baz: "apple", bar: 1}, {baz: "banana", bar: 2}} aMap := lo.Associate(in, func (f *foo) (string, int) { return f.baz, f.bar }) // map[string][int]{ "apple":1, "banana":2 } ``` [ play ] Drop Drops n elements from the beginning of a slice or array. go l := lo.Drop([]int{0, 1, 2, 3, 4, 5}, 2) // []int{2, 3, 4, 5} [ play ] DropRight Drops n elements from the end of a slice or array. go l := lo.DropRight([]int{0, 1, 2, 3, 4, 5}, 2) // []int{0, 1, 2, 3} [ play ] DropWhile Drop elements from the beginning of a slice or array while the predicate returns true. go l := lo.DropWhile([]string{"a", "aa", "aaa", "aa", "aa"}, func(val string) bool { return len(val) <= 2 }) // []string{"aaa", "aa", "aa"} [ play ] DropRightWhile Drop elements from the end of a slice or array while the predicate returns true. go l := lo.DropRightWhile([]string{"a", "aa", "aaa", "aa", "aa"}, func(val string) bool { return len(val) <= 2 }) // []string{"a", "aa", "aaa"} [ play ] Reject The opposite of Filter, this method returns the elements of collection that predicate does not return truthy for. go odd := lo.Reject([]int{1, 2, 3, 4}, func(x int, _ int) bool { return x%2 == 0 }) // []int{1, 3} [ play ] Count Counts the number of elements in the collection that compare equal to value. go count := lo.Count([]int{1, 5, 1}, 1) // 2 [ play ] CountBy Counts the number of elements in the collection for which predicate is true. go count := lo.CountBy([]int{1, 5, 1}, func(i int) bool { return i < 4 }) // 2 [ play ] CountValues Counts the number of each element in the collection. ```go lo.CountValues([]int{}) // map[int]int{} lo.CountValues([]int{1, 2}) // map[int]int{1: 1, 2: 1} lo.CountValues([]int{1, 2, 2}) // map[int]int{1: 1, 2: 2} lo.CountValues([]string{"foo", "bar", ""}) // map[string]int{"": 1, "foo": 1, "bar": 1} lo.CountValues([]string{"foo", "bar", "bar"}) // map[string]int{"foo": 1, "bar": 2} ``` [ play ] CountValuesBy Counts the number of each element in the collection. It ss equivalent to chaining lo.Map and lo.CountValues. ```go isEven := func(v int) bool { return v%2==0 } lo.CountValuesBy([]int{}, isEven) // map[bool]int{} lo.CountValuesBy([]int{1, 2}, isEven) // map[bool]int{false: 1, true: 1} lo.CountValuesBy([]int{1, 2, 2}, isEven) // map[bool]int{false: 1, true: 2} length := func(v string) int { return len(v) } lo.CountValuesBy([]string{"foo", "bar", ""}, length) // map[int]int{0: 1, 3: 2} lo.CountValuesBy([]string{"foo", "bar", "bar"}, length) // map[int]int{3: 3} ``` [ play ] Subset Returns a copy of a slice from offset up to length elements. Like slice[start:start+length] , but does not panic on overflow. ```go in := []int{0, 1, 2, 3, 4} sub := lo.Subset(in, 2, 3) // []int{2, 3, 4} sub := lo.Subset(in, -4, 3) // []int{1, 2, 3} sub := lo.Subset(in, -2, math.MaxUint) // []int{3, 4} ``` [ play ] Slice Returns a copy of a slice from start up to, but not including end . Like slice[start:end] , but does not panic on overflow. ```go in := []int{0, 1, 2, 3, 4} slice := lo.Slice(in, 0, 5) // []int{0, 1, 2, 3, 4} slice := lo.Slice(in, 2, 3) // []int{2} slice := lo.Slice(in, 2, 6) // []int{2, 3, 4} slice := lo.Slice(in, 4, 3) // []int{} ``` [ play ] Replace Returns a copy of the slice with the first n non-overlapping instances of old replaced by new. ```go in := []int{0, 1, 0, 1, 2, 3, 0} slice := lo.Replace(in, 0, 42, 1) // []int{42, 1, 0, 1, 2, 3, 0} slice := lo.Replace(in, -1, 42, 1) // []int{0, 1, 0, 1, 2, 3, 0} slice := lo.Replace(in, 0, 42, 2) // []int{42, 1, 42, 1, 2, 3, 0} slice := lo.Replace(in, 0, 42, -1) // []int{42, 1, 42, 1, 2, 3, 42} ``` [ play ] ReplaceAll Returns a copy of the slice with all non-overlapping instances of old replaced by new. ```go in := []int{0, 1, 0, 1, 2, 3, 0} slice := lo.ReplaceAll(in, 0, 42) // []int{42, 1, 42, 1, 2, 3, 42} slice := lo.ReplaceAll(in, -1, 42) // []int{0, 1, 0, 1, 2, 3, 0} ``` [ play ] Compact Returns a slice of all non-zero elements. ```go in := []string{"", "foo", "", "bar", ""} slice := lo.Compact string // []string{"foo", "bar"} ``` [ play ] IsSorted Checks if a slice is sorted. go slice := lo.IsSorted([]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}) // true [ play ] IsSortedByKey Checks if a slice is sorted by iteratee. go slice := lo.IsSortedByKey([]string{"a", "bb", "ccc"}, func(s string) int { return len(s) }) // true [ play ] Keys Creates an array of the map keys. go keys := lo.Keys[string, int](map[string]int{"foo": 1, "bar": 2}) // []string{"foo", "bar"} [ play ] Values Creates an array of the map values. go values := lo.Values[string, int](map[string]int{"foo": 1, "bar": 2}) // []int{1, 2} [ play ] ValueOr Returns the value of the given key or the fallback value if the key is not present. ```go value := lo.ValueOr string, int // 1 value := lo.ValueOr string, int // 42 ``` [ play ] PickBy Returns same map type filtered by given predicate. go m := lo.PickBy(map[string]int{"foo": 1, "bar": 2, "baz": 3}, func(key string, value int) bool { return value%2 == 1 }) // map[string]int{"foo": 1, "baz": 3} [ play ] PickByKeys Returns same map type filtered by given keys. go m := lo.PickByKeys(map[string]int{"foo": 1, "bar": 2, "baz": 3}, []string{"foo", "baz"}) // map[string]int{"foo": 1, "baz": 3} [ play ] PickByValues Returns same map type filtered by given values. go m := lo.PickByValues(map[string]int{"foo": 1, "bar": 2, "baz": 3}, []int{1, 3}) // map[string]int{"foo": 1, "baz": 3} [ play ] OmitBy Returns same map type filtered by given predicate. go m := lo.OmitBy(map[string]int{"foo": 1, "bar": 2, "baz": 3}, func(key string, value int) bool { return value%2 == 1 }) // map[string]int{"bar": 2} [ play ] OmitByKeys Returns same map type filtered by given keys. go m := lo.OmitByKeys(map[string]int{"foo": 1, "bar": 2, "baz": 3}, []string{"foo", "baz"}) // map[string]int{"bar": 2} [ play ] OmitByValues Returns same map type filtered by given values. go m := lo.OmitByValues(map[string]int{"foo": 1, "bar": 2, "baz": 3}, []int{1, 3}) // map[string]int{"bar": 2} [ play ] Entries (alias: ToPairs) Transforms a map into array of key/value pairs. go entries := lo.Entries(map[string]int{"foo": 1, "bar": 2}) // []lo.Entry[string, int]{ // { // Key: "foo", // Value: 1, // }, // { // Key: "bar", // Value: 2, // }, // } [ play ] FromEntries (alias: FromPairs) Transforms an array of key/value pairs into a map. go m := lo.FromEntries([]lo.Entry[string, int]{ { Key: "foo", Value: 1, }, { Key: "bar", Value: 2, }, }) // map[string]int{"foo": 1, "bar": 2} [ play ] Invert Creates a map composed of the inverted keys and values. If map contains duplicate values, subsequent values overwrite property assignments of previous values. ```go m1 := lo.Invert(map[string]int{"a": 1, "b": 2}) // map[int]string{1: "a", 2: "b"} m2 := lo.Invert(map[string]int{"a": 1, "b": 2, "c": 1}) // map[int]string{1: "c", 2: "b"} ``` [ play ] Assign Merges multiple maps from left to right. go mergedMaps := lo.Assign[string, int]( map[string]int{"a": 1, "b": 2}, map[string]int{"b": 3, "c": 4}, ) // map[string]int{"a": 1, "b": 3, "c": 4} [ play ] MapKeys Manipulates a map keys and transforms it to a map of another type. go m2 := lo.MapKeys(map[int]int{1: 1, 2: 2, 3: 3, 4: 4}, func(_ int, v int) string { return strconv.FormatInt(int64(v), 10) }) // map[string]int{"1": 1, "2": 2, "3": 3, "4": 4} [ play ] MapValues Manipulates a map values and transforms it to a map of another type. ```go m1 := map[int]int64{1: 1, 2: 2, 3: 3} m2 := lo.MapValues(m1, func(x int64, _ int) string { return strconv.FormatInt(x, 10) }) // map[int]string{1: "1", 2: "2", 3: "3"} ``` [ play ] MapEntries Manipulates a map entries and transforms it to a map of another type. ```go in := map[string]int{"foo": 1, "bar": 2} out := lo.MapEntries(in, func(k string, v int) (int, string) { return v,k }) // map[int]string{1: "foo", 2: "bar"} ``` [ play ] MapToSlice Transforms a map into a slice based on specific iteratee. ```go m := map[int]int64{1: 4, 2: 5, 3: 6} s := lo.MapToSlice(m, func(k int, v int64) string { return fmt.Sprintf("%d_%d", k, v) }) // []string{"1_4", "2_5", "3_6"} ``` [ play ] Range / RangeFrom / RangeWithSteps Creates an array of numbers (positive and/or negative) progressing from start up to, but not including end. ```go result := lo.Range(4) // [0, 1, 2, 3] result := lo.Range(-4) // [0, -1, -2, -3] result := lo.RangeFrom(1, 5) // [1, 2, 3, 4, 5] result := lo.RangeFrom float64 // [1.0, 2.0, 3.0, 4.0, 5.0] result := lo.RangeWithSteps(0, 20, 5) // [0, 5, 10, 15] result := lo.RangeWithSteps float32 // [-1.0, -2.0, -3.0] result := lo.RangeWithSteps(1, 4, -1) // [] result := lo.Range(0) // [] ``` [ play ] Clamp Clamps number within the inclusive lower and upper bounds. ```go r1 := lo.Clamp(0, -10, 10) // 0 r2 := lo.Clamp(-42, -10, 10) // -10 r3 := lo.Clamp(42, -10, 10) // 10 ``` [ play ] Sum Sums the values in a collection. If collection is empty 0 is returned. go list := []int{1, 2, 3, 4, 5} sum := lo.Sum(list) // 15 [ play ] SumBy Summarizes the values in a collection using the given return value from the iteration function. If collection is empty 0 is returned. go strings := []string{"foo", "bar"} sum := lo.SumBy(strings, func(item string) int { return len(item) }) // 6 [ play ] RandomString Returns a random string of the specified length and made of the specified charset. go str := lo.RandomString(5, lo.LettersCharset) // example: "eIGbt" [ play ] Substring Return part of a string. ```go sub := lo.Substring("hello", 2, 3) // "llo" sub := lo.Substring("hello", -4, 3) // "ell" sub := lo.Substring("hello", -2, math.MaxUint) // "lo" ``` [ play ] ChunkString Returns an array of strings split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements. ```go lo.ChunkString("123456", 2) // []string{"12", "34", "56"} lo.ChunkString("1234567", 2) // []string{"12", "34", "56", "7"} lo.ChunkString("", 2) // []string{""} lo.ChunkString("1", 2) // []string{"1"} ``` [ play ] RuneLength An alias to utf8.RuneCountInString which returns the number of runes in string. ```go sub := lo.RuneLength("hellรด") // 5 sub := len("hellรด") // 6 ``` [ play ] T2 -> T9 Creates a tuple from a list of values. ```go tuple1 := lo.T2("x", 1) // Tuple2[string, int]{A: "x", B: 1} func example() (string, int) { return "y", 2 } tuple2 := lo.T2(example()) // Tuple2[string, int]{A: "y", B: 2} ``` [ play ] Unpack2 -> Unpack9 Returns values contained in tuple. go r1, r2 := lo.Unpack2(lo.Tuple2[string, int]{"a", 1}) // "a", 1 Unpack is also available as a method of TupleX. go tuple2 := lo.T2("a", 1) a, b := tuple2.Unpack() // "a" 1 [ play ] Zip2 -> Zip9 Zip creates a slice of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. When collections have different size, the Tuple attributes are filled with zero value. go tuples := lo.Zip2([]string{"a", "b"}, []int{1, 2}) // []Tuple2[string, int]{{A: "a", B: 1}, {A: "b", B: 2}} [ play ] Unzip2 -> Unzip9 Unzip accepts an array of grouped elements and creates an array regrouping the elements to their pre-zip configuration. go a, b := lo.Unzip2([]Tuple2[string, int]{{A: "a", B: 1}, {A: "b", B: 2}}) // []string{"a", "b"} // []int{1, 2} [ play ] ChannelDispatcher Distributes messages from input channels into N child channels. Close events are propagated to children. Underlying channels can have a fixed buffer capacity or be unbuffered when cap is 0. ```go ch := make(chan int, 42) for i := 0; i <= 10; i++ { ch <- i } children := lo.ChannelDispatcher(ch, 5, 10, DispatchingStrategyRoundRobin[int]) // []<-chan int{...} consumer := func(c <-chan int) { for { msg, ok := <-c if !ok { println("closed") break } println(msg) } } for i := range children { go consumer(children[i]) } ``` Many distributions strategies are available: lo.DispatchingStrategyRoundRobin : Distributes messages in a rotating sequential manner. lo.DispatchingStrategyRandom : Distributes messages in a random manner. lo.DispatchingStrategyWeightedRandom : Distributes messages in a weighted manner. lo.DispatchingStrategyFirst : Distributes messages in the first non-full channel. lo.DispatchingStrategyLeast : Distributes messages in the emptiest channel. lo.DispatchingStrategyMost : Distributes to the fullest channel. Some strategies bring fallback, in order to favor non-blocking behaviors. See implementations. For custom strategies, just implement the lo.DispatchingStrategy prototype: go type DispatchingStrategy[T any] func(message T, messageIndex uint64, channels []<-chan T) int Eg: ```go type Message struct { TenantID uuid.UUID } func hash(id uuid.UUID) int { h := fnv.New32a() h.Write([]byte(id.String())) return int(h.Sum32()) } // Routes messages per TenantID. customStrategy := func(message string, messageIndex uint64, channels []<-chan string) int { destination := hash(message) % len(channels) // check if channel is full if len(channels[destination]) < cap(channels[destination]) { return destination } // fallback when child channel is full return utils.DispatchingStrategyRoundRobin(message, uint64(destination), channels) } children := lo.ChannelDispatcher(ch, 5, 10, customStrategy) ... ``` SliceToChannel Returns a read-only channels of collection elements. Channel is closed after last element. Channel capacity can be customized. ```go list := []int{1, 2, 3, 4, 5} for v := range lo.SliceToChannel(2, list) { println(v) } // prints 1, then 2, then 3, then 4, then 5 ``` ChannelToSlice Returns a slice built from channels items. Blocks until channel closes. ```go list := []int{1, 2, 3, 4, 5} ch := lo.SliceToChannel(2, list) items := ChannelToSlice(ch) // []int{1, 2, 3, 4, 5} ``` Generator Implements the generator design pattern. Channel is closed after last element. Channel capacity can be customized. ```go generator := func(yield func(int)) { yield(1) yield(2) yield(3) } for v := range lo.Generator(2, generator) { println(v) } // prints 1, then 2, then 3 ``` Buffer Creates a slice of n elements from a channel. Returns the slice, the slice length, the read time and the channel status (opened/closed). ```go ch := lo.SliceToChannel(2, []int{1, 2, 3, 4, 5}) items1, length1, duration1, ok1 := lo.Buffer(ch, 3) // []int{1, 2, 3}, 3, 0s, true items2, length2, duration2, ok2 := lo.Buffer(ch, 3) // []int{4, 5}, 2, 0s, false ``` Example: RabbitMQ consumer ๐Ÿ‘‡ ```go ch := readFromQueue() for { // read 1k items items, length, _, ok := lo.Buffer(ch, 1000) // do batching stuff if !ok { break } } ``` BufferWithTimeout Creates a slice of n elements from a channel, with timeout. Returns the slice, the slice length, the read time and the channel status (opened/closed). ```go generator := func(yield func(int)) { for i := 0; i < 5; i++ { yield(i) time.Sleep(35*time.Millisecond) } } ch := lo.Generator(0, generator) items1, length1, duration1, ok1 := lo.BufferWithTimeout(ch, 3, 100 time.Millisecond) // []int{1, 2}, 2, 100ms, true items2, length2, duration2, ok2 := lo.BufferWithTimeout(ch, 3, 100 time.Millisecond) // []int{3, 4, 5}, 3, 75ms, true items3, length3, duration2, ok3 := lo.BufferWithTimeout(ch, 3, 100*time.Millisecond) // []int{}, 0, 10ms, false ``` Example: RabbitMQ consumer ๐Ÿ‘‡ ```go ch := readFromQueue() for { // read 1k items // wait up to 1 second items, length, _, ok := lo.BufferWithTimeout(ch, 1000, 1*time.Second) // do batching stuff if !ok { break } } ``` Example: Multithreaded RabbitMQ consumer ๐Ÿ‘‡ ```go ch := readFromQueue() // 5 workers // prefetch 1k messages per worker children := lo.ChannelDispatcher(ch, 5, 1000, lo.DispatchingStrategyFirst[int]) consumer := func(c <-chan int) { for { // read 1k items // wait up to 1 second items, length, _, ok := lo.BufferWithTimeout(ch, 1000, 1*time.Second) // do batching stuff if !ok { break } } } for i := range children { go consumer(children[i]) } ``` FanIn Merge messages from multiple input channels into a single buffered channel. Output messages has no priority. When all upstream channels reach EOF, downstream channel closes. ```go stream1 := make(chan int, 42) stream2 := make(chan int, 42) stream3 := make(chan int, 42) all := lo.FanIn(100, stream1, stream2, stream3) // <-chan int ``` FanOut Broadcasts all the upstream messages to multiple downstream channels. When upstream channel reach EOF, downstream channels close. If any downstream channels is full, broadcasting is paused. ```go stream := make(chan int, 42) all := lo.FanOut(5, 100, stream) // [5]<-chan int ``` Contains Returns true if an element is present in a collection. go present := lo.Contains([]int{0, 1, 2, 3, 4, 5}, 5) // true ContainsBy Returns true if the predicate function returns true . go present := lo.ContainsBy([]int{0, 1, 2, 3, 4, 5}, func(x int) bool { return x == 3 }) // true Every Returns true if all elements of a subset are contained into a collection or if the subset is empty. ```go ok := lo.Every([]int{0, 1, 2, 3, 4, 5}, []int{0, 2}) // true ok := lo.Every([]int{0, 1, 2, 3, 4, 5}, []int{0, 6}) // false ``` EveryBy Returns true if the predicate returns true for all of the elements in the collection or if the collection is empty. go b := EveryBy([]int{1, 2, 3, 4}, func(x int) bool { return x < 5 }) // true Some Returns true if at least 1 element of a subset is contained into a collection. If the subset is empty Some returns false. ```go ok := lo.Some([]int{0, 1, 2, 3, 4, 5}, []int{0, 2}) // true ok := lo.Some([]int{0, 1, 2, 3, 4, 5}, []int{-1, 6}) // false ``` SomeBy Returns true if the predicate returns true for any of the elements in the collection. If the collection is empty SomeBy returns false. go b := SomeBy([]int{1, 2, 3, 4}, func(x int) bool { return x < 3 }) // true None Returns true if no element of a subset are contained into a collection or if the subset is empty. go b := None([]int{0, 1, 2, 3, 4, 5}, []int{0, 2}) // false b := None([]int{0, 1, 2, 3, 4, 5}, []int{-1, 6}) // true NoneBy Returns true if the predicate returns true for none of the elements in the collection or if the collection is empty. go b := NoneBy([]int{1, 2, 3, 4}, func(x int) bool { return x < 0 }) // true Intersect Returns the intersection between two collections. ```go result1 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{0, 2}) // []int{0, 2} result2 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{0, 6}) // []int{0} result3 := lo.Intersect([]int{0, 1, 2, 3, 4, 5}, []int{-1, 6}) // []int{} ``` Difference Returns the difference between two collections. The first value is the collection of element absent of list2. The second value is the collection of element absent of list1. ```go left, right := lo.Difference([]int{0, 1, 2, 3, 4, 5}, []int{0, 2, 6}) // []int{1, 3, 4, 5}, []int{6} left, right := lo.Difference([]int{0, 1, 2, 3, 4, 5}, []int{0, 1, 2, 3, 4, 5}) // []int{}, []int{} ``` Union Returns all distinct elements from given collections. Result will not change the order of elements relatively. go union := lo.Union([]int{0, 1, 2, 3, 4, 5}, []int{0, 2}, []int{0, 10}) // []int{0, 1, 2, 3, 4, 5, 10} Without Returns slice excluding all given values. ```go subset := lo.Without([]int{0, 2, 10}, 2) // []int{0, 10} subset := lo.Without([]int{0, 2, 10}, 0, 1, 2, 3, 4, 5) // []int{10} ``` WithoutEmpty Returns slice excluding empty values. go subset := lo.WithoutEmpty([]int{0, 2, 10}) // []int{2, 10} IndexOf Returns the index at which the first occurrence of a value is found in an array or return -1 if the value cannot be found. ```go found := lo.IndexOf([]int{0, 1, 2, 1, 2, 3}, 2) // 2 notFound := lo.IndexOf([]int{0, 1, 2, 1, 2, 3}, 6) // -1 ``` LastIndexOf Returns the index at which the last occurrence of a value is found in an array or return -1 if the value cannot be found. ```go found := lo.LastIndexOf([]int{0, 1, 2, 1, 2, 3}, 2) // 4 notFound := lo.LastIndexOf([]int{0, 1, 2, 1, 2, 3}, 6) // -1 ``` Find Search an element in a slice based on a predicate. It returns element and true if element was found. ```go str, ok := lo.Find([]string{"a", "b", "c", "d"}, func(i string) bool { return i == "b" }) // "b", true str, ok := lo.Find([]string{"foobar"}, func(i string) bool { return i == "b" }) // "", false ``` FindIndexOf FindIndexOf searches an element in a slice based on a predicate and returns the index and true. It returns -1 and false if the element is not found. ```go str, index, ok := lo.FindIndexOf([]string{"a", "b", "a", "b"}, func(i string) bool { return i == "b" }) // "b", 1, true str, index, ok := lo.FindIndexOf([]string{"foobar"}, func(i string) bool { return i == "b" }) // "", -1, false ``` FindLastIndexOf FindLastIndexOf searches an element in a slice based on a predicate and returns the index and true. It returns -1 and false if the element is not found. ```go str, index, ok := lo.FindLastIndexOf([]string{"a", "b", "a", "b"}, func(i string) bool { return i == "b" }) // "b", 4, true str, index, ok := lo.FindLastIndexOf([]string{"foobar"}, func(i string) bool { return i == "b" }) // "", -1, false ``` FindOrElse Search an element in a slice based on a predicate. It returns the element if found or a given fallback value otherwise. ```go str := lo.FindOrElse([]string{"a", "b", "c", "d"}, "x", func(i string) bool { return i == "b" }) // "b" str := lo.FindOrElse([]string{"foobar"}, "x", func(i string) bool { return i == "b" }) // "x" ``` FindKey Returns the key of the first value matching. ```go result1, ok1 := lo.FindKey(map[string]int{"foo": 1, "bar": 2, "baz": 3}, 2) // "bar", true result2, ok2 := lo.FindKey(map[string]int{"foo": 1, "bar": 2, "baz": 3}, 42) // "", false type test struct { foobar string } result3, ok3 := lo.FindKey(map[string]test{"foo": test{"foo"}, "bar": test{"bar"}, "baz": test{"baz"}}, test{"foo"}) // "foo", true ``` FindKeyBy Returns the key of the first element predicate returns truthy for. ```go result1, ok1 := lo.FindKeyBy(map[string]int{"foo": 1, "bar": 2, "baz": 3}, func(k string, v int) bool { return k == "foo" }) // "foo", true result2, ok2 := lo.FindKeyBy(map[string]int{"foo": 1, "bar": 2, "baz": 3}, func(k string, v int) bool { return false }) // "", false ``` FindUniques Returns a slice with all the unique elements of the collection. The order of result values is determined by the order they occur in the array. go uniqueValues := lo.FindUniques([]int{1, 2, 2, 1, 2, 3}) // []int{3} FindUniquesBy Returns a slice with all the unique elements of the collection. The order of result values is determined by the order they occur in the array. It accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed. go uniqueValues := lo.FindUniquesBy([]int{3, 4, 5, 6, 7}, func(i int) int { return i%3 }) // []int{5} FindDuplicates Returns a slice with the first occurrence of each duplicated elements of the collection. The order of result values is determined by the order they occur in the array. go duplicatedValues := lo.FindDuplicates([]int{1, 2, 2, 1, 2, 3}) // []int{1, 2} FindDuplicatesBy Returns a slice with the first occurrence of each duplicated elements of the collection. The order of result values is determined by the order they occur in the array. It accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed. go duplicatedValues := lo.FindDuplicatesBy([]int{3, 4, 5, 6, 7}, func(i int) int { return i%3 }) // []int{3, 4} Min Search the minimum value of a collection. Returns zero value when collection is empty. ```go min := lo.Min([]int{1, 2, 3}) // 1 min := lo.Min([]int{}) // 0 ``` MinBy Search the minimum value of a collection using the given comparison function. If several values of the collection are equal to the smallest value, returns the first such value. Returns zero value when collection is empty. ```go min := lo.MinBy([]string{"s1", "string2", "s3"}, func(item string, min string) bool { return len(item) < len(min) }) // "s1" min := lo.MinBy([]string{}, func(item string, min string) bool { return len(item) < len(min) }) // "" ``` Max Search the maximum value of a collection. Returns zero value when collection is empty. ```go max := lo.Max([]int{1, 2, 3}) // 3 max := lo.Max([]int{}) // 0 ``` MaxBy Search the maximum value of a collection using the given comparison function. If several values of the collection are equal to the greatest value, returns the first such value. Returns zero value when collection is empty. ```go max := lo.MaxBy([]string{"string1", "s2", "string3"}, func(item string, max string) bool { return len(item) > len(max) }) // "string1" max := lo.MaxBy([]string{}, func(item string, max string) bool { return len(item) > len(max) }) // "" ``` Last Returns the last element of a collection or error if empty. go last, err := lo.Last([]int{1, 2, 3}) // 3 Nth Returns the element at index nth of collection. If nth is negative, the nth element from the end is returned. An error is returned when nth is out of slice bounds. ```go nth, err := lo.Nth([]int{0, 1, 2, 3}, 2) // 2 nth, err := lo.Nth([]int{0, 1, 2, 3}, -2) // 2 ``` Sample Returns a random item from collection. ```go lo.Sample([]string{"a", "b", "c"}) // a random string from []string{"a", "b", "c"} lo.Sample([]string{}) // "" ``` Samples Returns N random unique items from collection. go lo.Samples([]string{"a", "b", "c"}, 3) // []string{"a", "b", "c"} in random order Ternary A 1 line if/else statement. ```go result := lo.Ternary(true, "a", "b") // "a" result := lo.Ternary(false, "a", "b") // "b" ``` [ play ] TernaryF A 1 line if/else statement whose options are functions. ```go result := lo.TernaryF(true, func() string { return "a" }, func() string { return "b" }) // "a" result := lo.TernaryF(false, func() string { return "a" }, func() string { return "b" }) // "b" ``` Useful to avoid nil-pointer dereferencing in initializations, or avoid running unnecessary code ```go var s *string someStr := TernaryF(s == nil, func() string { return uuid.New().String() }, func() string { return *s }) // ef782193-c30c-4e2e-a7ae-f8ab5e125e02 ``` [ play ] If / ElseIf / Else ```go result := lo.If(true, 1). ElseIf(false, 2). Else(3) // 1 result := lo.If(false, 1). ElseIf(true, 2). Else(3) // 2 result := lo.If(false, 1). ElseIf(false, 2). Else(3) // 3 ``` Using callbacks: go result := lo.IfF(true, func () int { return 1 }). ElseIfF(false, func () int { return 2 }). ElseF(func () int { return 3 }) // 1 Mixed: go result := lo.IfF(true, func () int { return 1 }). Else(42) // 1 [ play ] Switch / Case / Default ```go result := lo.Switch(1). Case(1, "1"). Case(2, "2"). Default("3") // "1" result := lo.Switch(2). Case(1, "1"). Case(2, "2"). Default("3") // "2" result := lo.Switch(42). Case(1, "1"). Case(2, "2"). Default("3") // "3" ``` Using callbacks: go result := lo.Switch(1). CaseF(1, func() string { return "1" }). CaseF(2, func() string { return "2" }). DefaultF(func() string { return "3" }) // "1" Mixed: go result := lo.Switch(1). CaseF(1, func() string { return "1" }). Default("42") // "1" [ play ] IsNil Checks if a value is nil or if it's a reference type with a nil underlying value. ```go var x int IsNil(x)) // false var k struct{} IsNil(k) // false var i *int IsNil(i) // true var ifaceWithNilValue any = (*string)(nil) IsNil(ifaceWithNilValue) // true ifaceWithNilValue == nil // false ``` ToPtr Returns a pointer copy of the value. go ptr := lo.ToPtr("hello world") // *string{"hello world"} EmptyableToPtr Returns a pointer copy of value if it's nonzero. Otherwise, returns nil pointer. ```go ptr := lo.EmptyableToPtr []int // nil ptr := lo.EmptyableToPtr string // nil ptr := lo.EmptyableToPtr []int // *[]int{} ptr := lo.EmptyableToPtr string // *string{"hello world"} ``` FromPtr Returns the pointer value or empty. ```go str := "hello world" value := lo.FromPtr(&str) // "hello world" value := lo.FromPtr string // "" ``` FromPtrOr Returns the pointer value or the fallback value. ```go str := "hello world" value := lo.FromPtrOr(&str, "empty") // "hello world" value := lo.FromPtrOr string // "empty" ``` ToSlicePtr Returns a slice of pointer copy of value. go ptr := lo.ToSlicePtr([]string{"hello", "world"}) // []*string{"hello", "world"} ToAnySlice Returns a slice with all elements mapped to any type. go elements := lo.ToAnySlice([]int{1, 5, 1}) // []any{1, 5, 1} FromAnySlice Returns an any slice with all elements mapped to a type. Returns false in case of type conversion failure. ```go elements, ok := lo.FromAnySlice([]any{"foobar", 42}) // []string{}, false elements, ok := lo.FromAnySlice([]any{"foobar", "42"}) // []string{"foobar", "42"}, true ``` Empty Returns an empty value. go lo.Empty[int]() // 0 lo.Empty[string]() // "" lo.Empty[bool]() // false IsEmpty Returns true if argument is a zero value. ```go lo.IsEmpty(0) // true lo.IsEmpty(42) // false lo.IsEmpty("") // true lo.IsEmpty("foobar") // false type test struct { foobar string } lo.IsEmpty(test{foobar: ""}) // true lo.IsEmpty(test{foobar: "foobar"}) // false ``` IsNotEmpty Returns true if argument is a zero value. ```go lo.IsNotEmpty(0) // false lo.IsNotEmpty(42) // true lo.IsNotEmpty("") // false lo.IsNotEmpty("foobar") // true type test struct { foobar string } lo.IsNotEmpty(test{foobar: ""}) // false lo.IsNotEmpty(test{foobar: "foobar"}) // true ``` Coalesce Returns the first non-empty arguments. Arguments must be comparable. ```go result, ok := lo.Coalesce(0, 1, 2, 3) // 1 true result, ok := lo.Coalesce("") // "" false var nilStr *string str := "foobar" result, ok := lo.Coalesce *string // &"foobar" true ``` Partial Returns new function that, when called, has its first argument set to the provided value. ```go add := func(x, y int) int { return x + y } f := lo.Partial(add, 5) f(10) // 15 f(42) // 47 ``` Partial2 -> Partial5 Returns new function that, when called, has its first argument set to the provided value. ```go add := func(x, y, z int) int { return x + y + z } f := lo.Partial2(add, 42) f(10, 5) // 57 f(42, -4) // 80 ``` Attempt Invokes a function N times until it returns valid output. Returning either the caught error or nil. When first argument is less than 1 , the function runs until a successful response is returned. ```go iter, err := lo.Attempt(42, func(i int) error { if i == 5 { return nil } return fmt.Errorf("failed") }) // 6 // nil iter, err := lo.Attempt(2, func(i int) error { if i == 5 { return nil } return fmt.Errorf("failed") }) // 2 // error "failed" iter, err := lo.Attempt(0, func(i int) error { if i < 42 { return fmt.Errorf("failed") } return nil }) // 43 // nil ``` For more advanced retry strategies (delay, exponential backoff...), please take a look on cenkalti/backoff . [ play ] AttemptWithDelay Invokes a function N times until it returns valid output, with a pause between each call. Returning either the caught error or nil. When first argument is less than 1 , the function runs until a successful response is returned. ```go iter, duration, err := lo.AttemptWithDelay(5, 2*time.Second, func(i int, duration time.Duration) error { if i == 2 { return nil } return fmt.Errorf("failed") }) // 3 // ~ 4 seconds // nil ``` For more advanced retry strategies (delay, exponential backoff...), please take a look on cenkalti/backoff . [ play ] AttemptWhile Invokes a function N times until it returns valid output. Returning either the caught error or nil, and along with a bool value to identifying whether it needs invoke function continuously. It will terminate the invoke immediately if second bool value is returned with falsy value. When first argument is less than 1 , the function runs until a successful response is returned. ```go count1, err1 := lo.AttemptWhile(5, func(i int) (error, bool) { err := doMockedHTTPRequest(i) if err != nil { if errors.Is(err, ErrBadRequest) { // lets assume ErrBadRequest is a critical error that needs to terminate the invoke return err, false // flag the second return value as false to terminate the invoke } return err, true } return nil, false }) ``` For more advanced retry strategies (delay, exponential backoff...), please take a look on cenkalti/backoff . [ play ] AttemptWhileWithDelay Invokes a function N times until it returns valid output, with a pause between each call. Returning either the caught error or nil, and along with a bool value to identifying whether it needs to invoke function continuously. It will terminate the invoke immediately if second bool value is returned with falsy value. When first argument is less than 1 , the function runs until a successful response is returned. ```go count1, time1, err1 := lo.AttemptWhileWithDelay(5, time.Millisecond, func(i int, d time.Duration) (error, bool) { err := doMockedHTTPRequest(i) if err != nil { if errors.Is(err, ErrBadRequest) { // lets assume ErrBadRequest is a critical error that needs to terminate the invoke return err, false // flag the second return value as false to terminate the invoke } return err, true } return nil, false }) ``` For more advanced retry strategies (delay, exponential backoff...), please take a look on cenkalti/backoff . [ play ] Debounce NewDebounce creates a debounced instance that delays invoking functions given until after wait milliseconds have elapsed, until cancel is called. ```go f := func() { println("Called once after 100ms when debounce stopped invoking!") } debounce, cancel := lo.NewDebounce(100 * time.Millisecond, f) for j := 0; j < 10; j++ { debounce() } time.Sleep(1 * time.Second) cancel() ``` [ play ] DebounceBy NewDebounceBy creates a debounced instance for each distinct key, that delays invoking functions given until after wait milliseconds have elapsed, until cancel is called. ```go f := func(key string, count int) { println(key + ": Called once after 100ms when debounce stopped invoking!") } debounce, cancel := lo.NewDebounceBy(100 * time.Millisecond, f) for j := 0; j < 10; j++ { debounce("first key") debounce("second key") } time.Sleep(1 * time.Second) cancel("first key") cancel("second key") ``` [ play ] Synchronize Wraps the underlying callback in a mutex. It receives an optional mutex. ```go s := lo.Synchronize() for i := 0; i < 10; i++ { go s.Do(func () { println("will be called sequentially") }) } ``` It is equivalent to: ```go mu := sync.Mutex{} func foobar() { mu.Lock() defer mu.Unlock() // ... } ``` Async Executes a function in a goroutine and returns the result in a channel. go ch := lo.Async(func() error { time.Sleep(10 * time.Second); return nil }) // chan error (nil) Async{0->6} Executes a function in a goroutine and returns the result in a channel. For function with multiple return values, the results will be returned as a tuple inside the channel. For function without return, struct{} will be returned in the channel. ```go ch := lo.Async0(func() { time.Sleep(10 * time.Second) }) // chan struct{} ch := lo.Async1(func() int { time.Sleep(10 * time.Second); return 42 }) // chan int (42) ch := lo.Async2(func() (int, string) { time.Sleep(10 * time.Second); return 42, "Hello" }) // chan lo.Tuple2[int, string] ({42, "Hello"}) ``` Transaction Implements a Saga pattern. ```go transaction := NewTransaction int . Then( func(state int) (int, error) { fmt.Println("step 1") return state + 10, nil }, func(state int) int { fmt.Println("rollback 1") return state - 10 }, ). Then( func(state int) (int, error) { fmt.Println("step 2") return state + 15, nil }, func(state int) int { fmt.Println("rollback 2") return state - 15 }, ). Then( func(state int) (int, error) { fmt.Println("step 3") if true { return state, fmt.Errorf("error") } return state + 42, nil }, func(state int) int { fmt.Println("rollback 3") return state - 42 }, ) _, _ = transaction.Process(-5) // Output: // step 1 // step 2 // step 3 // rollback 2 // rollback 1 ``` Validate Helper function that creates an error when a condition is not met. ```go slice := []string{"a"} val := lo.Validate(len(slice) == 0, "Slice should be empty but contains %v", slice) // error("Slice should be empty but contains [a]") slice := []string{} val := lo.Validate(len(slice) == 0, "Slice should be empty but contains %v", slice) // nil ``` [ play ] Must Wraps a function call to panics if second argument is error or false , returns the value otherwise. ```go val := lo.Must(time.Parse("2006-01-02", "2022-01-15")) // 2022-01-15 val := lo.Must(time.Parse("2006-01-02", "bad-value")) // panics ``` [ play ] Must{0->6} Must* has the same behavior as Must, but returns multiple values. ```go func example0() (error) func example1() (int, error) func example2() (int, string, error) func example3() (int, string, time.Date, error) func example4() (int, string, time.Date, bool, error) func example5() (int, string, time.Date, bool, float64, error) func example6() (int, string, time.Date, bool, float64, byte, error) lo.Must0(example0()) val1 := lo.Must1(example1()) // alias to Must val1, val2 := lo.Must2(example2()) val1, val2, val3 := lo.Must3(example3()) val1, val2, val3, val4 := lo.Must4(example4()) val1, val2, val3, val4, val5 := lo.Must5(example5()) val1, val2, val3, val4, val5, val6 := lo.Must6(example6()) ``` You can wrap functions like func (...) (..., ok bool) . ```go // math.Signbit(float64) bool lo.Must0(math.Signbit(v)) // bytes.Cut([]byte,[]byte) ([]byte, []byte, bool) before, after := lo.Must2(bytes.Cut(s, sep)) ``` You can give context to the panic message by adding some printf-like arguments. ```go val, ok := lo.Find(myString, func(i string) bool { return i == requiredChar }) lo.Must0(ok, "'%s' must always contain '%s'", myString, requiredChar) list := []int{0, 1, 2} item := 5 lo.Must0(lo.Contains int , "'%s' must always contain '%s'", list, item) ... ``` [ play ] Try Calls the function and return false in case of error and on panic. ```go ok := lo.Try(func() error { panic("error") return nil }) // false ok := lo.Try(func() error { return nil }) // true ok := lo.Try(func() error { return fmt.Errorf("error") }) // false ``` [ play ] Try{0->6} The same behavior than Try , but callback returns 2 variables. go ok := lo.Try2(func() (string, error) { panic("error") return "", nil }) // false [ play ] TryOr Calls the function and return a default value in case of error and on panic. ```go str, ok := lo.TryOr(func() (string, error) { panic("error") return "hello", nil }, "world") // world // false str, ok := lo.TryOr(func() error { return "hello", nil }, "world") // hello // true str, ok := lo.TryOr(func() error { return "hello", fmt.Errorf("error") }, "world") // world // false ``` [ play ] TryOr{0->6} The same behavior than TryOr , but callback returns X variables. go str, nbr, ok := lo.TryOr2(func() (string, int, error) { panic("error") return "hello", 42, nil }, "world", 21) // world // 21 // false [ play ] TryWithErrorValue The same behavior than Try , but also returns value passed to panic. go err, ok := lo.TryWithErrorValue(func() error { panic("error") return nil }) // "error", false [ play ] TryCatch The same behavior than Try , but calls the catch function in case of error. ```go caught := false ok := lo.TryCatch(func() error { panic("error") return nil }, func() { caught = true }) // false // caught == true ``` [ play ] TryCatchWithErrorValue The same behavior than TryWithErrorValue , but calls the catch function in case of error. ```go caught := false ok := lo.TryCatchWithErrorValue(func() error { panic("error") return nil }, func(val any) { caught = val == "error" }) // false // caught == true ``` [ play ] ErrorsAs A shortcut for: ```go err := doSomething() var rateLimitErr *RateLimitError if ok := errors.As(err, &rateLimitErr); ok { // retry later } ``` 1 line lo helper: ```go err := doSomething() if rateLimitErr, ok := lo.ErrorsAs *RateLimitError ; ok { // retry later } ``` [ play ] ๐Ÿ›ฉ Benchmark We executed a simple benchmark with the a dead-simple lo.Map loop: See the full implementation here . go _ = lo.Map[int64](arr, func(x int64, i int) string { return strconv.FormatInt(x, 10) }) Result: Here is a comparison between lo.Map , lop.Map , go-funk library and a simple Go for loop. shell $ go test -benchmem -bench ./... goos: linux goarch: amd64 pkg: github.com/samber/lo cpu: Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz cpu: Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz BenchmarkMap/lo.Map-8 8 132728237 ns/op 39998945 B/op 1000002 allocs/op BenchmarkMap/lop.Map-8 2 503947830 ns/op 119999956 B/op 3000007 allocs/op BenchmarkMap/reflect-8 2 826400560 ns/op 170326512 B/op 4000042 allocs/op BenchmarkMap/for-8 9 126252954 ns/op 39998674 B/op 1000001 allocs/op PASS ok github.com/samber/lo 6.657s lo.Map is way faster (x7) than go-funk , a reflection-based Map implementation. lo.Map have the same allocation profile than for . lo.Map is 4% slower than for . lop.Map is slower than lo.Map because it implies more memory allocation and locks. lop.Map will be useful for long-running callbacks, such as i/o bound processing. for beats other implementations for memory and CPU. ๐Ÿค Contributing Ping me on twitter @samuelberthe (DMs, mentions, whatever :)) Fork the project Fix open issues or request new features Don't hesitate ;) Helper naming: helpers must be self explanatory and respect standards (other languages, libraries...). Feel free to suggest many names in your contributions. With Docker bash docker-compose run --rm dev Without Docker ```bash Install some dev dependencies make tools Run tests make test or make watch-test ``` ๐Ÿ‘ค Contributors ๐Ÿ’ซ Show your support Give a โญ๏ธ if this project helped you! ๐Ÿ“ License Copyright ยฉ 2022 Samuel Berthe . This project is MIT licensed.
๐Ÿ’ฅ A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)
lodash,golang,go,generics,contract,constraints,functional,programming,typesafe,filterable
48
84
272
421
112
12
3
tremorlabs/tremor
Documentation โ€ข Website React components to build charts and dashboards Tremor 20+ open-source components built on top of Tailwind CSS to make visualizing data simple again. Fully open-source, made by data scientists and software engineers with a sweet spot for design. Getting Started See our Installation Guide . To make use of the library we also need Tailwind CSS setup in the project. Example With Tremor creating an analytical interface is easy. ```jsx "use client"; import { AreaChart, Card } from "@tremor/react"; const chartdata = [ { date: "Jan 23", "Route Requests": 289, "Station Requests": 233, }, // ... { date: "Oct 23", "Route Requests": 283, "Station Requests": 247, }, ]; export default function Example() { return ( Total Requests 6,568 ); } ``` Community and Contribution We are always looking for new ideas or other ways to improve Tremor. If you have developed anything cool or found a bug, send us a pull request. Check out our Contributor License Agreement here . License Apache License 2.0 Copyright ยฉ 2024 Tremor Labs, Inc. All rights reserved.
React components to build charts and dashboards
reactjs,tailwindcss,ui-system,typescript,react-components
337
60
496
1,027
55
4
3
NVlabs/instant-ngp
Instant Neural Graphics Primitives Ever wanted to train a NeRF model of a fox in under 5 seconds? Or fly around a scene captured from photos of a factory robot? Of course you have! Here you will find an implementation of four neural graphics primitives , being neural radiance fields (NeRF), signed distance functions (SDFs), neural images, and neural volumes. In each case, we train and render a MLP with multiresolution hash input encoding using the tiny-cuda-nn framework. Instant Neural Graphics Primitives with a Multiresolution Hash Encoding Thomas Mรผller , Alex Evans , Christoph Schied , Alexander Keller ACM Transactions on Graphics (__SIGGRAPH__), July 2022 Project page / Paper / Video / Presentation / Real-Time Live / BibTeX For business inquiries, please submit the NVIDIA research licensing form . Installation If you have Windows, download one of the following releases corresponding to your graphics card and extract it. Then, start instant-ngp.exe . RTX 3000 & 4000 series, RTX A4000โ€“A6000 , and other Ampere & Ada cards RTX 2000 series, Titan RTX, Quadro RTX 4000โ€“8000 , and other Turing cards GTX 1000 series, Titan Xp, Quadro P1000โ€“P6000 , and other Pascal cards Keep reading for a guided tour of the application or, if you are interested in creating your own NeRF, watch the video tutorial or read the written instructions . If you use Linux, or want the developer Python bindings , or if your GPU is not listed above (e.g. Hopper, Volta, or Maxwell generations), you need to build instant-ngp yourself . Usage instant-ngp comes with an interactive GUI that includes many features: - comprehensive controls for interactively exploring neural graphics primitives, - VR mode for viewing neural graphics primitives through a virtual-reality headset, - saving and loading "snapshots" so you can share your graphics primitives on the internet, - a camera path editor to create videos, - NeRF->Mesh and SDF->Mesh conversion, - camera pose and lens optimization, - and many more. NeRF fox Simply start instant-ngp and drag the data/nerf/fox folder into the window. Or, alternatively, use the command line: sh instant-ngp$ ./instant-ngp data/nerf/fox You can use any NeRF-compatible dataset, e.g. from original NeRF , the SILVR dataset , or the DroneDeploy dataset . To create your own NeRF, watch the video tutorial or read the written instructions . SDF armadillo Drag data/sdf/armadillo.obj into the window or use the command: sh instant-ngp$ ./instant-ngp data/sdf/armadillo.obj Image of Einstein Drag data/image/albert.exr into the window or use the command: sh instant-ngp$ ./instant-ngp data/image/albert.exr To reproduce the gigapixel results, download, for example, the Tokyo image and convert it to .bin using the scripts/convert_image.py script. This custom format improves compatibility and loading speed when resolution is high. Now you can run: sh instant-ngp$ ./instant-ngp data/image/tokyo.bin Volume renderer Download the nanovdb volume for the Disney cloud , which is derived from here ( CC BY-SA 3.0 ). Then drag wdas_cloud_quarter.nvdb into the window or use the command: sh instant-ngp$ ./instant-ngp wdas_cloud_quarter.nvdb Keyboard shortcuts and recommended controls Here are the main keyboard controls for the instant-ngp application. | Key | Meaning | | :-------------: | ------------- | | WASD | Forward / pan left / backward / pan right. | | Spacebar / C | Move up / down. | | = or + / - or _ | Increase / decrease camera velocity (first person mode) or zoom in / out (third person mode). | | E / Shift+E | Increase / decrease exposure. | | Tab | Toggle menu visibility. | | T | Toggle training. After around two minutes training tends to settle down, so can be toggled off. | | { } | Go to the first/last training image camera view. | | [ ] | Go to the previous/next training image camera view. | | R | Reload network from file. | | Shift+R | Reset camera. | | O | Toggle visualization or accumulated error map. | | G | Toggle visualization of the ground truth. | | M | Toggle multi-view visualization of layers of the neural model. See the paper's video for a little more explanation. | | , / . | Shows the previous / next visualized layer; hit M to escape. | | 1-8 | Switches among various render modes, with 2 being the standard one. You can see the list of render mode names in the control interface. | There are many controls in the instant-ngp GUI. First, note that this GUI can be moved and resized, as can the "Camera path" GUI (which first must be expanded to be used). Recommended user controls in instant-ngp are: Snapshot: use "Save" to save the trained NeRF, "Load" to reload. Rendering -> DLSS: toggling this on and setting "DLSS sharpening" to 1.0 can often improve rendering quality. Rendering -> Crop size: trim back the surrounding environment to focus on the model. "Crop aabb" lets you move the center of the volume of interest and fine tune. See more about this feature in our NeRF training & dataset tips . The "Camera path" GUI lets you create a camera path for rendering a video. The button "Add from cam" inserts keyframes from the current perspective. Then, you can render a video .mp4 of your camera path or export the keyframes to a .json file. There is a bit more information about the GUI in this post and in this video guide to creating your own video . VR controls To view the neural graphics primitive in VR, first start your VR runtime. This will most likely be either - OculusVR if you have an Oculus Rift or Meta Quest (with link cable) headset, and - SteamVR if you have another headset. - Any OpenXR-compatible runtime will work. Then, press the Connect to VR/AR headset button in the instant-ngp GUI and put on your headset. Before entering VR, we strongly recommend that you first finish training (press "Stop training") or load a pre-trained snapshot for maximum performance. In VR, you have the following controls. | Control | Meaning | | :--------------------: | ------------- | | Left stick / trackpad | Move | | Right stick / trackpad | Turn camera | | Press stick / trackpad | Erase NeRF around the hand | | Grab (one-handed) | Drag neural graphics primitive | | Grab (two-handed) | Rotate and zoom (like pinch-to-zoom on a smartphone) | Building instant-ngp (Windows & Linux) Requirements An NVIDIA GPU ; tensor cores increase performance when available. All shown results come from an RTX 3090. A C++14 capable compiler. The following choices are recommended and have been tested: Windows: Visual Studio 2019 or 2022 Linux: GCC/G++ 8 or higher A recent version of CUDA . The following choices are recommended and have been tested: Windows: CUDA 11.5 or higher Linux: CUDA 10.2 or higher CMake v3.21 or higher . (optional) Python 3.7 or higher for interactive bindings. Also, run pip install -r requirements.txt . (optional) OptiX 7.6 or higher for faster mesh SDF training. (optional) Vulkan SDK for DLSS support. If you are using Debian based Linux distribution, install the following packages sh sudo apt-get install build-essential git python3-dev python3-pip libopenexr-dev libxi-dev \ libglfw3-dev libglew-dev libomp-dev libxinerama-dev libxcursor-dev Alternatively, if you are using Arch or Arch derivatives, install the following packages sh sudo pacman -S cuda base-devel cmake openexr libxi glfw openmp libxinerama libxcursor We also recommend installing CUDA and OptiX in /usr/local/ and adding the CUDA installation to your PATH. For example, if you have CUDA 11.4, add the following to your ~/.bashrc sh export PATH="/usr/local/cuda-11.4/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-11.4/lib64:$LD_LIBRARY_PATH" Compilation Begin by cloning this repository and all its submodules using the following command: sh $ git clone --recursive https://github.com/nvlabs/instant-ngp $ cd instant-ngp Then, use CMake to build the project: (on Windows, this must be in a developer command prompt ) sh instant-ngp$ cmake . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo instant-ngp$ cmake --build build --config RelWithDebInfo -j If compilation fails inexplicably or takes longer than an hour, you might be running out of memory. Try running the above command without -j in that case. If this does not help, please consult this list of possible fixes before opening an issue. If the build succeeds, you can now run the code via the ./instant-ngp executable or the scripts/run.py script described below. If automatic GPU architecture detection fails, (as can happen if you have multiple GPUs installed), set the TCNN_CUDA_ARCHITECTURES environment variable for the GPU you would like to use. The following table lists the values for common GPUs. If your GPU is not listed, consult this exhaustive list . | H100 | 40X0 | 30X0 | A100 | 20X0 | TITAN V / V100 | 10X0 / TITAN Xp | 9X0 | K80 | |:----:|:----:|:----:|:----:|:----:|:--------------:|:---------------:|:---:|:---:| | 90 | 89 | 86 | 80 | 75 | 70 | 61 | 52 | 37 | Python bindings After you have built instant-ngp , you can use its Python bindings to conduct controlled experiments in an automated fashion. All features from the interactive GUI (and more!) have Python bindings that can be easily instrumented. For an example of how the ./instant-ngp application can be implemented and extended from within Python, see ./scripts/run.py , which supports a superset of the command line arguments that ./instant-ngp does. If you would rather build new models from the hash encoding and fast neural networks, consider tiny-cuda-nn 's PyTorch extension . Happy hacking! Additional resources Getting started with NVIDIA Instant NeRF blog post SIGGRAPH tutorial for advanced NeRF dataset creation . Frequently asked questions (FAQ) Q: The NeRF reconstruction of my custom dataset looks bad; what can I do? A: There could be multiple issues: - COLMAP might have been unable to reconstruct camera poses. - There might have been movement or blur during capture. Don't treat capture as an artistic task; treat it as photogrammetry. You want *as little blur as possible* in your dataset (motion, defocus, or otherwise) and all objects must be *static* during the entire capture. Bonus points if you are using a wide-angle lens (iPhone wide angle works well), because it covers more space than narrow lenses. - The dataset parameters (in particular aabb_scale ) might have been tuned suboptimally. We recommend starting with aabb_scale=128 and then increasing or decreasing it by factors of two until you get optimal quality. - Carefully read our NeRF training & dataset tips . Q: How can I save the trained model and load it again later? A: Two options: 1. Use the GUI's "Snapshot" section. 2. Use the Python bindings load_snapshot / save_snapshot (see scripts/run.py for example usage). Q: Can this codebase use multiple GPUs at the same time? A: Only for VR rendering, in which case one GPU is used per eye. Otherwise, no. To select a specific GPU to run on, use the CUDA_VISIBLE_DEVICES environment variable. To optimize the compilation for that specific GPU use the TCNN_CUDA_ARCHITECTURES environment variable. Q: How can I run instant-ngp in headless mode? A: Use ./instant-ngp --no-gui or python scripts/run.py . You can also compile without GUI via cmake -DNGP_BUILD_WITH_GUI=off ... Q: Does this codebase run on Google Colab ? A: Yes. See this example inspired on the notebook created by user @myagues . Caveat: this codebase requires large amounts of GPU RAM and might not fit on your assigned GPU. It will also run slower on older GPUs. Q: Is there a Docker container ? A: Yes. We bundle a Visual Studio Code development container , the .devcontainer/Dockerfile of which you can also use stand-alone. If you want to run the container without using VSCode: docker-compose -f .devcontainer/docker-compose.yml build instant-ngp xhost local:root docker-compose -f .devcontainer/docker-compose.yml run instant-ngp /bin/bash Then run the build commands above as normal. Q: How can I edit and train the underlying hash encoding or neural network on a new task? A: Use tiny-cuda-nn 's PyTorch extension . Q: What is the coordinate system convention? A: See this helpful diagram by user @jc211. Q: Why are background colors randomized during NeRF training? A: Transparency in the training data indicates a desire for transparency in the learned model. Using a solid background color, the model can minimize its loss by simply predicting that background color, rather than transparency (zero density). By randomizing the background colors, the model is forced to learn zero density to let the randomized colors "shine through". Q: How to mask away NeRF training pixels (e.g. for dynamic object removal)? A: For any training image xyz.* with dynamic objects, you can provide a dynamic_mask_xyz.png in the same folder. This file must be in PNG format, where non-zero pixel values indicate masked-away regions. Troubleshooting compile errors Before investigating further, make sure all submodules are up-to-date and try compiling again. sh instant-ngp$ git submodule sync --recursive instant-ngp$ git submodule update --init --recursive If instant-ngp still fails to compile, update CUDA as well as your compiler to the latest versions you can install on your system. It is crucial that you update both , as newer CUDA versions are not always compatible with earlier compilers and vice versa. If your problem persists, consult the following table of known issues. *After each step, delete the build folder and let CMake regenerate it before trying again.* | Problem | Resolution | |---------|------------| | CMake error: No CUDA toolset found / CUDA_ARCHITECTURES is empty for target "cmTC_0c70f" | Windows: the Visual Studio CUDA integration was not installed correctly. Follow these instructions to fix the problem without re-installing CUDA. ( #18 ) | | | Linux: Environment variables for your CUDA installation are probably incorrectly set. You may work around the issue using cmake . -B build -DCMAKE_CUDA_COMPILER=/usr/local/cuda-<your cuda version>/bin/nvcc ( #28 ) | | CMake error: No known features for CXX compiler "MSVC" | Reinstall Visual Studio & make sure you run CMake from a developer shell. Make sure you delete the build folder before building again. ( #21 ) | | Compile error: A single input file is required for a non-link phase when an outputfile is specified | Ensure there no spaces in the path to instant-ngp . Some build systems seem to have trouble with those. ( #39 #198 ) | | Compile error: undefined references to "cudaGraphExecUpdate" / identifier "cublasSetWorkspace" is undefined | Update your CUDA installation (which is likely 11.0) to 11.3 or higher. ( #34 #41 #42 ) | | Compile error: too few arguments in function call | Update submodules with the above two git commands. ( #37 #52 ) | | Python error: No module named 'pyngp' | It is likely that CMake did not detect your Python installation and therefore did not build pyngp . Check CMake logs to verify this. If pyngp was built in a different folder than build , Python will be unable to detect it and you have to supply the full path to the import statement. ( #43 ) | If you cannot find your problem in the table, try searching the discussions board and the issues area for help. If you are still stuck, please open an issue and ask for help. Thanks Many thanks to Jonathan Tremblay and Andrew Tao for testing early versions of this codebase and to Arman Toorians and Saurabh Jain for the factory robot dataset. We also thank Andrew Webb for noticing that one of the prime numbers in the spatial hash was not actually prime; this has been fixed since. This project makes use of a number of awesome open source libraries, including: * tiny-cuda-nn for fast CUDA networks and input encodings * tinyexr for EXR format support * tinyobjloader for OBJ format support * stb_image for PNG and JPEG support * Dear ImGui an excellent immediate mode GUI library * Eigen a C++ template library for linear algebra * pybind11 for seamless C++ / Python interop * and others! See the dependencies folder. Many thanks to the authors of these brilliant projects! License and Citation bibtex @article{mueller2022instant, author = {Thomas M\"uller and Alex Evans and Christoph Schied and Alexander Keller}, title = {Instant Neural Graphics Primitives with a Multiresolution Hash Encoding}, journal = {ACM Trans. Graph.}, issue_date = {July 2022}, volume = {41}, number = {4}, month = jul, year = {2022}, pages = {102:1--102:15}, articleno = {102}, numpages = {15}, url = {https://doi.org/10.1145/3528223.3530127}, doi = {10.1145/3528223.3530127}, publisher = {ACM}, address = {New York, NY, USA}, } Copyright ยฉ 2022, NVIDIA Corporation. All rights reserved. This work is made available under the Nvidia Source Code License-NC. Click here to view a copy of this license.
Instant neural graphics primitives: lightning fast NeRF and more
neural-network,machine-learning,cuda,nerf,computer-graphics,computer-vision,3d-reconstruction,signed-distance-functions,function-approximation,real-time
1
57
144
742
461
10
1
bloomberg/memray
Memray is a memory profiler for Python. It can track memory allocations in Python code, in native extension modules, and in the Python interpreter itself. It can generate several different types of reports to help you analyze the captured memory usage data. While commonly used as a CLI tool, it can also be used as a library to perform more fine-grained profiling tasks. Notable features: ๐Ÿ•ต๏ธโ€โ™€๏ธ Traces every function call so it can accurately represent the call stack, unlike sampling profilers. โ„ญ Also handles native calls in C/C++ libraries so the entire call stack is present in the results. ๐ŸŽ Blazing fast! Profiling slows the application only slightly. Tracking native code is somewhat slower, but this can be enabled or disabled on demand. ๐Ÿ“ˆ It can generate various reports about the collected memory usage data, like flame graphs. ๐Ÿงต Works with Python threads. ๐Ÿ‘ฝ๐Ÿงต Works with native-threads (e.g. C++ threads in C extensions). Memray can help with the following problems: Analyze allocations in applications to help discover the cause of high memory usage. Find memory leaks. Find hotspots in code that cause a lot of allocations. Note Memray only works on Linux and MacOS, and cannot be installed on other platforms. Help us improve Memray! We are constantly looking for feedback from our awesome community โค๏ธ. If you have used Memray to solve a problem, profile an application, find a memory leak or anything else, please let us know! We would love to hear about your experience and how Memray helped you. Please, consider writing your story in the Success Stories discussion page . It really makes a difference! Installation Memray requires Python 3.7+ and can be easily installed using most common Python packaging tools. We recommend installing the latest stable release from PyPI with pip: shell python3 -m pip install memray Notice that Memray contains a C extension so releases are distributed as binary wheels as well as the source code. If a binary wheel is not available for your system (Linux x86/x64 or macOS), you'll need to ensure that all the dependencies are satisfied on the system where you are doing the installation. Building from source If you wish to build Memray from source you need the following binary dependencies in your system: libdebuginfod-dev (for Linux) libunwind (for Linux) liblz4 Check your package manager on how to install these dependencies (for example apt-get install build-essential python3-dev libdebuginfod-dev libunwind-dev liblz4-dev in Debian-based systems or brew install lz4 in MacOS). Note that you may need to teach the compiler where to find the header and library files of the dependencies. For example, in MacOS with brew you may need to run: shell export CFLAGS="-I$(brew --prefix lz4)/include" LDFLAGS="-L$(brew --prefix lz4)/lib -Wl,-rpath,$(brew --prefix lz4)/lib" before installing memray . Check the documentation of your package manager to know the location of the header and library files for more detailed information. If you are building on MacOS, you will also need to set the deployment target. shell export MACOSX_DEPLOYMENT_TARGET=10.14 Once you have the binary dependencies installed, you can clone the repository and follow with the normal building process: shell git clone git@github.com:bloomberg/memray.git memray cd memray python3 -m venv ../memray-env/ # just an example, put this wherever you want source ../memray-env/bin/activate python3 -m pip install --upgrade pip python3 -m pip install -e . -r requirements-test.txt -r requirements-extra.txt This will install Memray in the virtual environment in development mode (the -e of the last pip install command). If you plan to contribute back, you should install the pre-commit hooks: shell pre-commit install This will ensure that your contribution passes our linting checks. Documentation You can find the latest documentation available here . Usage There are many ways to use Memray. The easiest way is to use it as a command line tool to run your script, application, or library. ``` usage: memray [-h] [-v] {run,flamegraph,table,live,tree,parse,summary,stats} ... Memory profiler for Python applications Run memray run to generate a memory profile report, then use a reporter command such as memray flamegraph or memray table to convert the results into HTML. Example: $ python3 -m memray run -o output.bin my_script.py $ python3 -m memray flamegraph output.bin positional arguments: {run,flamegraph,table,live,tree,parse,summary,stats} Mode of operation run Run the specified application and track memory usage flamegraph Generate an HTML flame graph for peak memory usage table Generate an HTML table with all records in the peak memory usage live Remotely monitor allocations in a text-based interface tree Generate a tree view in the terminal for peak memory usage parse Debug a results file by parsing and printing each record in it summary Generate a terminal-based summary report of the functions that allocate most memory stats Generate high level stats of the memory usage in the terminal optional arguments: -h, --help Show this help message and exit -v, --verbose Increase verbosity. Option is additive and can be specified up to 3 times -V, --version Displays the current version of Memray Please submit feedback, ideas, and bug reports by filing a new issue at https://github.com/bloomberg/memray/issues ``` To use Memray over a script or a single python file you can use: shell python3 -m memray run my_script.py If you normally run your application with python3 -m my_module , you can use the -m flag with memray run : shell python3 -m memray run -m my_module You can also invoke Memray as a command line tool without having to use -m to invoke it as a module: shell memray run my_script.py memray run -m my_module The output will be a binary file (like memray-my_script.2369.bin ) that you can analyze in different ways. One way is to use the memray flamegraph command to generate a flame graph: shell memray flamegraph my_script.2369.bin This will produce an HTML file with a flame graph of the memory usage that you can inspect with your favorite browser. There are multiple other reporters that you can use to generate other types of reports, some of them generating terminal-based output and some of them generating HTML files. Here is an example of a Memray flamegraph: Pytest plugin If you want an easy and convenient way to use memray in your test suite, you can consider using pytest-memray . Once installed, this pytest plugin allows you to simply add --memray to the command line invocation: shell pytest --memray tests/ And will automatically get a report like this: ``` python3 -m pytest tests --memray =============================================================================================================================== test session starts ================================================================================================================================ platform linux -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /mypackage, configfile: pytest.ini plugins: cov-2.12.0, memray-0.1.0 collected 21 items tests/test_package.py ..................... [100%] ================================================================================================================================= MEMRAY REPORT ================================================================================================================================== Allocations results for tests/test_package.py::some_test_that_allocates ๐Ÿ“ฆ Total memory allocated: 24.4MiB ๐Ÿ“ Total allocations: 33929 ๐Ÿ“Š Histogram of allocation sizes: |โ–‚ โ–ˆ | ๐Ÿฅ‡ Biggest allocating functions: - parse:/opt/bb/lib/python3.8/ast.py:47 -> 3.0MiB - parse:/opt/bb/lib/python3.8/ast.py:47 -> 2.3MiB - _visit:/opt/bb/lib/python3.8/site-packages/astroid/transforms.py:62 -> 576.0KiB - parse:/opt/bb/lib/python3.8/ast.py:47 -> 517.6KiB - __init__:/opt/bb/lib/python3.8/site-packages/astroid/node_classes.py:1353 -> 512.0KiB ``` You can also use some of the included markers to make tests fail if the execution of said test allocates more memory than allowed: python @pytest.mark.limit_memory("24 MB") def test_foobar(): # do some stuff that allocates memory To learn more on how the plugin can be used and configured check out the plugin documentation . Native mode Memray supports tracking native C/C++ functions as well as Python functions. This can be especially useful when profiling applications that have C extensions (such as numpy or pandas ) as this gives a holistic vision of how much memory is allocated by the extension and how much is allocated by Python itself. To activate native tracking, you need to provide the --native argument when using the run subcommand: shell memray run --native my_script.py This will automatically add native information to the result file and it will be automatically used by any reporter (such the flamegraph or table reporters). This means that instead of seeing this in the flamegraphs: You will now be able to see what's happening inside the Python calls: Reporters display native frames in a different color than Python frames. They can also be distinguished by looking at the file location in a frame (Python frames will generally be generated from files with a .py extension while native frames will be generated from files with extensions like .c, .cpp or .h). Live mode Memray's live mode runs a script or a module in a terminal-based interface that allows you to interactively inspect its memory usage while it runs. This is useful for debugging scripts or modules that take a long time to run or that exhibit multiple complex memory patterns. You can use the --live option to run the script or module in live mode: shell memray run --live my_script.py or if you want to execute a module: shell memray run --live -m my_module This will show the following TUI interface in your terminal: Sorting results The results are displayed in descending order of total memory allocated by a function and the subfunctions called by it. You can change the ordering with the following keyboard shortcuts: t (default): Sort by total memory o: Sort by own memory a: Sort by allocation count In most terminals you can also click the "Sort by Total", "Sort by Own", and "Sort by Allocations" buttons on the footer. The sorted column's heading is underlined. Viewing different threads By default, the live command will present the main thread of the program. You can look at different threads of the program by pressing the greater than and less than keys, < and > . In most terminals you can also click the "Previous Thread" and "Next Thread" buttons on the footer. API In addition to tracking Python processes from a CLI using memray run , it is also possible to programmatically enable tracking within a running Python program. ```py import memray with memray.Tracker("output_file.bin"): print("Allocations will be tracked until the with block ends") ``` For details, see the API documentation . License Memray is Apache-2.0 licensed, as found in the LICENSE file. Code of Conduct Code of Conduct This project has adopted a Code of Conduct. If you have any concerns about the Code, or behavior that you have experienced in the project, please contact us at opensource@bloomberg.net. Security Policy Security Policy If you believe you have identified a security vulnerability in this project, please send an email to the project team at opensource@bloomberg.net, detailing the suspected issue and any methods you've found to reproduce it. Please do NOT open an issue in the GitHub repository, as we'd prefer to keep vulnerability reports private until we've had an opportunity to review and address them. Contributing We welcome your contributions to help us improve and extend this project! Below you will find some basic steps required to be able to contribute to the project. If you have any questions about this process or any other aspect of contributing to a Bloomberg open source project, feel free to send an email to opensource@bloomberg.net and we'll get your questions answered as quickly as we can. Contribution Licensing Since this project is distributed under the terms of an open source license , contributions that you make are licensed under the same terms. In order for us to be able to accept your contributions, we will need explicit confirmation from you that you are able and willing to provide them under these terms, and the mechanism we use to do this is called a Developer's Certificate of Origin (DCO) . This is very similar to the process used by the Linux kernel, Samba, and many other major open source projects. To participate under these terms, all that you must do is include a line like the following as the last line of the commit message for each commit in your contribution: Signed-Off-By: Random J. Developer <random@developer.example.org> The simplest way to accomplish this is to add -s or --signoff to your git commit command. You must use your real name (sorry, no pseudonyms, and no anonymous contributions). Steps Create an Issue, select 'Feature Request', and explain the proposed change. Follow the guidelines in the issue template presented to you. Submit the Issue. Submit a Pull Request and link it to the Issue by including "# " in the Pull Request summary.
Memray is a memory profiler for Python
memory,memory-leak,memory-leak-detection,memory-profiler,profiler,python,python3,hacktoberfest
19
58
385
1,237
15
3
6
neonbjb/tortoise-tts
TorToiSe Tortoise is a text-to-speech program built with the following priorities: Strong multi-voice capabilities. Highly realistic prosody and intonation. This repo contains all the code needed to run Tortoise TTS in inference mode. Manuscript: https://arxiv.org/abs/2305.07243 Hugging Face space A live demo is hosted on Hugging Face Spaces. If you'd like to avoid a queue, please duplicate the Space and add a GPU. Please note that CPU-only spaces do not work for this demo. https://huggingface.co/spaces/Manmay/tortoise-tts Install via pip bash pip install tortoise-tts If you would like to install the latest development version, you can also install it directly from the git repository: bash pip install git+https://github.com/neonbjb/tortoise-tts What's in a name? I'm naming my speech-related repos after Mojave desert flora and fauna. Tortoise is a bit tongue in cheek: this model is insanely slow. It leverages both an autoregressive decoder and a diffusion decoder; both known for their low sampling rates. On a K80, expect to generate a medium sized sentence every 2 minutes. well..... not so slow anymore now we can get a 0.25-0.3 RTF on 4GB vram and with streaming we can get < 500 ms latency !!! Demos See this page for a large list of example outputs. A cool application of Tortoise + GPT-3 (not affiliated with this repository): https://twitter.com/lexman_ai. Unfortunately, this project seems no longer to be active. Usage guide Local installation If you want to use this on your own computer, you must have an NVIDIA GPU. On Windows, I highly recommend using the Conda installation method. I have been told that if you do not do this, you will spend a lot of time chasing dependency problems. First, install miniconda: https://docs.conda.io/en/latest/miniconda.html Then run the following commands, using anaconda prompt as the terminal (or any other terminal configured to work with conda) This will: 1. create conda environment with minimal dependencies specified 1. activate the environment 1. install pytorch with the command provided here: https://pytorch.org/get-started/locally/ 1. clone tortoise-tts 1. change the current directory to tortoise-tts 1. run tortoise python setup install script shell conda create --name tortoise python=3.9 numba inflect conda activate tortoise conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia conda install transformers=4.29.2 git clone https://github.com/neonbjb/tortoise-tts.git cd tortoise-tts python setup.py install Optionally, pytorch can be installed in the base environment, so that other conda environments can use it too. To do this, simply send the conda install pytorch... line before activating the tortoise environment. Note: When you want to use tortoise-tts, you will always have to ensure the tortoise conda environment is activated. If you are on windows, you may also need to install pysoundfile: conda install -c conda-forge pysoundfile Docker An easy way to hit the ground running and a good jumping off point depending on your use case. ```sh git clone https://github.com/neonbjb/tortoise-tts.git cd tortoise-tts docker build . -t tts docker run --gpus all \ -e TORTOISE_MODELS_DIR=/models \ -v /mnt/user/data/tortoise_tts/models:/models \ -v /mnt/user/data/tortoise_tts/results:/results \ -v /mnt/user/data/.cache/huggingface:/root/.cache/huggingface \ -v /root:/work \ -it tts ``` This gives you an interactive terminal in an environment that's ready to do some tts. Now you can explore the different interfaces that tortoise exposes for tts. For example: sh cd app conda activate tortoise time python tortoise/do_tts.py \ --output_path /results \ --preset ultra_fast \ --voice geralt \ --text "Time flies like an arrow; fruit flies like a bananna." Apple Silicon On macOS 13+ with M1/M2 chips you need to install the nighly version of PyTorch, as stated in the official page you can do: shell pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu Be sure to do that after you activate the environment. If you don't use conda the commands would look like this: shell python3.10 -m venv .venv source .venv/bin/activate pip install numba inflect psutil pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu pip install transformers git clone https://github.com/neonbjb/tortoise-tts.git cd tortoise-tts pip install . Be aware that DeepSpeed is disabled on Apple Silicon since it does not work. The flag --use_deepspeed is ignored. You may need to prepend PYTORCH_ENABLE_MPS_FALLBACK=1 to the commands below to make them work since MPS does not support all the operations in Pytorch. do_tts.py This script allows you to speak a single phrase with one or more voices. shell python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast faster inference read.py This script provides tools for reading large amounts of text. shell python tortoise/read_fast.py --textfile <your text to be read> --voice random read.py This script provides tools for reading large amounts of text. shell python tortoise/read.py --textfile <your text to be read> --voice random This will break up the textfile into sentences, and then convert them to speech one at a time. It will output a series of spoken clips as they are generated. Once all the clips are generated, it will combine them into a single file and output that as well. Sometimes Tortoise screws up an output. You can re-generate any bad clips by re-running read.py with the --regenerate argument. API Tortoise can be used programmatically, like so: python reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths] tts = api.TextToSpeech() pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast') To use deepspeed: python reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths] tts = api.TextToSpeech(use_deepspeed=True) pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast') To use kv cache: python reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths] tts = api.TextToSpeech(kv_cache=True) pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast') To run model in float16: python reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths] tts = api.TextToSpeech(half=True) pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast') for Faster runs use all three: python reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths] tts = api.TextToSpeech(use_deepspeed=True, kv_cache=True, half=True) pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast') Acknowledgements This project has garnered more praise than I expected. I am standing on the shoulders of giants, though, and I want to credit a few of the amazing folks in the community that have helped make this happen: Hugging Face, who wrote the GPT model and the generate API used by Tortoise, and who hosts the model weights. Ramesh et al who authored the DALLE paper, which is the inspiration behind Tortoise. Nichol and Dhariwal who authored the (revision of) the code that drives the diffusion model. Jang et al who developed and open-sourced univnet, the vocoder this repo uses. Kim and Jung who implemented univnet pytorch model. lucidrains who writes awesome open source pytorch models, many of which are used here. Patrick von Platen whose guides on setting up wav2vec were invaluable to building my dataset. Notice Tortoise was built entirely by the author (James Betker) using their own hardware. Their employer was not involved in any facet of Tortoise's development. License Tortoise TTS is licensed under the Apache 2.0 license. If you use this repo or the ideas therein for your research, please cite it! A bibtex entree can be found in the right pane on GitHub.
A multi-voice TTS system trained with an emphasis on quality
[]
0
42
102
339
288
4
0
AstroNvim/AstroNvim
AstroNvim Install ยท Configure ยท Community Plugins ยท Website ยท Discord AstroNvim is an aesthetically pleasing and feature-rich neovim config that is extensible and easy to use with a great set of plugins ๐ŸŒŸ Preview โœจ Features Common plugin specifications with AstroCommunity File explorer with Neo-tree Autocompletion with Cmp Git integration with Gitsigns Statusline, Winbar, and Bufferline with Heirline Terminal with Toggleterm Fuzzy finding with Telescope Syntax highlighting with Treesitter Formatting and Linting with None-ls Language Server Protocol with Native LSP Debug Adapter Protocol with nvim-dap โšก Requirements Nerd Fonts ( Optional with manual intervention: See Documentation on customizing icons ) [1] Neovim 0.9.5+ ( Not including nightly) Tree-sitter CLI ( Note: This is only necessary if you want to use auto_install feature with Treesitter) A clipboard tool is necessary for the integration with the system clipboard (see :help clipboard-tool for supported solutions) Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) [2] Optional Requirements: ripgrep - live grep telescope search ( <leader>fw ) lazygit - git ui toggle terminal ( <leader>tl or <leader>gg ) go DiskUsage() - disk usage toggle terminal ( <leader>tu ) bottom - process viewer toggle terminal ( <leader>tt ) Python - python repl toggle terminal ( <leader>tp ) Node - node repl toggle terminal ( <leader>tn ) [!NOTE] [1] All downloadable Nerd Fonts contain icons which are used by AstroNvim. Install the Nerd Font of your choice to your system and in your terminal emulator settings, set its font face to that Nerd Font. If you are using AstroNvim on a remote system via SSH, you do not need to install the font on the remote system. [!NOTE] [2] Note when using default theme: For MacOS, the default terminal does not have true color support. You will need to use iTerm2 , Kitty , WezTerm , or another terminal emulator that has true color support. ๐Ÿ› ๏ธ Installation AstroNvim is provided as a plugin that can be installed with the lazy.nvim plugin manager and then used to import all of the plugin configurations that AstroNvim provides. To quickly get started it is recommended to start with the official AstroNvim Template which provides a great starting point for a new AstroNvim based configuration. Linux/Mac OS (Unix) Make a backup of your current nvim and shared folder shell mv ~/.config/nvim ~/.config/nvim.bak mv ~/.local/share/nvim ~/.local/share/nvim.bak mv ~/.local/state/nvim ~/.local/state/nvim.bak mv ~/.cache/nvim ~/.cache/nvim.bak Clone the template repository shell git clone --depth 1 https://github.com/AstroNvim/template ~/.config/nvim rm -rf ~/.config/nvim/.git nvim Windows (Powershell) Make a backup of your current nvim and nvim-data folder pwsh Rename-Item -Path $env:LOCALAPPDATA\nvim -NewName $env:LOCALAPPDATA\nvim.bak Rename-Item -Path $env:LOCALAPPDATA\nvim-data -NewName $env:LOCALAPPDATA\nvim-data.bak Clone the repository pwsh git clone --depth 1 https://github.com/AstroNvim/template $env:LOCALAPPDATA\nvim Remove-Item $env:LOCALAPPDATA\nvim\.git -Recurse -Force nvim Minimal ~/.config/nvim/init.lua Some user's might not want to use an entire template or do any customization. Here is a minimal ~/.config/nvim/init.lua file that simply set's up a base AstroNvim installation: ```lua local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then -- stylua: ignore vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup { "AstroNvim/AstroNvim", version = "^4", import = "astronvim.plugins" } ``` ๐Ÿ“ฆ Basic Setup Install LSP Enter :LspInstall followed by the name of the server you want to install Example: :LspInstall pyright Install language parser Enter :TSInstall followed by the name of the language you want to install Example: :TSInstall python Install Debugger Enter :DapInstall followed by the name of the debugger you want to install Example: :DapInstall python Manage plugins Run :Lazy check to check for plugin updates Run :Lazy update to apply any pending plugin updates Run :Lazy clean to remove any disabled or unused plugins Run :Lazy sync to update and clean plugins Update AstroNvim Packages Run :AstroUpdate ( <leader>pa ) to update both Neovim plugins and Mason packages ๐Ÿ—’๏ธ Links AstroNvim Website AstroNvim Documentation Setup is given for basic editor setup after installation Default Mappings more about the default key bindings Customizing Plugins more about configuring and adding plugins ๐Ÿ“น Videos There have been some great review videos released by members of the community! Here are a few: Neovim With AstroNvim | Your New Advanced Development Editor (Version: 3, Content By: @Cretezy ) Why I'm quitting VIM by Carlos Mafla (Version: 2, Content By: @gigo6000 ) Astro Vim - All in one Nvim config!! by John McBride (Version: 1, Content By: @jpmcb ) ๐Ÿš€ Contributing If you plan to contribute, please check the contribution guidelines first. โญ Credits Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible. Plugins NvChad LunarVim CosmicVim [![Lua](https://img.shields.io/badge/Made%20with%20Lua-blue.svg?style=for-the-badge&logo=lua)](https://lua.org)
AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins
vim,lua,neovim,ide,nvim,neovim-configuration,neovim-config,neovim-lua,neovim-setup,astrovim
293
82
956
1,996
4
5
2
faker-js/faker
Faker Generate massive amounts of fake (but realistic) data for testing and development. [![npm version](https://badgen.net/npm/v/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker) [![npm downloads](https://badgen.net/npm/dm/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker) [![Continuous Integration](https://github.com/faker-js/faker/actions/workflows/ci.yml/badge.svg)](https://github.com/faker-js/faker/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/faker-js/faker/branch/next/graph/badge.svg?token=N61U168G08)](https://codecov.io/gh/faker-js/faker) [![Chat on Discord](https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord)](https://chat.fakerjs.dev) [![Open Collective](https://img.shields.io/opencollective/backers/fakerjs)](https://opencollective.com/fakerjs#section-contributors) [![sponsor](https://img.shields.io/opencollective/all/fakerjs?label=sponsors)](https://opencollective.com/fakerjs) โšก๏ธ Try it Online Open in StackBlitz ๐Ÿ“™ API Documentation โš ๏ธ You are reading the docs for the next branch โš ๏ธ Please proceed to the Getting Started Guide for the stable release of Faker. For detailed API documentation, please select the version of the documentation you are looking for. | Version | Website | | :---------: | :------------------------ | | v9 (next) | https://next.fakerjs.dev/ | | v8 (stable) | https://fakerjs.dev/ | | v7 (old) | https://v7.fakerjs.dev/ | ๐Ÿš€ Features ๐Ÿ’Œ Locations - Generate valid looking Addresses, Zip Codes, Street Names, States, and Countries! โฐ Time-based Data - Past, present, future, recent, soon... whenever! ๐ŸŒ Localization - Pick a locale to generate realistic looking Names, Addresses, and Phone Numbers. ๐Ÿ’ธ Finance - Create stubbed out Account Details, Transactions, and Crypto Addresses. ๐Ÿ‘  Products - Generate Prices, Product Names, Adjectives, and Descriptions. ๐Ÿ‘พ Hacker Jargon - โ€œTry to reboot the SQL bus, maybe it will bypass the virtual application!โ€ ๐Ÿง Names - Generate virtual humans with a complete online and offline identity. ๐Ÿ”ข Numbers - Of course, we can also generate random numbers and strings. Note : Faker tries to generate realistic data and not obvious fake data. The generated names, addresses, emails, phone numbers, and/or other data might be coincidentally valid information. Please do not send any of your messages/calls to them from your test setup. ๐Ÿ“ฆ Install bash npm install --save-dev @faker-js/faker ๐Ÿช„ Usage ```ts // ESM import { faker } from '@faker-js/faker'; // CJS const { faker } = require('@faker-js/faker'); export function createRandomUser() { return { userId: faker.string.uuid(), username: faker.internet.userName(), email: faker.internet.email(), avatar: faker.image.avatar(), password: faker.internet.password(), birthdate: faker.date.birthdate(), registeredAt: faker.date.past(), }; } export const users = faker.helpers.multiple(createRandomUser, { count: 5, }); ``` ๐Ÿ’Ž Modules An in-depth overview of the API methods is available in the documentation for v8 (stable) and v9.* (next) . Templates Faker contains a generator method faker.helpers.fake for combining faker API methods using a mustache string format. ts console.log( faker.helpers.fake( 'Hello {{person.prefix}} {{person.lastName}}, how are you today?' ) ); ๐ŸŒ Localization Faker has support for multiple locales. The main faker instance uses the English locale. But you can also import instances using other locales. ```ts // ESM import { fakerDE as faker } from '@faker-js/faker'; // CJS const { fakerDE: faker } = require('@faker-js/faker'); ``` See our documentation for a list of provided languages . Please note: Not every locale provides data for every module. In our pre-made faker instances, we fall back to English in such a case as this is the most complete and most commonly used language. If you don't want that or prefer a different fallback, you can also build your own instances. ```ts import { de, de_CH, Faker } from '@faker-js/faker'; export const faker = new Faker({ locale: [de_CH, de], }); ``` โš™๏ธ Setting a randomness seed If you want consistent results, you can set your own seed: ```ts faker.seed(123); const firstRandom = faker.number.int(); // Setting the seed again resets the sequence. faker.seed(123); const secondRandom = faker.number.int(); console.log(firstRandom === secondRandom); ``` ๐Ÿค Sponsors Faker is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers Sponsors Backers โœจ Contributing Please make sure to read the Contributing Guide before making a pull request. ๐Ÿ“˜ Credits Thanks to all the people who already contributed to Faker! The fakerjs.dev website is kindly hosted by the Netlify Team. Also the search functionality is powered by algolia . ๐Ÿ“ Changelog Detailed changes for each release are documented in the release notes . ๐Ÿ“œ What happened to the original faker.js? Read the team update (January 14th, 2022). ๐Ÿ”‘ License MIT
Generate massive amounts of fake data in the browser and node.js
faker,data,fake,nodejs,browser,javascript
39
421
2,199
3,543
113
15
6
smartcontractkit/full-blockchain-solidity-course-js
Update: Head to Cyfrin Updraft โ„น๏ธ Important: This repo is no longer actively maintained as there have been changes in Hardhat tooling. The video is out of sync with the code, and you can still follow along with the video, but you will likely need to troubleshoot the changes in the tooling and dependencies. Note also that best practices have evolved since this video was made. If you'd like to continue your training with more up-to-date material, you can take a look at Cyfrin Updraft . That content is developed with love by Patrick & Cyfrin <3. However note that Cyfrin Updraft training uses Foundry, not Hardhat, so there will be tooling changes involved. Web3, Full Stack Solidity, Smart Contract & Blockchain - Beginner to Expert ULTIMATE Course | Javascript Edition Welcome to the repository for the Ultimate Web3, Full Stack Solidity, and Smart Contract - Beginner to Expert Full Course | Javascript Edition FreeCodeCamp Course! Link to video: https://www.youtube.com/watch?v=gyMwXuJrbJQ All code references have both a javascript and a typescript edition. Recommended Testnet: Sepolia We have updated the repos to work with Sepolia due to Rinkeby and Kovan being sunset, and Goerli being a disaster. Let us know if any of the changes break stuff! Testnet Faucets Main Faucet: https://faucets.chain.link Backup Faucet: https://sepoliafaucet.com/ โš ๏ธ All code associated with this course is for demo purposes only. They have not been audited and should not be considered production ready. Please use at your own risk. Resources For This Course Questions Github Discussions Ask questions and chat about the course here! Stack Exchange Ethereum Great place for asking technical questions about Ethereum StackOverflow Great place for asking technical questions overall Table of Contents Resources Testnet Faucets Resources For This Course Questions Table of Contents Lesson 0: The Edge of the Rabbit Hole Welcome to the course! Best Practices Lesson 1: Blockchain Basics What is a Blockchain? What does a blockchain do? The Purpose Of Smart Contracts Other Blockchain Benefits What have Smart Contracts done so far? Making Your First Transaction Gas I: Introduction to Gas How Do Blockchains Work? Signing Transactions Gas II High-Level Blockchain Fundamentals Lesson 2: Welcome to Remix! Simple Storage Introduction Setting Up Your First Contract Basic Solidity: Types Basic Solidity: Functions Basic Solidity: Arrays & Structs Basic Solidity: Compiler Errors and Warnings Memory, Storage, Calldata (Intro) Mappings Deploying your First Contract The EVM & A Recap of Lesson 2 Lesson 3: Remix Storage Factory Introduction Basic Solidity: Importing Contracts into other Contracts Basic Solidity: Interacting with other Contracts Basic Solidity: Inheritance & Overrides Lesson 3 Recap Lesson 4: Remix Fund Me Introduction Sending ETH Through a Function & Reverts Chainlink & Oracles Review of Sending ETH and working with Chainlink Interfaces & Price Feeds Importing from GitHub & NPM Floating Point Math in Solidity Basic Solidity: Arrays & Structs II Review of Interfacs, Importing from GitHub, & Math in Solidity Libraries SafeMath, Overflow Checking, and the "unchecked" keywork Basic Solidity: For Loop Basic Solidity: Resetting an Array Sending ETH from a Contract Basic Solidity: Constructor Basic Solidity: Modifiers Testnet Demo Advanced Solidity Immutable & Constant Custom Errors Receive & Fallback Functions Lesson 4 Recap Lesson 5: Ethers.js Simple Storage Effective Debugging Strategies & Getting Help How to Debug Anything Video Installation & Setup Mac & Linux Setup Windows Setup Gitpod Local Development Introduction Optional Javascript Crash Courses Tiny Javascript Refresher Asynchronous Programming in Javascript Compiling our Solidity Ganache & Networks Introduction to Ethers.js A Note on the await Keyword Adding Transaction Overrides Transaction Receipts Sending a "raw" Transaction in Ethersjs Interacting with Contracts in Ethersjs Environment Variables Better Private Key Management Optional Prettier Formatting Deploying to a Testnet or a Mainnet Verifying on Block Explorers from the UI Alchemy Dashboard & The Mempool Lesson 5 Recap Typescript Ethers Simple Storage Lesson 6: Hardhat Simple Storage Introduction Hardhat Setup Troubleshooting Hardaht Setup Hardhat Setup Continued Deploying SimpleStorage from Hardhat Networks in Hardhat Programatic Verification Interacting with Contracts in Hardhat Artifacts Troubleshooting Custom Hardhat Tasks Hardhat Localhost Node The Hardhat Console Hardhat Tests Hardhat Gas Reporter Solidity Coverage Hardhat Waffle Lesson 6 Recap Typescript Hardhat Simple Storage Lesson 7: Hardhat Fund Me Introduction Hardhat Setup - Fund Me Linting Hardhat Setup - Fund Me - Continued Importing from NPM Hardhat Deploy Mocking Utils Folder Testnet Demo - Hardhat Fund Me Solidity Style Guide Testing Fund Me Breakpoints & Debugging Gas III: console.log & Debugging Testing Fund Me II Storage in Solidity Gas Optimizations using Storage Knowledge Solidity Chainlink Style Guide Storage Review Staging Tests Running Scripts on a Local Node Adding Scripts to your package.json Pushing to GitHub ๐Ÿธ๐Ÿฆ Tweet Me (add your repo in)! Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End) Introduction How Websites work with Web3 Wallets HTML Setup Connecting HTML to Metamask Javascript in it's own file ES6 vs Nodejs Sending a transaction from a Website Resetting an Account in Metamask Listening for Events and Completed Transactions Input Forms Reading from the Blockchain Withdraw Function Lesson 8 Recap Optional Links Lesson 9: Hardhat Smart Contract Lottery Introduction Hardhat Setup - Smart Contract Lottery Raffle.sol Setup Introduction to Events Events in Raffle.sol Introduction to Chainlink VRF Sub-Lesson: Chainlink VRF Implementing Chainlink VRF - Introduction Hardhat Shorthand Implementing Chainlink VRF - The Request Implementing Chainlink VRF - The FulFill Modulo Introduction to Chainlink Keepers Implementing Chainlink Keepers - checkUpkeep Enums Implementing Chainlink Keepers - checkUpkeep continued Implementing Chainlink Keepers - performUpkeep Code Cleanup Deploying Raffle.sol Mock Chainlink VRF Coordinator Continued Raffle.sol Unit Tests Testing Events & Chai Matchers Continued I Hardhat Methods & Time Travel Continued II Callstatic Continued III Massive Promise Test Continued IV Raffle.sol Staging Tests Testing on a Testnet Recommended LINK amounts for Sepolia Staging Test: Conclusion Typescript - Smart Contract Lottery Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End) Introduction Optional Sub-Lesson: Full Stack Development & Other Libraries NextJS Setup Manual Header I React Hooks Manual Header II useEffect Hook Local Storage isWeb3EnabledLoading web3uikit Introduction to Calling Functions in Nextjs Automatic Constant Value UI Updater runContractFunction useState Calling Functions in NextJS useNotification Reading & Displaying Contract Data A Note about onSuccess A Challenge to You Tailwind & Styling Introduction to Hosting your Site IPFS Hosting on IPFS Hosting on IPFS & Filecoin using Fleek Filecoin Overview Lesson 10 Recap Lesson 11: Hardhat Starter Kit Lesson 12: Hardhat ERC20s What is an ERC? What is an EIP? What is an ERC20? Manually Creating an ERC20 Token Creating an ERC20 Token with Openzeppelin Lesson 12 Recap Lesson 13: Hardhat DeFi & Aave What is DeFi? What is Aave? Programatic Borrowing & Lending WETH - Wrapped ETH Forking Mainnet Depositing into Aave Borrowing from Aave Repaying with Aave Visualizing the Transactions Lesson 13 Recap Happy Bow-Tie Friday with Austin Griffith More DeFi Learnings: Lesson 14: Hardhat NFTs (EVERYTHING you need to know about NFTs) What is an NFT? Code Overview Hardhat Setup Basic NFT Write Tests Random IPFS NFT Mapping Chainlink VRF Requests Creating Rare NFTs Setting the NFT Image Setting an NFT Mint Price Deploy Script Uploading Token Images with Pinata Uploading Token URIs (metadata) with Pinata Deploying Tests Dynamic SVG On-Chain NFT What is an SVG? Initial Code Base64 Encoding Advanced: EVM Opcodes, Encoding, and Calling abi.encode & abi.encodePacked Introduction to Encoding Function Calls Directly Introduction to Encoding Function Calls Recap Encoding Function Calls Directly Creating an NFT TokenURI on-Chain Making the NFT Dynamic Deploy Script Deploying the NFTs to a Testnet Lesson 14 Recap Lesson 15: NextJS NFT Marketplace (If you finish this lesson, you are a full-stack MONSTER!) Introduction Part I: NFT Marketplace Contracts Hardhat Setup NftMarketplace.sol Reentrancy NftMarketplace.sol - Continued NftMarketplace.sol - Deploy Script NftMarketplace.sol - Tests NftMarketplace.sol - Scripts Part II: Moralis Front End What is Moralis? NextJS Setup Adding Tailwind Introduction to Indexing in Web3 Connecting Moralis to our Local Hardhat Node Moralis Event Sync Reset Local Chain Moralis Cloud Functions Practice Resetting the Local Chain Moralis Cloud Functions II Querying the Moralis Database Rendering the NFT Images Update Listing Modal Buy NFT Listing Listing NFTs for Sale Part III: TheGraph Front End Introduction What is The Graph? Building a Subgraph Deploying our Subgraph Reading from The Graph Hosting our Dapp Lesson 16: Hardhat Upgrades Upgradeable Smart Contracts Overview Types of Upgrades Delegatecall Small Proxy Example Transparent Upgradeable Smart Contract Lesson 17: Hardhat DAOs Introduction What is a DAO? How to build a DAO Lesson 18: Security & Auditing Introduction Slither Fuzzing and Eth Security Toolbox Closing Thoughts More Resources Congratulations Where do I go now? Learning More Community Hackathons Lesson 0: The Edge of the Rabbit Hole Welcome to the course! โŒจ๏ธ (00:00:00) Lesson 0: Welcome To Blockchain Best Practices Follow the repository: While going through the course be 100% certain to follow along with the github repository. If you run into in an issue check the chronological-updates in the repo. Be Active in the community: Ask questions and engage with other developers going through the course in the discussions tab, be sure to go and say hello or gm! This space is different from the other industries, you don't have to be secretive; communicate, network and learn with others :) Learn at your own pace: It doesn't matter if it takes you a day, a week, a month or even a year. Progress >>> Perfection Take Breaks: You will exhaust your mind and recall less if you go all out and watch the entire course in one sitting. Suggested Strategy every 25 minutes take a 5 min break, and every 2 hours take a longer 30 min break Refer to Documentation: Things are constantly being updated, so whenever Patrick opens up some documentation, open it your end and maybe even have the code sample next to you. Lesson 1: Blockchain Basics โŒจ๏ธ (00:09:05) Lesson 1: Blockchain Basics What is a Blockchain? What does a blockchain do? Bitcoin Whitepaper Satoshi Nakamoto Ethereum Whitepaper Vitalik Buterin What is a Smart Contract? Nick Szabo Hybrid Smart Contracts Blockchain Oracles Terminology Web3 What is a blockchain The Purpose Of Smart Contracts โŒจ๏ธ (00:18:27) The Purpose of Smart Contracts ๐ŸŽฅ Original Video ๐Ÿฆฌ My ETH Denver Talk ๐Ÿ” McDonalds Scandal โ›“ More on the evolution of agreements โœ๏ธ What is a Smart Contract? ๐Ÿงฑ How does a blockchain work? ๐Ÿ”ฎ Chainlink & Oracles Other Blockchain Benefits โŒจ๏ธ (00:30:41) Other Blockchain Benefits Decentralized Transparency & Flexibility Speed & Efficiency Security & Immutability Counterparty Risk Removal Trust Minimized Agreements What have Smart Contracts done so far? โŒจ๏ธ (00:36:36) What have Smart Contracts done so far? DeFi Defi Llama Why DeFi is Important DAOs NFTs Making Your First Transaction โŒจ๏ธ (00:39:17) Making Your First Transaction Metamask Download Link What is a Private Key? What is a Secret Phrase? Etherscan Sepolia Etherscan Sepolia Faucet (Check the link token contracts page ) NOTE: The Chainlink documentation always has the most up to date faucets on their link token contracts page . If the faucet above is broken, check the chainlink documentation for the most up to date faucet. OR, use the Sepolia ETH Faucet , just be sure to swap your metamask to Sepolia! Gas I: Introduction to Gas โŒจ๏ธ (00:58:59) Gas I: Introduction to Gas Gas and Gas Fees Wei, Gwei, and Ether Converter ETH Gas Station How Do Blockchains Work? โŒจ๏ธ (01:05:32) How Do Blockchains Work What is a hash? Blockchain Demo Summary Signing Transactions โŒจ๏ธ (01:22:55) Signing Transactions Public / Private Keys Layer 2 and Rollups Decentralized Blockchain Oracles Gas II โŒจ๏ธ (01:30:22) Gas II: Block Rewards & EIP 1559 Block Rewards Advanced Gas EIP 1559 GWEI, WEI, and ETH ETH Converter Gas II Summary โŒจ๏ธ (01:36:44) Gas II Summary Run Your Own Ethereum Node High-Level Blockchain Fundamentals [โŒจ๏ธ (01:39:32) High-Level Blockchain Fundamentals]https://www.youtube.com/watch?v=gyMwXuJrbJQ&t=5972s() Consensus Proof of Stake Proof of Work Nakamoto Consensus Ethereum 2 (the merge) ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed Blockchain Basics! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Lesson 2: Welcome to Remix! Simple Storage โŒจ๏ธ (02:01:16) Lesson 2: Welcome to Remix! Simple Storage ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/simple-storage-fcc Introduction โŒจ๏ธ (02:03:05) Introduction Remix Solidity Documentation Setting Up Your First Contract โŒจ๏ธ (02:05:18) Setting Up Your First Contract Versioning Take notes in your code! What is a software license SPDX License Compiling Contract Declaration Basic Solidity: Types โŒจ๏ธ (02:12:28) Basic Solidity Types Types & Declaring Variables uint256 , int256 , bool , string , address , bytes32 Solidity Types Bits and Bytes Default Initializations Comments Basic Solidity: Functions โŒจ๏ธ (02:18:40) Basic Solidity Functions Functions Deploying a Contract Smart Contracts have addresses just like our wallets Calling a public state-changing Function Visibility Gas III | An example Scope View & Pure Functions Basic Solidity: Arrays & Structs โŒจ๏ธ (02:35:30) Basic Solidity Arrays & Structs Structs Intro to Storage Arrays Dynamic & Fixed Sized push array function Basic Solidity: Compiler Errors and Warnings โŒจ๏ธ (02:45:35) Basic Solidity Errors & Warnings Yellow: Warnings are Ok Red: Errors are not Ok Memory, Storage, Calldata (Intro) โŒจ๏ธ (02:46:34) Basic Solidity Memory, Storage, & Calldata (Intro) 6 Places you can store and access data calldata memory storage code logs stack Mappings โŒจ๏ธ (02:50:17) Basic Solidity Mappings Mappings Deploying your First Contract โŒจ๏ธ (02:53:38) Deploying your First Contract A testnet or mainnet Connecting Metamask Find a faucet here See the faucets at the top of this readme! Interacting with Deployed Contracts The EVM & A Recap of Lesson 2 โŒจ๏ธ (03:03:07) The EVM & A Recap of Lesson 2 The EVM Lesson 3: Remix Storage Factory โŒจ๏ธ (03:05:34) Lesson 3: Remix Storage Factory ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/storage-factory-fcc Introduction โŒจ๏ธ (03:06:06) Introduction Factory Pattern Basic Solidity: Importing Contracts into other Contracts โŒจ๏ธ (03:07:29) Importing Contracts into other Contracts Composibility Solidity new keyword Importing Code in solidity Basic Solidity: Interacting with other Contracts โŒจ๏ธ (03:16:36) Interacting with other contracts To interact, you always need: ABI + Address ABI Basic Solidity: Inheritance & Overrides โŒจ๏ธ (03:25:23) Inheritance & Overrides Inheritance Override & Virtual Keyword Lesson 3 Recap โŒจ๏ธ (03:30:29) Lesson 3 Recap Lesson 4: Remix Fund Me โŒจ๏ธ (03:31:55) Lesson 4: Remix Fund Me ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/fund-me-fcc Introduction Sending ETH Through a Function & Reverts Fields in a Transaction More on v,r,s payable msg.value & Other global keywords require revert Chainlink & Oracles What is a blockchain oracle? What is the oracle problem? Chainlink Chainlink Price Feeds (Data Feeds) data.chain.link Chainlink VRF Chainlink Keepers Chainlink API Calls Importing Tokens into your Metamask Request and Receive Chainlink Model Review of Sending ETH and working with Chainlink Interfaces & Price Feeds Chainlink Price Feeds (Data Feeds) Chainlink GitHub Interface Importing from GitHub & NPM Chainlink NPM Package Floating Point Math in Solidity tuple Floating Point Numbers in Solidity Type Casting Gas Estimation Failed Someone should make an article explaining this error Basic Solidity: Arrays & Structs II msg.sender Review of Interfaces, Importing from GitHub, & Math in Solidity Libraries Library Solidity-by-example Library SafeMath, Overflow Checking, and the "unchecked" keyword Openzeppelin Safemath unchecked vs. checked Basic Solidity: For Loop For Loop /* */ is another way to make comments Basic Solidity: Resetting an Array Sending ETH from a Contract Transfer, Send, Call this keyword Basic Solidity: Constructor Constructor Basic Solidity: Modifiers Double equals Modifier Testnet Demo Disconnecting Metamask Advanced Solidity Immutable & Constant Immutable Constant Current ETH Gas Prices Don't stress about gas optimizations! (yet) Naming Conventions Someone make this! Custom Errors Custom Errors Introduction Receive & Fallback Functions Solidity Docs Special Functions Fallback Receive Lesson 4 Recap ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed Solidity Basics! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Lesson 5: Ethers.js Simple Storage โŒจ๏ธ (05:30:42) Lesson 5: Ethers.js Simple Storage ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/ethers-simple-storage-fcc ๐Ÿงช Alchemy: https://alchemy.com/?a=673c802981 Effective Debugging Strategies & Getting Help โŒจ๏ธ (5:30:46) Effective Debugging Stategies & Getting Help Tinker and isolate problem For this course, take at LEAST 15 minutes to figure out a bug. Google / Web Search the Exact problem Go to this GitHub Repo / Discussions Ask a question on a Forum like Stack Exchange Ethereum or Stack Overflow Format your questions!! Use Markdown How to Debug Anything Video Patrick's Original Video Installation & Setup Visual Studio Code Crash Course NodeJS VSCode Keybindings Git What is a terminal? Mac & Linux Setup Windows Setup WSL When working in WSL, use Linux commands instead of Windows commands TroubleShooting curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash โš ๏ธ Please use Gitpod as an absolute last resort Gitpod Gitpod If using this, NEVER share a private key with real money on Gitpod Ideally you figure out the MacOS, Linux, or Windows install though Local Development Introduction CMD + K or CTRL + K clears the terminal mkdir ethers-simple-storage-fcc code . to open VSCode in a new VSCode window Optional Javascript Crash Courses NodeJS Course Javascript Course Import your SimpleStorage.sol Solidity + Hardhat VSCode Extension Format your solidity code with: "[solidity]": { "editor.defaultFormatter": "NomicFoundation.hardhat-solidity" }, "[javascript]":{ "editor.defaultFormatter": "esbenp.prettier-vscode" } In your .vscode/settings.json file. Prettier Extension Tiny Javascript Refresher Javascript Tips Asynchronous Programming in Javascript Asynchronous Programming async keyword Promise in Javascript await keyword Compiling our Solidity Yarn Install solc-js yarn add solc@0.8.7-fixed yarn scripts Ganache & Networks Ganache Networks in Metamask RPC URL Geth JSON RPC Spec Playground Introduction to Ethers.js Ethers.js prettier-plugin-solidity A Note on the await Keyword Adding Transaction Overrides Transaction Receipts Sending a "raw" Transaction in Ethers.js Interacting with Contracts in Ethers.js EVM Decompiler BigNumber Environment Variables dotenv .gitignore Better Private Key Management wallet.encrypt THE .ENV PLEDGE Optional Prettier Formatting Prettier Best README Template Deploying to a Testnet or a Mainnet Alchemy Getting your private key from Metamask CTRL + C stops any terminal command Verifying on Block Explorers from the UI Alchemy Dashboard & The Mempool Special Guest Albert Hu Mempool Lesson 5 Recap Typescript Ethers Simple Storage Lesson 6: Hardhat Simple Storage โŒจ๏ธ (08:20:17) Lesson 6: Hardhat Simple Storage ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-simple-storage-fcc Introduction โŒจ๏ธ (08:20:19) Introduction Hardhat Setup โŒจ๏ธ (08:22:47) Hardhat Setup Hardhat Documentation DevDependencies vs Dependencies @ Sign node modules Troubleshooting Hardhat Setup โŒจ๏ธ (08:29:43) Troubleshooting Hardhat Setup Special Guest Cami Ramos Garzon Hardhat Setup Continued โŒจ๏ธ (08:31:48) Hardhat Setup Continued Deploying SimpleStorage from Hardhat โŒจ๏ธ (08:33:10) Deploying SimpleStorage from Hardhat Networks in Hardhat โŒจ๏ธ (08:41:44) Networks in Hardhat The Hardhat Network Hardhat configuration Chain ID List Programmatic Verification โŒจ๏ธ (08:51:16) Programmatic Verification Etherscan Verify Tutorial Etherscan Docs Hardhat-Etherscan Etherscan API Keys Javascript == vs === Interacting with Contracts in Hardhat โŒจ๏ธ (09:06:37) Interacting with Contracts in Hardhat Artifacts Troubleshooting โŒจ๏ธ (09:09:42) Artifacts Troubleshooting Custom Hardhat Tasks โŒจ๏ธ (09:10:52) Custom Hardhat Tasks Hardhat Tasks Javascript Arrow Functions Hardhat Localhost Node โŒจ๏ธ (09:18:12) Hardhat Localhost Node The Hardhat Console โŒจ๏ธ (09:23:11) The Hardhat Console Hardhat Console Hardhat Tests โŒจ๏ธ (09:26:13) Hardhat Tests Hardhat Tests Mocha Style Tests Chai Waffle Tests Hardhat Gas Reporter โŒจ๏ธ (09:38:10) Hardhat Gas Reporter Hardhat Gas Reporter Coinmarketcap API Solidity Coverage โŒจ๏ธ (09:44:40) Solidity Coverage Solidity Coverage Hardhat Waffle โŒจ๏ธ (09:47:02) Hardhat Waffle Hardhat-Waffle Lesson 6 Recap โŒจ๏ธ (09:47:37) Lesson 6 Recap Typescript Hardhat Simple Storage โŒจ๏ธ (09:52:15) Typescript Hardhat Simple Storage Typechain yarn add --dev @typechain/ethers-v5 @typechain/hardhat @types/chai @types/node @types/mocha ts-node typechain typescript Lesson 7: Hardhat Fund Me โŒจ๏ธ (10:00:48) Lesson 7: Hardhat Fund Me ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-fund-me-fcc Introduction โŒจ๏ธ (10:00:50) Introduction Hardhat Setup - Fund Me โŒจ๏ธ (10:03:41) Hardhat Setup - Fund Me Linting โŒจ๏ธ (10:06:20) Linting Eslint Solhint Linting Code Hardhat Setup - Fund Me - Continued โŒจ๏ธ (10:07:47) Hardhat Setup - Fund Me - Continued Importing from NPM โŒจ๏ธ (10:09:38) Importing from NPM @chainlink/contracts Hardhat Deploy โŒจ๏ธ (10:10:43) Hardhat Deploy Hardhat Deploy Mocking โŒจ๏ธ (10:21:05) Mocking Mocking Aave Github Chainlink Github Multiple Versions of Solidity Tags in hardhat Utils Folder โŒจ๏ธ (10:52:51) Utils Folder Testnet Demo - Hardhat Fund Me โŒจ๏ธ (10:55:45) Testnet Demo - Hardhat Fund Me Hardhat Deploy Block Confirmations TypeScript Code file (TypeScript edition) Define blockConfirmations in the helper-hardhat-config.ts file instead of hardhat-config.js . Solidity Style Guide โŒจ๏ธ (11:00:10) Solidity Style Guide Style Guide NatSpec Testing Fund Me โŒจ๏ธ (11:08:36) Testing Fund Me Unit Testing Hardhat Deploy Fixtures ethers.getContract expect ethers.utils.parseUnits Waffle Chai Matchers Breakpoints & Debugging โŒจ๏ธ (11:30:39) Breakpoints & Debugging VSCode Breakpoints Gas III โŒจ๏ธ (11:33:40) Gas III Transaction Response Transaction Receipt console.log & Debugging โŒจ๏ธ (11:36:35) console.log & Debugging Hardhat console.log Testing Fund Me II โŒจ๏ธ (11:37:31) Testing Fund Me II Storage in Solidity โŒจ๏ธ (11:44:34) Storage in Solidity Storage Layout Purpose of the memory keyword getStorageAt Gas Optimizations using Storage Knowledge โŒจ๏ธ (11:52:38) Gas Optimizations using Storage Knowledge Opcodes Opcodes by Gas Opcodes by Gas Append s_ to storage variables Append i_ to immutable variables Caps lock and underscore constant variables Solidity Chainlink Style Guide โŒจ๏ธ (12:05:29) Solidity Chainlink Style Guide Chainlink Solidity Style Guide Storage Review โŒจ๏ธ (12:09:59) Storage Review Staging Tests โŒจ๏ธ (12:11:43) Staging Tests Ternary Running Scripts on a Local Node โŒจ๏ธ (12:17:58) Running Scripts on a Local Node Adding Scripts to your package.json โŒจ๏ธ (12:22:00) Adding Scripts to your package.json Pushing to GitHub โŒจ๏ธ (12:25:17) Pushing to GitHub Github Quickstart What is Git? The quickstart that we follow in the video Learn about git and GitHub ๐Ÿธ๐Ÿฆ Tweet Me (add your repo in)! Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End) โŒจ๏ธ (12:32:57) Lesson 8: HTML / Javascript Fund Me (Full Stack / Front End) ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/html-fund-me-fcc Introduction How Websites work with Web3 Wallets How to Connect your Smart Contracts to Metamask ๐Ÿ’ป Code from Video: https://github.com/PatrickAlphaC/full-stack-web3-metamask-connectors โœ๏ธ Article from Video: https://betterprogramming.pub/everything-you-need-to-know-about-fullstack-web3-94c0f1b18019?sk=a2764bcbdae98bf05e1052931de77982 HTML Setup Live Server: ExtensionID: ritwickdey.LiveServer Connecting HTML to Metamask Metamask Docs Javascript in it's own file ES6 vs Nodejs ES6 vs Nodesjs Ethers docs for web browser module vs text/javascript Sending a transaction from a Website Web3Provider Adding a network to metamask Resetting an Account in Metamask MetaMask - RPC Error: [ethjs-query] while formatting ouputs from RPC '{"value":{"code":-32603,"data":{"code":-32000,"message":"Nonce too high. Expected nonce to be 2 but got 4. Note that transactions can't be queued when automining."}}}' Listening for Events and Completed Transactions provider.once Anonymous function Javascript Promise Input Forms Reading from the Blockchain Withdraw Function Lesson 8 Recap Optional Links: Browserify Watchify Lesson 9: Hardhat Smart Contract Lottery โŒจ๏ธ (13:41:02) Lesson 9: Hardhat Smart Contract Lottery ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc Introduction Hardhat Setup - Smart Contract Lottery โŒจ๏ธ (13:43:43) Hardhat Setup Install dependencies: bash yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai ethereum-waffle hardhat hardhat-contract-sizer hardhat-deploy hardhat-gas-reporter prettier prettier-plugin-solidity solhint solidity-coverage dotenv Install dependencies (Typescript version): bash yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai ethereum-waffle hardhat hardhat-contract-sizer hardhat-deploy hardhat-gas-reporter prettier prettier-plugin-solidity solhint solidity-coverage dotenv @typechain/ethers-v5 @typechain/hardhat @types/chai @types/node ts-node typechain typescript Raffle.sol Setup โŒจ๏ธ (13:46:55) Raffle.sol Setup Custom Errors in Solidity Introduction to Events โŒจ๏ธ (13:54:02) Introduction to Events Events & Logging Video Events & Logging in Hardhat Events in Raffle.sol โŒจ๏ธ (14:00:47) Events in Raffle.sol Introduction to Chainlink VRF โŒจ๏ธ (14:02:30) Introduction to Chainlink VRF Special Guest Stephen Fluin Sub-Lesson: Chainlink VRF Chainlink VRFv2 Docs Chainlink VRFv2 Walkthrough Chainlink Contracts Implementing Chainlink VRF - Introduction โŒจ๏ธ (14:09:53) Implementing Chainlink VRF Hardhat Shorthand Hardhat Shorthand Implementing Chainlink VRF - The Request Implementing Chainlink VRF - The FulFill Modulo Modulo Introduction to Chainlink Keepers Chainlink Keepers Docs Chainlink Keepers Walkthrough Implementing Chainlink Keepers - checkUpkeep Enums Enum Implementing Chainlink Keepers - checkUpkeep continued block.timestamp Implementing Chainlink Keepers - performUpkeep Code Cleanup Deploying Raffle.sol Mock Chainlink VRF Coordinator Continued LINK Token Raffle.sol Unit Tests We use async function in the describe blocks at the start, but we correctly take them out later. Testing Events & Chai Matchers Emit Chai Matcher Continued I Hardhat Methods & Time Travel Make Hardhat do whatever you want it to Special debugging hardhat methods Continued II Callstatic Callstatic Continued III Massive Promise Test Continued IV Raffle.sol Staging Tests Testing on a Testnet Recommended LINK amounts for Sepolia Staging Test: Chainlink VRF: 2 LINK Chainlink Keepers: 8 LINK Conclusion Typescript - Smart Contract Lottery ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed Hardhat Basics! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End) โŒจ๏ธ (16:34:07) Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End) ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/nextjs-smartcontract-lottery-fcc โšก๏ธโšก๏ธ Live Demo IPFS: ipfs://QmXwACyjcS8tL7UkYwimpqMqW9sKzSHUjE4uSZBSyQVuEH โšก๏ธโšก๏ธ Live Demo Fleek: https://fancy-dream-3458.on.fleek.co/ Introduction We move into using NextJS for our front end. NextJS is a React framework for building websites. Optional Sub-Lesson: Full Stack Development & Other Libraries 6 Ways to connect your dapp to a wallet NextJS Crash Course Other React libraries: Web3React wagmi react-moralis useDapp Web3Modal useMetamask Other Full Stack Web3 Templates scaffold-eth ethereum-boilerplate create-eth-app React being quite popular Why use react? NextJS Setup NextJS Documentation NextJS Minimal Ethers Example For Lottery yarn create next-app . Manual Header I What is a component? jsx Moralis React Moralis React Hooks What is a react hook? Manual Header II useEffect Hook useEffect Hook More on useEffect React Context useEffect Firing Twice Local Storage Local Storage isWeb3EnabledLoading web3uikit web3uikit web3uikit interactive docs web3uikit connect button Introduction to Calling Functions in Nextjs useWeb3Contract Automatic Constant Value UI Updater ethers.utils.FormatTypes runContractFunction Moralis Provider useMoralis parseInt useState useState Hook Calling Functions in NextJS useNotification Add onError to all your runContractFunction calls Reading & Displaying Contract Data A Note about onSuccess onSuccess just checks to see if MetaMask sends the transaction, not A Challenge to You Tailwind & Styling Learn CSS Tailwindcss PostCSS Extension Tailwind Extension Install Tailwind into NextJS Introduction to Hosting your Site โŒจ๏ธ (18:12:50) Introdunction to Hosting your Site Vercel Moralis Netilfy IPFS IPFS โŒจ๏ธ (18:15:14) IPFS What is IPFS IPFS Hosting on IPFS โŒจ๏ธ (18:18:51) Hosting on IPFS IPFS Companion Brave Browser yarn build && yarn next export Hosting on IPFS & Filecoin using Fleek โŒจ๏ธ (18:25:45) Hosting on IPFS & Filecoin using Fleek Fleek Filecoin Overview โŒจ๏ธ (18:31:28) Filecoin Overview Special Guest Ally Haire IPFS URL of Ally's Video Lesson 10 Recap Lesson 11: Hardhat Starter Kit โŒจ๏ธ (18:51:36) Lesson 11: Hardhat Starter Kit ๐Ÿ’ป Code: https://github.com/smartcontractkit/hardhat-starter-kit Lesson 12: Hardhat ERC20s โŒจ๏ธ (18:59:24) Lesson 12: Hardhat ERC20s ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-erc20-fcc What is an ERC? What is an EIP? What is an EIP? EIPs codebase What is an ERC20? Video (using brownie/python) EIP-20 ERC-677 EIP-777 Manually Creating an ERC20 Token Creating an ERC20 Token with Openzeppelin Openzeppelin Openzeppelin Contracts Solmate (Openzeppelin alternative) Lesson 12 Recap Lesson 13: Hardhat DeFi & Aave โŒจ๏ธ (19:16:13) Lesson 13: Hardhat DeFi & Aave ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-defi-fcc What is DeFi? What is DeFi? DefiLlama What is Aave? Aave My Previous Aave Video on Shorting Assets Programmatic Borrowing & Lending DAI Uniswap WETH - Wrapped ETH WETH Token Sepolia Etherscan WETH Token Mainnet Forking Mainnet Mainnet Forking Depositing into Aave Aave V2 Docs Aave NPM Borrowing from Aave Aave Borrowing FAQs Health Factor Aave Risk Parameters Repaying with Aave Visualizing the Transactions aTokens Lesson 13 Recap Happy Bow-Tie Friday with Austin Griffith Special Guest Austin Griffith ! Speed Run Ethereum More DeFi Learnings: Defi-Minimal Defi Dad Lesson 14: Hardhat NFTs (EVERYTHING you need to know about NFTs) โŒจ๏ธ (20:28:51) Lesson 14: Hardhat NFTs ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-nft-fcc What is an NFT? Video Optional: All on Chain SVG NFT EIP-721 Code Overview Opensea Testnet Hardhat Setup Basic NFT Write Tests Openzeppelin NFT Random IPFS NFT Mapping Chainlink VRF Requests Creating Rare NFTs Setting the NFT Image Setting an NFT Mint Price Deploy Script Uploading Token Images with Pinata Pinata nft.storage Pinata NPM Pinata Docs Uploading Token URIs (metadata) with Pinata Deploying Tests Dynamic SVG On-Chain NFT Patrick's Original Video What is an SVG? SVG Tutorial On-Chain SVG Example Initial Code Base64 Encoding Base64 Encoding Example Encoder base64-sol Advanced: EVM Opcodes, Encoding, and Calling abi.encode & abi.encodePacked abi.encode abi.encodePacked Thanks to Alex Roan for his help on this session! Example Contract Creation Transaction What REALLY is the ABI? EVM Opcodes More EVM Opcodes Solidity Cheatsheet abi.encode vs abi.encodePacked Introduction to Encoding Function Calls Directly Introduction to Encoding Function Calls Recap Encoding Function Calls Directly Function Selector Function Signature Creating an NFT TokenURI on-Chain Making the NFT Dynamic Deploy Script Deploying the NFTs to a Testnet Lesson 14 Recap Extra credit: Deconstructing Solidity Knowing and controlling your Smart Contract Address From Solidity to byte code Lesson 15: NextJS NFT Marketplace (If you finish this lesson, you are a full-stack MONSTER!) โŒจ๏ธ (23:37:03) Lesson 15: NextJS NFT Marketplace (Full Stack / Front End) Large Update, please read Moralis has recently updated to a self-hosted server over their own server. For this, you can do one of the following: Learn how to run one yourself Follow along to learn the concepts of this more interactive app, without actually coding along Skip to the section where we interact with the graph TL;DR: TheGraph code should work exactly the same as the video, however the Moralis code will not. ๐Ÿ’ป Code: Backend (Contracts): https://github.com/PatrickAlphaC/hardhat-nft-marketplace-fcc Frontend (Moralis Indexer): https://github.com/PatrickAlphaC/nextjs-nft-marketplace-moralis-fcc Frontend (TheGraph Indexer): https://github.com/PatrickAlphaC/nextjs-nft-marketplace-thegraph-fcc The Graph: https://github.com/PatrickAlphaC/graph-nft-marketplace-fcc Special thanks to Matt Durkin for help with this section. Introduction Opensea Artion Part I: NFT Marketplace Contracts Hardhat Setup NftMarketplace.sol Pull Over Push Reentrancy Reentrancy Rekt.news Openzeppelin NonReentrant NftMarketplace.sol - Continued NftMarketplace.sol - Deploy Script NftMarketplace.sol - Tests NftMarketplace.sol - Scripts Part II: Moralis Front End What is Moralis? Special Guest Ivan Liljeqvist NextJS Setup Link NextJS Adding Tailwind Tailwind with NextJS Introduction to Indexing in Web3 TheGraph Moralis Connecting Moralis to our Local Hardhat Node NextJS Environment Variables Reverse Proxy FRP Docs Trouble Shooting Moralis Forum Moralis Admin CLI Moralis Event Sync Moralis Add Event Sync From Code Reset Local Chain Moralis Cloud Functions Moralis Cloud Functions Moralis Logging Hardhat Network Reference Moralis Database only confirms a transaction with a block confirmation - so we need to move blocks on our hardhat local node. Moralis Triggers Practice Resetting the Local Chain Moralis Cloud Functions II Querying the Moralis Database Moralis Queries Rendering the NFT Images useNFTBalance fetch next/image Update Listing Modal Buy NFT Listing Listing NFTs for Sale web3uikit Form Part III: TheGraph Front End Introduction What is The Graph? Special Guest Nader Dabit Building a Subgraph Example Subgraphs The Graph Studio GraphQL VSCode Extension GraphQL Deploying our Subgraph GraphQL Queries Reading from The Graph @apollo/client gql The Graph Docs Hosting our Dapp ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed Front End Basics! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Lesson 16: Hardhat Upgrades โŒจ๏ธ (28:53:11) Lesson 16: Hardhat Upgrades ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-upgrades-fcc Upgradable Smart Contracts Overview Optional Video [Links from Video] Types of Upgrades Parameter Social Migrate Proxy Proxy Gotchas Function Collisions Storage Collisions Metamorphic Upgrades Transparent UUPS Diamond Delegatecall delegatecall (solidity-by-example) Yul Small Proxy Example EIP 1967 Transparent Upgradable Smart Contract Hardhat-deploy Proxies Openzeppelin Upgrades Plugin Openzeppelin upgrades tutorial hardhat deploy upgrades examples Lesson 17: Hardhat DAOs โŒจ๏ธ (29:45:24) Lesson 17: Hardhat DAOs โฌ†๏ธ Up-to-date code: https://github.com/PatrickAlphaC/dao-template ๐Ÿ’ป Code from video: https://github.com/PatrickAlphaC/hardhat-dao-fcc Introduction What is a DAO? What is a DAO? How to build a DAO How to build a DAO That's Patrick PY Code Python Video Openzeppelin Governance Compound Governance Contract Wizard CastVoteBySig Lesson 18: Security & Auditing โŒจ๏ธ (31:28:32) Lesson 18: Security & Auditing ๐Ÿ’ป Code: https://github.com/PatrickAlphaC/hardhat-security-fcc Introduction Readiness Guide Slither Install python Slither solc-select Fuzz testing Fuzzing and Eth Security Toolbox Echidna Docker Install Eth-Security-ToolBox Closing Thoughts Best Practices Attacks Oracle Attacks Re-entrancy Attacks Damn Vulnerable Defi Ethernaut Some Auditors: OpenZeppelin SigmaPrime Trail of Bits Congratulations ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Completed The Course! ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ๐ŸŽŠ Where do I go now? Learning More CryptoZombies Patrick Collins Dapp University ChainShot Cami Ramos Garzon Albert Hu Ivan Liljeqvist Ally Haire Stephen Fluin Eat the Blocks Austin Griffith Nader Dabit Ethereum.org Community Twitter Hardhat Discord Ethereum Python Community Discord Chainlink Discord Ethereum Discord Reddit ethdev Hackathons CL Hackathon ETHGlobal ETHIndia Be sure to check out project grant programs! And make today an amazing day! Thank you Thanks to everyone who is taking, participating in, and working on this course. It's been a passion project and a data dump of everything I've learnt in the web3 space to get you up to speed quickly. Also, a big thank you to Chainlink Labs for encouraging this course to come to light-and to the many Chainlink Labs team members who helped with various assets!
Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
blockchain,chainlink,ethereum,javascript,moralis,smart-contracts,solidity,thegraphprotocol,typescript,alchemy
0
54
64
158
83
2
0
README.md exists but content is empty.
Downloads last month
44