This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| // NOTE: In smart contract context don't really have to free memory before execution ends | |
| var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| var allocator = arena.allocator(); | |
| // Import host functions provided by NEAR runtime. | |
| // See https://github.com/near/near-sdk-rs/blob/78c16447486285fd952765ef3e727e16d6c8c867/near-sdk/src/environment/env.rs#L117 | |
| extern fn input(register_id: u64) void; | |
| extern fn read_register(register_id: u64, ptr: u64) void; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name GitHub Repo Size | |
| // @namespace https://gist.github.com/miraclx/aad03f43fe8ac85682b0243f4f242f0d | |
| // @description Calculate repo size and inject into GitHub page | |
| // @icon https://github.githubassets.com/favicons/favicon.png | |
| // @version 0.2.0 | |
| // @author miraclx | |
| // @license Apache-2.0 | |
| // @supportURL https://gist.github.com/miraclx/aad03f43fe8ac85682b0243f4f242f0d | |
| // @grant GM_xmlhttpRequest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From: https://blog.lobraun.de/2015/06/06/mount-sd-cards-within-virtualbox-on-mac-os-x/ | |
| Mount SD Cards within VirtualBox on Mac OS X | |
| Sometimes you need to mount your SD cards inside a VirtualBox machine to work with the files on the card. Working with the Raspberry Pi SD card on Mac OS X is an example for this. | |
| My Raspberry Pi runs on Linux with some version of the EXT file system. While there is some support for this on Mac OS X, the available solutions have a lot of limitations, especially when it comes to write support on EXT file systems. As I do not have an USB keyboard, I sometimes need to mount the filesystem on another system to fix a startup problem when some of my experiments go wrong. | |
| VirtualBox in theory allows for passing the internal card reader of the MacBooks to the virtual machine. Unfortunately, this does not work for me (and it seems for many other people). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def make_invalid_model(model_class, **kwargs): | |
| """ | |
| create a model object bypassing all member validation | |
| :param model_class: the class of the generated model that needs to be instantiated | |
| :param kwargs: all the model parameters, as they would be passed to the constructor | |
| :return: an instance of model_class | |
| """ | |
| def get_default_values(model_class, attributes): | |
| signature = inspect.signature(model_class.__init__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while { | |
| let x = foo(); | |
| bar(x); | |
| x != 0 | |
| } {} | |