This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
REGEX_COMMIT_MSG='^(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|release|workflow)(\(.+\))?: .{1,50}'; | |
# https://www.conventiona | |
if [[ $(<"$1") =~ $REGEX_COMMIT_MSG ]] | |
then | |
echo "commit message match convention"; | |
exit 0; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
a = pd.DataFrame([1,2,2,3,3,3,1,1,2]) | |
b = a.loc[:,0] | |
c = b.loc[b.shift()!=b] | |
print(c.tolist()) | |
// https://stackoverflow.com/questions/19463985/pandas-drop-consecutive-duplicates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.function.Function; | |
import java.util.function.Predicate; | |
import java.util.regex.Pattern; | |
import java.util.stream.Stream; | |
import java.util.Arrays; | |
/* raw problem and better solution: | |
https://stackoverflow.com/questions/57836937/call-custom-static-functions-from-filter-and-map-in-java-8-stream | |
*/ | |
class Solution { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class quickSort { | |
public static void main(String[] args) { | |
int[] test = new int[]{5,1,1,2,0,0}; | |
quickSortArr(test, 0, test.length-1); | |
printArr(test); | |
} | |
public static void printArr(int[] arr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
class Program { | |
public static void main(String[] args) { | |
for(int i = 0; i <= 10; i++) { | |
System.out.print(fibonacci(i) + " "); | |
} | |
System.out.println(); | |
for(int i = 0; i <= 10; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get internal ip address | |
ipconfig | |
# get external ip address | |
Invoke-WebRequest ifconfig.me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine(); | |
// <-- Keep this information secure! --> | |
Console.WriteLine("UserName: {0}", Environment.UserName); | |
//this one can get domain and user name | |
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; | |
Console.WriteLine(); | |
Console.WriteLine(userName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* just for learning | |
* key concept, LinkedList | |
* refer https://blog.csdn.net/qq_16587307/article/details/104301877 | |
* refer https://medium.com/@bonnotguillaume/software-architecture-the-pipeline-design-pattern-from-zero-to-hero-b5c43d8a4e60 | |
*/ | |
namespace pipeline | |
{ | |
public class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/ranges | |
#region Indexable Example | |
//System.Index | |
// use '^' operator: means read from end = true | |
// '^' operator requires type is countable and have indexer: | |
interface IIndexable<T>{ | |
public int Length { get; } // need public property 'Length', which has get access | |
public T this[int index] { get; } // need public indexer, which takes a single int as the argument. |
OlderNewer