- golang has runtime type information. the format of the structure varies between compiler versions
- convT2E converts some value to
interface{}
, and takes a pointer to a type and a value, and returns an interface - golang also always has function names / line info
This file contains 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 tqdm | |
import tqdm.notebook | |
tqdm.tqdm = tqdm.notebook.tqdm | |
from tqdm import tqdm | |
import pdb | |
def custom_exc(shell, etype, evalue, tb, tb_offset=None): | |
shell.showtraceback((etype, evalue, tb), tb_offset=tb_offset) | |
pdb.post_mortem(tb) | |
get_ipython().set_custom_exc((Exception,), custom_exc) |
This file contains 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 dataclasses import dataclass | |
from typing import Callable | |
@dataclass | |
class ExprVisitor: | |
matcher: Callable[[HighLevelILInstruction], bool] | |
block: HighLevelILBasicBlock | |
def visit_insn(self, expr): |
This file contains 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 SAFe bullshitizer | |
// @version 1 | |
// @grant none | |
// @include https://app.zenhub.com/* | |
// @include https://github.com/* | |
// ==/UserScript | |
console.log("starting replacement script"); |
This file contains 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 functools import lru_cache | |
@lru_cache(maxsize=1024) | |
def kn(a, b, order): | |
assert order >= 1 | |
if order == 1: | |
return a ** b | |
sub_order = order - 1 | |
res = a |
This file contains 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 | |
class PluginSubclassesMixin: | |
def __init_subclass__(cls, register_base=False, **kwargs): | |
super().__init_subclass__(**kwargs) | |
if PluginSubclassesMixin not in cls.__bases__: | |
return | |
cls.subclasses = [] | |
if register_base: |
This file contains 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
# parse --my_option into the MY_OPTION variable | |
# also handles positional arguments | |
__args_list=() | |
__required_args_list=() | |
__unexport_args_list=() | |
normalize_argument() { | |
# uppercase | |
local argname="${1^^}" |
This file contains 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 asyncio | |
async def merge_iter(iterables): | |
# create async iterators from the iterables | |
iterators = [iterable.__aiter__() for iterable in iterables] | |
# create an next() task per iterator | |
tasks = {asyncio.ensure_future(it.__anext__()): it for it in iterators} | |
try: | |
while tasks: |
This file contains 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 <type_traits> | |
#include <iostream> | |
template<class T> | |
struct BaseA { | |
static void test() { | |
std::cout << "int" << std::endl; | |
} | |
}; |
This file contains 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 <type_traits> | |
#include <iostream> | |
template<class T, class Enable = void> | |
struct A { | |
static void test() { | |
std::cout << "int" << std::endl; | |
} | |
}; |
NewerOlder