Skip to content

Instantly share code, notes, and snippets.

View indraone01's full-sized avatar
💭
I may be slow to respond.

Andri Indrawan indraone01

💭
I may be slow to respond.
View GitHub Profile
@indraone01
indraone01 / mlnet-taxidemo-prediction.cs
Created March 10, 2022 01:37 — forked from mdfarragher/mlnet-taxidemo-prediction.cs
This code is part of the ML.NET taxi fare prediction demo.
// create a prediction engine for one single prediction
var predictionFunction = model.CreatePredictionEngine<TaxiTrip, TaxiTripFarePrediction>(mlContext);
// prep a single taxi trip
var taxiTripSample = new TaxiTrip()
{
VendorId = "VTS",
RateCode = "1",
PassengerCount = 1,
TripDistance = 3.75f,
@indraone01
indraone01 / mlnet-taxidemo-rmse.cs
Created March 10, 2022 01:34 — forked from mdfarragher/mlnet-taxidemo-rmse.cs
This code is part of the ML.NET taxi fare prediction demo.
// get a set of predictions
Console.Write("Evaluating the model....");
var predictions = model.Transform(partitions.TestSet);
// get regression metrics to score the model
var metrics = mlContext.Regression.Evaluate(predictions, "Label", "Score");
Console.WriteLine("done");
// show the metrics
Console.WriteLine();
@indraone01
indraone01 / mlnet-taxidemo-classes.cs
Created March 10, 2022 01:24 — forked from mdfarragher/mlnet-taxidemo-classes.cs
A C# code fragment of the MLNET taxi price prediction demo
/// <summary>
/// The TaxiTrip class represents a single taxi trip.
/// </summary>
public class TaxiTrip
{
[LoadColumn(0)] public string VendorId;
[LoadColumn(5)] public string RateCode;
[LoadColumn(3)] public float PassengerCount;
[LoadColumn(4)] public float TripDistance;
[LoadColumn(9)] public string PaymentType;
@indraone01
indraone01 / mlnet-taxidemo-createmodel.cs
Created March 10, 2022 01:21 — forked from mdfarragher/mlnet-taxidemo-createmodel.cs
This code is part of the ML.NET taxi fare demo
// set up a learning pipeline
var pipeline = mlContext.Transforms.CopyColumns(
inputColumnName:"FareAmount",
outputColumnName:"Label")
// one-hot encode all text features
.Append(mlContext.Transforms.Categorical.OneHotEncoding("VendorId"))
.Append(mlContext.Transforms.Categorical.OneHotEncoding("RateCode"))
.Append(mlContext.Transforms.Categorical.OneHotEncoding("PaymentType"))
@indraone01
indraone01 / mlnet-taxidemo-loadingcsv.cs
Created March 10, 2022 01:20 — forked from mdfarragher/mlnet-taxidemo-loadingcsv.cs
This code is part of the ML.NET taxi fare prediction demo.
/// <summary>
/// The program class.
/// </summary>
class Program
{
// file paths to data files
static readonly string dataPath = Path.Combine(Environment.CurrentDirectory, "yellow_tripdata_2018-12.csv");
/// <summary>
/// The main application entry point.
@indraone01
indraone01 / create_sha256_signature.py
Created July 17, 2018 16:39 — forked from gauravvjn/create_sha256_signature.py
Create HMAC SHA256 signature/encryption/encode
"""
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873
"""
import hmac
import hashlib
import binascii
def create_sha256_signature(key, message):
@indraone01
indraone01 / CreateSHA256Signature
Created July 17, 2018 16:39 — forked from Azadehkhojandi/CreateSHA256Signature
Create SHA256 Signature for payment gateway (bendigo bank)
public static string CreateSHA256Signature(string key, string message)
{
// Hex Decode the Secure Secret for use in using the HMACSHA256 hasher
// hex decoding eliminates this source of error as it is independent of the character encoding
// hex decoding is precise in converting to a byte array and is the preferred form for representing binary values as hex strings.
var convertedHash = new byte[key.Length / 2];
for (var i = 0; i < key.Length / 2; i++)
{
convertedHash[i] = (byte)int.Parse(key.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber);
}
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <YOUR@EMAIL.KAPPA> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j