Skip to content

Instantly share code, notes, and snippets.

@cdm
cdm / vega-config-stagnet1
Created November 24, 2022 11:50
vega-config-stagnet1
#!/usr/bin/env bash
# Default server configuration used by REST/GRPC/GRAPHQL examples
DATA_NODE_URL_REST="https://api.n00.stagnet1.vega.xyz/api/v2"
DATA_NODE_URL_GRAPHQL="https://api.n00.stagnet1.vega.xyz/graphql"
DATA_NODE_URL_GRPC="n00.stagnet1.vega.xyz:3007"
WALLET_SERVER_URL="localhost:1127"
MARKET_ID=""
PARTY_ID=""
#!/usr/bin/python3
import os
import requests
transfer_id = "fa1a3ceb74b6b8b1525f44bf688569bcd8d7ca74a93cbcbbd8012001094e0a95"
node_url_rest = os.getenv("NODE_URL_REST")
wallet_server_url = os.getenv("WALLETSERVER_URL")
wallet_name = os.getenv("WALLET_NAME")
wallet_passphrase = os.getenv("WALLET_PASSPHRASE")
#!/usr/bin/python3
import os
import requests
# ACCOUNT TYPES (DO NOT EDIT)
account_type_taker_fees = "ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES" # Per asset reward account for fees paid by takers
account_type_maker_fees = "ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES" # Per asset reward account for fees received by makers
account_type_lp_fees = "ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES" # Per asset reward account for fees received by liquidity providers
account_type_market_proposers = "ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS" # Per asset reward account for market proposers when the market goes above a trading threshold
import requests
import pandas
print("Loading $VEGA historic daily price data from CoinGecko API")
url = "https://api.coingecko.com/api/v3/coins/vega-protocol/market_chart?vs_currency=usd&days=max&interval=daily"
response = requests.get(url)
response_json = response.json()
dict = {
@cdm
cdm / authenticator.cs
Created June 6, 2017 09:23
Echo request/response in HttpMessageHandler
#if DEBUG
Debug.WriteLine("Request:");
Debug.WriteLine(request.ToString());
if (request.Content != null)
{
var bytes = await request.Content.ReadAsByteArrayAsync();
Debug.WriteLine(bytes.Length);
Debug.WriteLine(Encoding.UTF8.GetString(bytes, 0, bytes.Length));
Debug.WriteLine(await request.Content.ReadAsStringAsync());
public static class DateTimeHelper
{
private static readonly DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// Return the number of seconds since Epoch (1st Jan 1970)
/// </summary>
/// <returns>Seconds since epoch</returns>
public static long SecondsSinceEpoch()
{
@cdm
cdm / GridExtensions.cs
Created May 15, 2017 09:58
Xamarin Forms GridExtensions
using System;
using Xamarin.Forms;
namespace cdm.xamarin.forms
{
/// <summary>
/// Easily add grid rows and columns with this extension class
/// </summary>
public static class GridExtensions
{
@cdm
cdm / gist:bce25582f796c96236c3625adbcba36f
Created February 9, 2017 10:24
React-Native Default Fonts
To use in react-native, choose from font below, and then add to style element:
<Text style={{ fontFamily: 'Arial' }}>Arial Font</Text>
Alternatively, add your own custom font face
Android:
========
normal
<!-- Put this inside App.xaml -->
<!-- if you don't know how to add App.xaml to your project use this guide: http://goo.gl/GuXMDD/>
<!-- Some default style resets -->
<Style TargetType="Grid">
<Setter Property="Padding"
Value="0" />
<Setter Property="RowSpacing"
Value="0" />
<Setter Property="ColumnSpacing"
@cdm
cdm / .gitignore
Created May 9, 2016 05:48
GitIgnore file used by the folks at Xamarin Inc
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
*.userprefs
# ignore Xamarin.Android Resource.Designer.cs files