Git Product home page Git Product logo

cli.fyi's Introduction

cli.fyi's People

Contributors

daveearley avatar veloxy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli.fyi's Issues

Renew SSL Certificate

Hi there,

Could you please provide the SSL renew to the website, thank you for this useful,

Best Regards,

Joel Pinheiro

301 error when doing a curl on cli.fyi

When I do the $ curl cli.fyi/BTC example request, all I get is :

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.12.1 (Ubuntu)</center>
</body>
</html>

I need to pass the -L parameter in order to get something.

I think this should be mentioned in the documentation, although it worked without before ๐Ÿ˜•

Suggestion: use quicktype to generate code from data

Just wanted to make you aware of quicktype, which can generate code from cli.fyi data for using the data in many programming languages.

Generate Swift for BTC data

~ curl cli.fyi/BTC | quicktype -l swift             
// To parse the JSON, add this file to your project and do:
//
//   let topLevel = try TopLevel(json)

import Foundation

struct TopLevel: Codable {
    let type: String
    let data: [String: Double]
}

// MARK: Convenience initializers

extension TopLevel {
    init(data: Data) throws {
        self = try JSONDecoder().decode(TopLevel.self, from: data)
    }

    init(_ json: String, using encoding: String.Encoding = .utf8) throws {
        guard let data = json.data(using: encoding) else {
            throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil)
        }
        try self.init(data: data)
    }

    init(fromURL url: URL) throws {
        try self.init(data: try Data(contentsOf: url))
    }

    func jsonData() throws -> Data {
        return try JSONEncoder().encode(self)
    }

    func jsonString(encoding: String.Encoding = .utf8) throws -> String? {
        return String(data: try self.jsonData(), encoding: encoding)
    }
}

Generate Go for domain info

~ curl cli.fyi/github.com | quicktype -l go --top-level DomainInfo
// To parse and unparse this JSON data, add this code to your project and do:
//
//    domainInfo, err := UnmarshalDomainInfo(bytes)
//    bytes, err = domainInfo.Marshal()

package main

import "encoding/json"

func UnmarshalDomainInfo(data []byte) (DomainInfo, error) {
	var r DomainInfo
	err := json.Unmarshal(data, &r)
	return r, err
}

func (r *DomainInfo) Marshal() ([]byte, error) {
	return json.Marshal(r)
}

type DomainInfo struct {
	Type string `json:"type"`
	Data Data   `json:"data"`
}

type Data struct {
	DNS   []string `json:"dns"`  
	Whois []string `json:"whois"`
}

Generate C# classes for client info

~ curl cli.fyi/me | \
    quicktype -l csharp --features attributes-only --top-level ClientInfo --density dense \
      --namespace CLI.FYI
namespace CLI.FYI
{
    using System;
    using System.Collections.Generic;

    using System.Globalization;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;
    using J = Newtonsoft.Json.JsonPropertyAttribute;
    using R = Newtonsoft.Json.Required;
    using N = Newtonsoft.Json.NullValueHandling;

    public partial class ClientInfo
    {
        [J("type")] public string Type { get; set; }
        [J("data")] public Data Data { get; set; }  
    }

    public partial class Data
    {
        [J("iPAddress")]     public string IPAddress { get; set; }           
        [J("userAgent")]     public string UserAgent { get; set; }           
        [J("browser")]       public string Browser { get; set; }             
        [J("iPAddressInfo")] public IPAddressInfo IPAddressInfo { get; set; }
    }

    public partial class IPAddressInfo
    {
        [J("organisation")] public string Organisation { get; set; }
        [J("country")]      public string Country { get; set; }     
        [J("countryCode")]  public string CountryCode { get; set; } 
        [J("city")]         public string City { get; set; }        
        [J("continent")]    public string Continent { get; set; }   
        [J("latitude")]     public string Latitude { get; set; }    
        [J("longitude")]    public string Longitude { get; set; }   
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.