Skip to content

Instantly share code, notes, and snippets.

Avatar

Victorien ELVINGER Conaclos

View GitHub Profile
@Conaclos
Conaclos / bare.zig
Last active Apr 26, 2022
Examples of recursive type without support for them
View bare.zig
type TypeId uint
type BoolType void
type I8Type void
type I16Type void
type I32Type void
type I64Type void
type IntType void
type StrType void
type U8Type void
@Conaclos
Conaclos / sqlite-base64-gid96.md
Last active Mar 28, 2022
SQLite generator of base64 uuid encoded on 96bits (12 octects) in pure SQL
View sqlite-base64-gid96.md

The following SQL statement enables to generate a base64 uuid encoded on 96bits (12 octects).

SELECT (substr(chars, (first & 63)+1, 1) ||
        substr(chars, ((first >> 6) & 63)+1, 1) ||
        substr(chars, ((first >> 12) & 63)+1, 1) ||
        substr(chars, ((first >> 18) & 63)+1, 1) ||
        substr(chars, ((first >> 24) & 63)+1, 1) ||
        substr(chars, ((first >> 30) & 63)+1, 1) ||
        substr(chars, ((first >> 36) & 63)+1, 1) ||
@Conaclos
Conaclos / uint4ordset.ts
Last active Jun 23, 2018
Uint4 (hexadecimal digit) ordered set (16bits memory usage and O(1) computational complexity)
View uint4ordset.ts
/*
Copyright (c) 2018 Victorien Elvinger
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
export type uint4 = number
/**
@Conaclos
Conaclos / blockstack.org
Created Mar 13, 2018
blockstack.org social proof
View blockstack.org
@Conaclos
Conaclos / deep_join.ts
Created Sep 18, 2016
Function that joins conflict-free objects. It copies all (enum, non-enum, and symbol) properties.
View deep_join.ts
/*
Copyright (c) 2016 Victorien ELVINGER
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
interface DeepJoinFunction {
<A, B> (a: A, b: B): A & B
View git-historic-email-change.md

Would you like to change your public committer email? You are in the right place!

Warning: The next git command change the entire branch historic. Apply it only on unshared repositories.

git filter-branch -f --env-filter "GIT_AUTHOR_EMAIL='email@email'; GIT_COMMITTER_EMAIL='email@email';" HEAD
View keybase.md

Keybase proof

I hereby claim:

  • I am conaclos on github.
  • I am conaclos (https://keybase.io/conaclos) on keybase.
  • I have a public key ASDe0GKehufRBL2P2fQAGfnYjvEOTRDAQVzjnsuTmqPaAAo

To claim this, I am signing this object:

View once.py
def stable (value):
return lambda *args, **kwargs: value
def once_per_object (unstable):
"""Method decorator. Run only once 'unstable' per instance"""
def stabilize (*args, **kwargs):
self = args [0]
result = unstable (*args, **kwargs)
setattr (self, unstable.__name__, stable (result))
return result