Skip to content

Instantly share code, notes, and snippets.

View caisback's full-sized avatar

caisback

View GitHub Profile
@caisback
caisback / Apache Camel Accessing 3rd Party API (https). md
Created July 6, 2021 12:37
Apache Camel Accessing 3rd Party API (https).
AHC / camel-ahc
HTTP4 / camel-http4
@caisback
caisback / ca's git cheatsheet.md
Last active July 11, 2021 21:29
ca's git cheatsheet

git create branch and checkout one command

$ git checkout -b 20200712-NavBar

git get the current branch name

git branch --show-current
// import_json_appsscript.js
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
//
// Changelog:
// (Oct. 16 2019) tag: allenyllee-20191016
// 1. Fixed google script error: urlfetchapp - service invoked too many times https://stackoverflow.com/questions/10598179/google-apps-script-urlfetchapp-service-invoked-too-many-times
// (Jul. 16 2018) tag: allenyllee-20180716
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member."
// (Nov. 30 2017) tag: allenyllee-20171130
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index
@caisback
caisback / C# - Calling API with Deserialize to Class.cs
Created April 28, 2022 22:43
C# - Calling API with Deserialize to Class
// var cultureInfo = new CultureInfo("en-US");
// // cultureInfo.NumberFormat.CurrencySymbol = "P";
// CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
// CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
const string REST_API = "https://api.domain.com/v1/markets";
//List<Market> markets;
@caisback
caisback / ForeachIf_to_LINQ.cs
Last active May 7, 2022 22:37
C# - Array filtering from Old School (foreach and if) to New School (LINQ)
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
//ShowListOfList_01();
/*
tvg-country="US"
tvg-country="UK" tvg-language="English"
tvg-country="CA" tvg-language="English"
@caisback
caisback / ListToArray.cs
Last active May 9, 2022 23:35
c# - You can not add new item to an array, used List() instead with ToArray()
// You can't add items to an array, since it has fixed length.
// What you're looking for is a List<string>, which can later be turned to an array using list.ToArray()
List<string> list = new List<string>();
list.Add("Add New Item Hear");
String[] str = list.ToArray();
// Alternatively, you can resize the array.
@caisback
caisback / Simple File Writing.cs
Created May 9, 2022 23:47
c# - Simple file writing
async Task fileWriteLineAsync(string lineToWrite, string fileWhereToWrite)
{
// Always new file:
// using StreamWriter file = new(fileWhereToWrite);
// Create new file or Append if exists:
using StreamWriter file = new(fileWhereToWrite, append: true);
await file.WriteLineAsync(lineToWrite);
}
@caisback
caisback / Free IPTV.cs
Created May 10, 2022 00:18
c# - filtering IPTV list from selected countries and removed geo-blocked using LINQ
async void FileIOwithLINQ()
{
const string FILE_PATH = "./Data/country.oneliner.m3u.txt";
const string ODD_EVEN_SEPERATOR = "~";
// const string OUTPUT_FILE_PATH = "./Output/country.oneliner.m3u.txt";
const string OUTPUT_FILE_PATH = "./Output/caFilteredChannels.m3u";
string[] lines = System.IO.File.ReadAllLines(FILE_PATH);
// string FilterBy = "tvg-country=\"INT\" tvg-language=\"English\"";
string[] FilterBys = {
@caisback
caisback / Azure - Creating SSH keys with the ssh-keygen.md
Last active May 12, 2022 23:55
Azure - Creating SSH keys with the ssh-keygen
@caisback
caisback / NestJs - npm ERR! ERESOLVE unable to resolve dependency tree.md
Created June 13, 2022 23:29
NestJs - npm ERR! ERESOLVE unable to resolve dependency tree

Problem:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

$ npm i --save @nestjs/microservices
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: x-app@0.0.1
npm ERR! Found: @nestjs/common@8.4.6