Skip to content

Instantly share code, notes, and snippets.

View cosmojg's full-sized avatar
:electron:
Overthinking

Cosmo cosmojg

:electron:
Overthinking
View GitHub Profile
@cosmojg
cosmojg / nx2gt.py
Last active October 30, 2023 18:38 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
used with the PropertyMap. Returns a tuple, (type name, value, key)
"""
# Encode the key as ASCII
# -*- coding: utf-8 -*-
"""Demonstrate high quality docstrings.
Module-level docstrings appear as the first "statement" in a module. Remember,
that while strings are regular Python statements, comments are not, so an
inline comment may precede the module-level docstring.
After importing a module, you can access this special string object through the
``__doc__`` attribute; yes, it's actually available as a runtime attribute,
despite not being given an explicit name! The ``__doc__`` attribute is also
@cosmojg
cosmojg / README.md
Created January 30, 2020 22:27 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@cosmojg
cosmojg / turbo_colormap.glsl
Created August 30, 2019 18:23 — forked from mikhailov-work/turbo_colormap.glsl
Turbo Colormap Polynomial Approximation in GLSL
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Polynomial approximation in GLSL for the Turbo colormap
// Original LUT: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f
// Authors:
// Colormap Design: Anton Mikhailov (mikhailov@google.com)
// GLSL Approximation: Ruofei Du (ruofei@google.com)
@cosmojg
cosmojg / turbo_colormap.c
Created August 30, 2019 18:23 — forked from mikhailov-work/turbo_colormap.c
Turbo Colormap Look-up Table
// Copyright 2019 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Author: Anton Mikhailov
// The look-up tables contains 256 entries. Each entry is a an sRGB triplet.
float turbo_srgb_floats[256][3] = {{0.18995,0.07176,0.23217},{0.19483,0.08339,0.26149},{0.19956,0.09498,0.29024},{0.20415,0.10652,0.31844},{0.20860,0.11802,0.34607},{0.21291,0.12947,0.37314},{0.21708,0.14087,0.39964},{0.22111,0.15223,0.42558},{0.22500,0.16354,0.45096},{0.22875,0.17481,0.47578},{0.23236,0.18603,0.50004},{0.23582,0.19720,0.52373},{0.23915,0.20833,0.54686},{0.24234,0.21941,0.56942},{0.24539,0.23044,0.59142},{0.24830,0.24143,0.61286},{0.25107,0.25237,0.63374},{0.25369,0.26327,0.65406},{0.25618,0.27412,0.67381},{0.25853,0.28492,0.69300},{0.26074,0.29568,0.71162},{0.26280,0.30639,0.72968},{0.26473,0.31706,0.74718},{0.26652,0.32768,0.76412},{0.26816,0.33825,0.78050},{0.26967,0.34878,0.79631},{0.27103,0.35926,0.81156},{0.27226,0.36970,0.82624},{0.27334,0.38008,0.84037},{0.27429,0.39043,0.85393},{0.27509,0.40072,0.86692},{0.2757
@cosmojg
cosmojg / turbo_colormap.py
Created August 30, 2019 18:22 — forked from mikhailov-work/turbo_colormap.py
Turbo Colormap Look-up Table
# Copyright 2019 Google LLC.
# SPDX-License-Identifier: Apache-2.0
# Author: Anton Mikhailov
turbo_colormap_data = [[0.18995,0.07176,0.23217],[0.19483,0.08339,0.26149],[0.19956,0.09498,0.29024],[0.20415,0.10652,0.31844],[0.20860,0.11802,0.34607],[0.21291,0.12947,0.37314],[0.21708,0.14087,0.39964],[0.22111,0.15223,0.42558],[0.22500,0.16354,0.45096],[0.22875,0.17481,0.47578],[0.23236,0.18603,0.50004],[0.23582,0.19720,0.52373],[0.23915,0.20833,0.54686],[0.24234,0.21941,0.56942],[0.24539,0.23044,0.59142],[0.24830,0.24143,0.61286],[0.25107,0.25237,0.63374],[0.25369,0.26327,0.65406],[0.25618,0.27412,0.67381],[0.25853,0.28492,0.69300],[0.26074,0.29568,0.71162],[0.26280,0.30639,0.72968],[0.26473,0.31706,0.74718],[0.26652,0.32768,0.76412],[0.26816,0.33825,0.78050],[0.26967,0.34878,0.79631],[0.27103,0.35926,0.81156],[0.27226,0.36970,0.82624],[0.27334,0.38008,0.84037],[0.27429,0.39043,0.85393],[0.27509,0.40072,0.86692],[0.27576,0.41097,0.87936],[0.27628,0.42118,0.89123],[0.27667,0.43134,0.90254],[0.27691,0.44145,0.913
@cosmojg
cosmojg / turbomap.m
Created August 30, 2019 18:18 — forked from nikolaskaralis/turbomap.m
Turbo Colormap Look-up Table for Matlab
% Look-up table for Turbo colormap.
% Includes example usage and comparison with other colormaps.
% Adapted for Matlab from https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f
% Nikolas Karalis, 21 August 2019
turbomap = [[0.18995,0.07176,0.23217];[0.19483,0.08339,0.26149];[0.19956,0.09498,0.29024];[0.20415,0.10652,0.31844];[0.20860,0.11802,0.34607];[0.21291,0.12947,0.37314];[0.21708,0.14087,0.39964];[0.22111,0.15223,0.42558];[0.22500,0.16354,0.45096];[0.22875,0.17481,0.47578];[0.23236,0.18603,0.50004];[0.23582,0.19720,0.52373];[0.23915,0.20833,0.54686];[0.24234,0.21941,0.56942];[0.24539,0.23044,0.59142];[0.24830,0.24143,0.61286];[0.25107,0.25237,0.63374];[0.25369,0.26327,0.65406];[0.25618,0.27412,0.67381];[0.25853,0.28492,0.69300];[0.26074,0.29568,0.71162];[0.26280,0.30639,0.72968];[0.26473,0.31706,0.74718];[0.26652,0.32768,0.76412];[0.26816,0.33825,0.78050];[0.26967,0.34878,0.79631];[0.27103,0.35926,0.81156];[0.27226,0.36970,0.82624];[0.27334,0.38008,0.84037];[0.27429,0.39043,0.85393];
@cosmojg
cosmojg / keybase.md
Created July 16, 2019 18:19
Keybase proof

Keybase proof

I hereby claim: * I am cosmojg on github. * I am cosmojg (https://keybase.io/cosmojg) on keybase. * I have a public key ASAIVMZ3Bt6NJVdAqyXdgtrnGs1jlZngpWt3Wc6NRT_XoQo To claim this, I am signing this object:

{   "body": {     "key": {       "eldest_kid": "01200854c67706de8d255740ab25dd82dae71acd639599e0a56b7759ce8d453fd7a10a",       "host": "keybase.io",       "kid": "01200854c67706de8d255740ab25dd82dae71acd639599e0a56b7759ce8d453fd7a10a",       "uid": "c7a84032c97952e77dba9ff6b0c99b19",       "username": "cosmojg"     },     "merkle_root": {       "ctime": 1563301035,       "hash": "9d06536e503233e84a53251a38864eeed0dbb6f9903e839169812edbab6d0019223de1b3e6a764f50244c101982f1127df739c2e81ed2529fc2881466ea7c6eb",       "hash_meta": "3c1dcaf33587367e8fc46c68e6b39a8701f0a4fcf7759b55b0e0d09ee719e2f9",       "seqno": 5776484     },     "service": {       "entropy": "+YjA0y+H22xS+P4PwFRSoECr",       "name": "github",       "username": "cosmojg"     },     "type": "web_service_bi
@cosmojg
cosmojg / anonsites.txt
Created September 10, 2018 14:09
Anon's Favorite Websites
* Blogs
http://studiopixel.sakura.ne.jp/ ## Cavestory devblog
http://toastytech.com/index.html ## Old tech blog
http://www.fromthemachine.org/MALOVIOUS.html ## Ramblings about current events
https://omaera.org/ ## Anons from Chile personal site, very minimalist
http://9ch.in/ ## OG personal site
* Services
https://wiby.me ## Simple sebpage search engine

Overview - Adding support for a new currency in Coinomi

The Coinomi wallet can support any kind of cryptographic currency because it adopts the model of a thin wallet.

A thin wallet will delegate most of the complexity to a trusted server, while still maintaining control of the private keys by using a deterministic key chain BIP44. It is different than SPV in that it doesn't need to perform any header or transaction merkle root validations (although it is optionally possible).

The advantage of a thin wallet is that it is light weight and can easily work with low-specs devices and consumes small amounts of network bandwidth. Some assets like Peercoin, CounterParty or Mastercoin can only work with this model because as SPV is not enough to validate transactions. The disadvantage is that it needs a trusted service to get the state of the network. A known attack for an SPV wallet is to hide transactions, in a thin wallet it is possible to al