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
| // Based on idea: https://twitter.com/pkhuong/status/1287510400372748290 | |
| use hashbrown::raw::RawTable; | |
| pub struct ScopeMap<K, V> { | |
| last_scope_id: ScopeId, | |
| scopes: Vec<ScopeId>, // values are zeroed instead of popped to save a check in get() / is_fresh() | |
| current_scope: ScopeDepth, // index of innermost valid scope | |
| values: RawTable<Entry<K, V>>, | |
| shadowed: Vec<Shadowed<K, V>>, |
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
| // Compile this with -rdynamic and your emulator .so with -fPIC -fpie -shared | |
| #include <dlfcn.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include "dcheck.h" | |
| static char logfile_name[] = "/tmp/gbtracer.log.XXXXXX"; | |
| static int logfile_fd = 0; |
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
| #define STRINGIFY(x) #x | |
| #define EXTRACT(...) __VA_ARGS__ | |
| #define INVOKE(macro,args...) macro( EXTRACT(args) ) | |
| #define FIRST(x,...) x | |
| #define REST(x,...) __VA_ARGS__ | |
| #define __sym(cn,ln) _ainini_##c##cn##l##ln | |
| #define sym(cn,ln) __sym(cn,ln) | |
| #define __gensym(cn, ln) sym( cn,ln ) |
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
| #include <stdarg.h> | |
| #include <stdbool.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| typedef uint8_t u8; | |
| typedef uint16_t u16; | |
| typedef uint32_t u32; |
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
| #ifndef LOG_HPP | |
| #define LOG_HPP | |
| #include <print> | |
| #include <source_location> | |
| template <class... Args> | |
| struct info { | |
| info(std::format_string<Args...> fmt, Args &&...args, | |
| std::source_location const &loc = std::source_location::current()) { | |
| std::print(stderr, "[{}:{}]{}: ", loc.file_name(), loc.line(), |
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
| #!/usr/bin/env python | |
| import multiprocessing | |
| import random | |
| import time | |
| class Logger: | |
| def __init__(self, num_lines, last_output_per_process, terminal_lock): | |
| self.num_lines = num_lines |
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
| /* file: "tinyc.c" */ | |
| /* originally from http://www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c */ | |
| /* Copyright (C) 2001 by Marc Feeley, All Rights Reserved. */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| /* |
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
| #!/usr/bin/env python3 | |
| """Obtain a Facebook Access Token | |
| From: https://github.com/dequis/purple-facebook/issues/445#issuecomment-967542766 | |
| Changes: | |
| - Ported to Python3 | |
| - Auto generate the MACHINE_ID UUID | |
| - Can set EMAIL from environment variable |
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
| """ | |
| Defines a function `auto_insert` to help with | |
| `pygit2.Repository.TreeBuilder`s. | |
| Just create the top-level `TreeBuilder`, and it will handle all subtree | |
| creation if you give it paths. | |
| """ | |
| import shutil | |
| from tempfile import mkdtemp |
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
| import React, { useCallback, useEffect, useReducer } from "https://esm.sh/react@18.2.0" | |
| const STATE_KEY = "mystate"; | |
| const INITIAL_STATE = { age: 42, name: null }; | |
| function loadState() { | |
| return JSON.parse(localStorage.getItem(STATE_KEY)) || INITIAL_STATE; | |
| } | |
| function reducer(state, action) { |
NewerOlder