Skip to content

Instantly share code, notes, and snippets.

View kigawas's full-sized avatar
🎯
Focusing

Weiliang Li kigawas

🎯
Focusing
View GitHub Profile
@itzmeanjan
itzmeanjan / ChildERC20.sol
Last active July 6, 2021 06:43
An illustration of sending data from Ethereum root chain to Matic child chain
// File: contracts/child/ChildToken/ChildERC20.sol
pragma solidity 0.6.6;
contract ChildERC20 is
ERC20,
IChildToken,
AccessControlMixin,
NativeMetaTransaction,
ChainConstants,
@nkhitrov
nkhitrov / logger.py
Last active March 27, 2024 07:15
Configure uvicorn logs with loguru for FastAPI
"""
WARNING: dont use loguru, use structlog
https://gist.github.com/nkhitrov/38adbb314f0d35371eba4ffb8f27078f
Configure handlers and formats for application loggers.
"""
import logging
import sys
from pprint import pformat
@rylev
rylev / rust-in-large-organizations-notes.md
Last active February 2, 2023 10:08
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@heygrady
heygrady / mapDispatchToProps.md
Last active September 16, 2023 19:19
Redux containers: mapDispatchToProps

Redux containers: mapDispatchToProps

This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps argument of the connect function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps can take.

@unclechu
unclechu / algebraic_data_types_experiment.nim
Last active July 13, 2023 06:47
Nim: algebraic data types (Maybe and Either), kinda Eq typeclass instances, kinda functors
type
MaybeKind = enum Just, Nothing
Maybe[T] = object
case kind: MaybeKind
of Just: value: T
of Nothing: discard
EitherKind = enum Left, Right
Either[L, R] = object
case kind: EitherKind
@mhgp
mhgp / sha2.rs
Created November 5, 2016 13:37
Rust で SHA-2 を実装してみた
use std::boxed::Box;
macro_rules! Ch {
($x:expr, $y:expr, $z:expr) => { ($x & $y) ^ (!$x & $z) };
}
macro_rules! Maj {
($x:expr, $y:expr, $z:expr) => { ($x & $y) ^ ($x & $z) ^ ($y & $z) };
}

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@utek
utek / Exclude_tables.md
Last active October 13, 2023 16:07
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re