Skip to content

Instantly share code, notes, and snippets.

@foxcool
foxcool / portfolio.r
Created August 26, 2023 02:17
Example of simple portfolio balance management with R
library(jsonlite)
# Get prices
url <- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=dai,usd-coin,bitcoin,ethereum,polkadot,kusama,the-open-network,cosmos,tezos,1inch,moonbeam,ksm,aave,optimism,ethereum-name-service,gitcoin,maker,uniswap,acala-dollar-acala,binance-usd,hydradx,astar,tether"
data <- fromJSON(url)
token_data <- split(data, data$id)
# Define portfolio (collect token amounts from different sources in a list)
holdings <- list(
"bitcoin" = c(0.07),
@foxcool
foxcool / README.md
Created May 25, 2023 13:10 — forked from knopki/README.md
Equilibrium/Genshiro balances monitor

Install @polkadot/api npm package. Set NODE_ADDR environment variable to "wss://node.ksm.genshiro.io" for Genshiro or "wss://node.pol.equilibrium.io" for Equilibrium. Set MASTER_ADDR to your substrate address. Run and see balances changes in log.

@foxcool
foxcool / krakend.json
Created June 22, 2020 06:11
KrakenD cel example
{
"endpoint": "/users/{userID}",
"method": "POST",
"extra_config": {
"github.com/devopsfaith/krakend-cel": [
{
"check_expr": "req_params.UserID in JWT.roles"
},
"github.com/devopsfaith/krakend-jose/validator": {
"alg": "RS256",
FROM golang:alpine as builder
ENV GO111MODULE=off
ENV _PATH=github.com/foxcool/homework
ADD . /go/src/$_PATH
WORKDIR /go/src/$_PATH
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X main.version=develop" -o /homework .
@foxcool
foxcool / gist:13d75bf0af8b9323f752
Created November 12, 2015 11:38
cjdns iptunnel setup
Client setup:
ip addr add dev tun0 172.23.23.2 (cjdns does it already)
ip route add dev tun0 172.23.23.0/24
ip route add default via 172.23.23.1
Make sure UDP peerings use the original gateway, e.g. your ISP:
ip route add 37.139.20.30 via 192.168.3.1
ip route add 188.166.62.155 via 192.168.3.1
my $account = { $self->model('UserAccount')->search({
'me.id' => $id,
'me.site_id' => $site->id,
}, {
prefetch => [qw/orders talks identities/],
})->first->get_inflated_columns() };
@foxcool
foxcool / gist:2818224
Created May 28, 2012 09:47
for Dzheika
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
# Загоняю текст в переменную для удобства
my $text = 'sfglkdshfjgdslfhjglkfghksdjlhgsdjkhgjsfjghskjfhgjf';
# Cам рабочий код, который загоняет в массив символы
# по три, и в последний что осталось.
@foxcool
foxcool / gist:1380836
Created November 20, 2011 20:25
Installing Padre and wx-Scintilla
[Foxcool@foxbook workspace]$ sudo cpanm -v http://cpan.metacpan.org/authors/id/A/AZ/AZAWAWI/Wx-Scintilla-0.34.tar.gz
cpanm (App::cpanminus) 1.4008 on perl 5.014002 built for i386-linux-thread-multi
Work directory is /root/.cpanm/work/1321820328.5277
You have make /usr/bin/make
You have LWP 6.02
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@foxcool
foxcool / 07_table.pl
Created November 9, 2011 13:10
example use HTML::TableExtract
##############################################################################
# $URL: mishin.narod.ru $
# $Date: 2011-02-17 20:53:20 +0300 (Mon, 14 Feb 2011) $
# $Author: mishin nikolay $
# $Revision: 1.02 $
# $Source: table.pl $
# $Description: read data from jira table $
##############################################################################
@foxcool
foxcool / gist:1148601
Created August 16, 2011 07:17
такой вот я индус :D
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use CGI::Carp qw/fatalsToBrowser/;
use lib ".";
use LWP::UserAgent;
use HTTP::Cookies;