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 advent_of_code_2024 | |
import gleam/bool | |
import gleam/dict | |
import gleam/int | |
import gleam/io | |
import gleam/list | |
import gleam/result | |
import gleam/set | |
import gleam/string |
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 advent_of_code_2024 | |
import gleam/bool | |
import gleam/dict | |
import gleam/int | |
import gleam/io | |
import gleam/list | |
import gleam/order | |
import gleam/result | |
import gleam/string |
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
** (MatchError) no match of right hand side value: {:error, {:abstract_forms_invalid, [{:attribute, {1, 1}, :file, {~c"erlang.erl", 1}}, {:attribute, [generated: true], :module, :"Elixir.Patch.Mock.Original.For.erlang"}, {:attribute, [generated: true], :export, [badarg_with_cause: 2, badarg_with_info: 1, error_with_info: 2, error_with_inherited_info: 3, ensure_tracer_module_loaded: 2, gc_info: 3, gather_gc_info_result: 1, receive_allocator: 3, insert_info: 2, insert_instance: 3, mk_res_list: 1, get_alloc_info: 2, alloc_sizes: 1, alloc_info: 1, aa_mem_data: 1, aa_mem_data: 2, receive_emd: 1, receive_emd: 3, au_mem_data: 1, au_mem_data: 2, au_mem_current: 3, au_mem_blocks_1: 2, au_mem_blocks: 2, acc_blocks_size: 2, au_mem_acc: 3, au_mem_fix: 2, fix_proc: 2, get_fix_proc: 2, get_memval: 2, memory_1: 2, memory: 1, memory: 0, rvrs: 2, rvrs: 1, cput_i2e_tag: 2, cput_i2e_tag_map: 0, cput_i2e: 6, cput_i2e: 4, cput_i2e: 1, ...]}, {:attribute, {57, 2}, :deprecated, [{:now, 0, ~c"see the \"Time and Time Correction in Er |
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
class LoudDict(dict): | |
def __init__(self): | |
super().__init__() | |
def __getitem__(self, key): | |
return super().__getitem__(key).upper() | |
loud_dict = LoudDict() | |
loud_dict['hello'] = 'world' |
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
[~/Documents/code] nick.krichevsky@M3M-NKrichevsky$ python3 tracemalloc_test.py | |
Total: 64, Peak: 30040 | |
Total: 64, Peak: 363040 | |
Total: 64, Peak: 30040 |
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
set guicursor=n-v-c-sm:block,i-ci-ve-r-cr-o:ver25 | |
set clipboard=unnamedplus | |
set nrformats+=alpha | |
set nrformats+=hex | |
let mapleader="," | |
if exists('g:vscode') | |
syntax off | |
call plug#begin(stdpath('data')) | |
Plug 'tpope/vim-surround' |
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
defmodule HttpStream do | |
use GenServer | |
@doc """ | |
Stream an http response. The given function `make_request` should accept a PID and | |
return a `HTTPoison.AsyncResponse`. The given PID is intended to be passed to `stream_to` | |
in `HTTPoison.request/5`. The optional `message_timeout` argument can be used to configure | |
the timeout on a per-message basis (i.e, it is not a timeout for the full stream, but rather for | |
each chunk received) |
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
def close_args(*to_close): | |
def decorator(func: Callable): | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
res = func(*args, **kwargs) | |
arg_names = inspect.getfullargspec(func)[0] | |
all_args = {**kwargs, **dict(zip(arg_names, args))} | |
for arg in to_close: | |
all_args[arg].close() |
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 glob | |
import pprint | |
HEADER = """ | |
/* | |
Copyright [yyyy] [name of copyright owner] | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at |
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
// removeExecuteBits will remove the execute bits from the given FileMode | |
func removeExecuteBits(mode os.FileMode) os.FileMode { | |
mask := ^os.FileMode(0111) | |
return mode & mask | |
} |
NewerOlder