Skip to content

Instantly share code, notes, and snippets.

View BioQwer's full-sized avatar
💭
🚀

Antony Aleksandrov BioQwer

💭
🚀
View GitHub Profile
@BioQwer
BioQwer / delete_pod.sh
Created August 4, 2023 11:13
delete_pod failed
kubectl delete pods --field-selector status.phase=Failed --all-namespaces
kubectl delete pods --field-selector status.phase=Error --all-namespaces
#ALL
kubectl delete pods --field-selector status.phase!=Running --all-namespaces
@BioQwer
BioQwer / Google protobuf installation on Mac
Created March 13, 2020 08:45 — forked from rajkrrsingh/Google protobuf installation on Mac
Steps to Install google protobuf on Mac
$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
$make -j 4
$sudo make install
$protoc --version
/**
* println(Schema2CaseClass.schema2Cc(dfp.schema, "Party"))
*/
object Schema2CaseClass {
import org.apache.spark.sql.types._
case class RecFieldRes(fieldStr: String, additionalCc: Option[String] = None)
case class CcRes(cc: String, additional: List[String])
@BioQwer
BioQwer / logstash.conf
Last active December 26, 2016 08:50 — forked from glnds/logstash.conf
Logstash Glassfish server.log config
# Logstash config for Glassfish logs
# Used in combination with slf4j and logback
# Output:
# - application: glassfish
# - type: application or internal
# - categorie: technical or functional
input {
# If running logstash under a different user then check your permission to be sure that
# logstash has access to the server.log file. If logstash has no access to the file you
@BioQwer
BioQwer / update.sh
Created June 28, 2016 07:52
Update All repos in folder
for i in $(ls -1);
do
cd $i;
pwd;
git pull;
cd .. ;
done;
@BioQwer
BioQwer / DeleteMe.java
Created March 28, 2016 14:17
Concurrency
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
public class DeleteMe {
@BioQwer
BioQwer / file.encoding = UTF-8
Created August 25, 2015 08:08
Provide UTF-8 encoding without -D on start JVM
try {
System.setProperty("file.encoding", "UTF-8");
Field charset = Charset.class.getDeclaredField("defaultCharset");
charset.setAccessible(true);
charset.set(null, null);
} catch (IllegalAccessException | NoSuchFieldException e) {
e.getMessage();
}
public User getCurrentUser(Principal principal) {
System.out.println("principal.getName() = " + principal.getName());
System.out.println(" userService.getByLogin(principal.getName()) = " + userService.getByLogin(principal.getName()));
return userService.getByLogin(principal.getName());
}
/**
* Edit user method
* !! if Change user.login you must to re singIn on client !!
*/
@BioQwer
BioQwer / UserTest.java
Created October 22, 2014 20:50
validation with Help @pattern
user.setEmail("eqwqe@ewe.qwe");
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
Validator validator = vf.getValidator();
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(user);
System.out.println(String.format("Кол-во ошибок: %d",
constraintViolations.size()));
System.out.println("constraintViolations = " + constraintViolations.isEmpty());