Skip to content

Instantly share code, notes, and snippets.

View AntonyKapustin's full-sized avatar

Anton Kapustin AntonyKapustin

  • Tbilisi, Georgia.
View GitHub Profile
@AntonyKapustin
AntonyKapustin / GLIST
Created September 16, 2019 11:50
GLIST
#!/usr/bin/env bash
IFS=$'\n' clusters=($(kubectl config get-contexts --no-headers | awk '{print $2}'))
active_cluster=$(kubectl config current-context)
for i in ${!clusters[@]};
do
:
if [ "${clusters[$i]}" == $active_cluster ]; then
echo -e "\e[34m[*] \e[36m"${clusters[$i]}
@AntonyKapustin
AntonyKapustin / GLIST
Created September 16, 2019 11:50
GLIST
#!/usr/bin/env bash
IFS=$'\n' clusters=($(kubectl config get-contexts --no-headers | awk '{print $2}'))
active_cluster=$(kubectl config current-context)
for i in ${!clusters[@]};
do
:
if [ "${clusters[$i]}" == $active_cluster ]; then
echo -e "\e[34m[*] \e[36m"${clusters[$i]}

Keybase proof

I hereby claim:

  • I am AntonyKapustin on github.
  • I am akapustin (https://keybase.io/akapustin) on keybase.
  • I have a public key whose fingerprint is 7770 F4AF 62A6 E905 F801 C992 D0C3 B088 0430 DC49

To claim this, I am signing this object:

@AntonyKapustin
AntonyKapustin / TimeUtils.cs
Created August 30, 2015 14:49
CurrentTimeMillis() in C#
using System;
public class TimeUtils {
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static long CurrentTimeMillis()
{
return (long) (DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
}
@AntonyKapustin
AntonyKapustin / Main.java
Created August 11, 2015 09:04
Read file word by word solution.
public static void main(String[] args) throws IOException {
// OptionalInt max = Files.lines(Paths.get("/", "1.txt"), Charset.forName("windows-1251"))
// .flatMap(s -> Arrays.stream(s.split("[\\P{L}]+")))
// .peek(System.out::println)
// .mapToInt(s -> s.length())
// .max();
//
//(max.getAsInt());
String content = new String(Files.readAllBytes(Paths.get("/", "1.txt")), Charset.forName("windows-1251"));
//System.out.println(content);
@AntonyKapustin
AntonyKapustin / LongSynchronizedSummaryStatistics.java
Created March 7, 2015 17:49
LongSynchronizedSummaryStatistics. Concurrent Long stats.
import java.util.LongSummaryStatistics;
/**
*
* @author Anton Kapustin antonkapystin@hotmail.com
*/
public class LongSynchronizedSummaryStatistics extends LongSummaryStatistics {
public LongSynchronizedSummaryStatistics() {
super();