Skip to content

Instantly share code, notes, and snippets.

View n4ru's full-sized avatar
🎯
Focusing

George Kushnir n4ru

🎯
Focusing
View GitHub Profile
@n4ru
n4ru / seed_challenges.lua
Created April 12, 2024 01:36
Seed Challenges - Allows seeding challenge runs.
--- STEAMODDED HEADER
--- MOD_NAME: Seed Challenges
--- MOD_ID: seed_challenges
--- MOD_AUTHOR: [thirk]
--- MOD_DESCRIPTION: Allows seeding challenge runs.
----------------------------------------------
------------MOD CODE -------------------------
function G.UIDEF.challenge_list(from_game_over)
G.CHALLENGE_PAGE_SIZE = 10
@n4ru
n4ru / seed_persistence.lua
Created April 11, 2024 03:39
Seed Persistence - Restart current seeded run
--- STEAMODDED HEADER
--- MOD_NAME: Seed Persistence
--- MOD_ID: seed_persistence
--- MOD_AUTHOR: [thirk]
--- MOD_DESCRIPTION: Persist seeds between quick restarts.
----------------------------------------------
------------MOD CODE -------------------------
local start_run = Game.start_run
local start_setup_run = G.FUNCS.start_setup_run
local saved_seed = nil
@n4ru
n4ru / pubkeytoaddress.nr
Created September 6, 2023 06:45 — forked from signorecello/pubkeytoaddress.nr
Convert public key to ethereum address in Noir
let hashOfPubKey = std::hash::keccak256(pub_key);
let mut result : Field = 0;
let mut v : Field = 1;
for i in 0..20 {
let index = (20 - i);
result += hashOfPubKey[index + 11] as Field * v;
v *= 256;
}
@n4ru
n4ru / goldbach47.c
Created July 15, 2023 20:41 — forked from jms137/goldbach47.c
Goldbach Turing machine with 47 states
/*
Goldbach's conjecture tested by a 47-state Turing machine
Author: Jared Showalter
If "a" and "i" were unbounded, this program would halt iff Goldbach's
conjecture is false. Furthermore, the program structurally
corresponds to a Turing machine with two symbols, one tape, and a
small number of states. The array "a" corresponds to the tape (each
@n4ru
n4ru / autocomplete.lua
Created April 10, 2023 23:01 — forked from Validark/autocomplete.lua
A simple autocomplete proof of concept in Lua which binary searches a sorted array of strings. Also allows for searching for terms with a different word order than the original string (by inserting permutations into array) and permitting alternate spellings/abbreviations by permuting those as well.
-- A cool autocomplete demo
-- @author Validark
-- Strings are stored in a lexigraphically sorted array, which can be binary searched for the first and last element which matches a query
-- Please note the "groupings" functionality is an unvalidated afterthought which may or may not work properly, but overall this code has some nice gems:
-- I was originally thinking that https://github.com/evaera/Cmdr could use this to get O(log n) autocompletes (old algo uses O(n))
-- However, Cmdr is designed in such a way that it creates a new autocomplete function on-demand each time,
-- which means we'd have to sort (or at least verify the sortedness) of the most recent data each time (for changing data at least, like a Player list).
-- Sorting at run-time takes O(n*log n) time, making it hard to compete with the old algorithm where the pre-processing step just gets the data in the right format
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "forge-std/Test.sol";
contract TestDeleteMappingInStruct is Test {
/// @param enabled Whether the token is enabled or not
/// @param balances Mapping of user address to balance
struct Token {
bool enabled;
#!/usr/bin/env node
console.log("I was executed from a gist inside the terminal with npx!");
### Keybase proof
I hereby claim:
* I am n4ru on github.
* I am n4ru (https://keybase.io/n4ru) on keybase.
* I have a public key ASCnHUXVHkB96Fu8rpKZjJITBus4dHavhMyi2-jUrQ5YnAo
To claim this, I am signing this object: