parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/ [\1]/' }
export PS1="\u@\h \W[\033[01;33m]$(parse_git_branch)[\033[00m] $ "
Here are some other terminal colour codes you can use:
Some other cool options:
# all | |
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted|Terminating' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod --grace-period=0 --force | |
# not terminated | |
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod --grace-period=0 --force | |
# manual scaling adjustment | |
kubectl scale --replicas=0 deployment <deployment> |
public class Person { | |
public string FirstName { get; set; } | |
public string LastName { get;set; } | |
public int Age { get; set; } | |
public async Task Finalize() { | |
// does something does not matter what | |
} | |
} |
import { Component } from '@angular/core'; | |
import { of } from 'rxjs'; | |
import { tap, switchMap} from 'rxjs/operators'; | |
import { retryBackoff } from 'backoff-rxjs'; | |
import { BackendService, HttpError } from './backend.service'; | |
export const INIT_INTERVAL_MS = 100; // 100 ms | |
export const MAX_INTERVAL_MS = 20 * 1000; // 20 sec | |
@Component({ |
$ServiceName = 'Serenade' | |
$arrService = Get-Service -Name $ServiceName | |
while ($arrService.Status -ne 'Running') | |
{ | |
Start-Service $ServiceName | |
write-host $arrService.status | |
write-host 'Service starting' | |
Start-Sleep -seconds 5 |
// In HTML component | |
// <input placeholder="Search" ... (keyup)="onSearchKeyUp()" [(ngModel)]="searchFilter" /> | |
// in .ts file | |
searchFilter: string; | |
private searchSubject: Subject<string> = new Subject(); | |
private searchSubscription: Subscription; | |
filterItems() { | |
// do the thing by searchFilter |
List<string> errors = ModelState.Values.SelectMany(v => v.Errors).Select(x => x.ErrorMessage) |
DateTime date = DateTime.Now; | |
string oracleDateString = $"to_date('{date.Now.ToString("MM/dd/yyyy hh:mm:ss tt")}','MM/DD/YYYY HH:MI:SS AM')"; |
/// <summary> | |
/// Helper methods for the lists. | |
/// </summary> | |
public static class ListExtensions | |
{ | |
public static List<List<T>> ChunkBy<T>(this List<T> source, int chunkSize) | |
{ | |
return source | |
.Select((x, i) => new { Index = i, Value = x }) | |
.GroupBy(x => x.Index / chunkSize) |
^(?!.*--)[A-Za-z0-9_-]*$ |