Don't wanna be here? Send us removal request.
Text
kubectl helper
https://github.com/kuritka/kubernetes_helper/blob/master/network-utils.yaml
0 notes
Text
connecting to SFTP / SSH
~/.ssh/ needs to be setted to 0700 authorization_keys needs to be setted to 0600 sftp -oIdentityFile=pk.key edt2@localhost ssh -i ./pk.key edt2@localhost good luck! :)
0 notes
Text
How to store private key in environment variable
This is necessary for keeping keys in environment variables. It does work under Linux but on Windows you cannot make it. # store IFS first SAVEIFS=$IFS IFS='' #udate environment variable export EDT_SFTP_PRIVATE_KEY="$(cat Edt_Private.key)" #check whether it is well exported echo $EDT_SFTP_PRIVATE_KEY #set IFS back IFS=$SAVEIFS Another solution is to keep key stored in base64 format so you doesnt handle enters: export EDT_SFTP_PRIVATE_KEY="$(cat Edt_Private.key) | base64 -w0"
15 notes
路
View notes
Text
Database performance
I created very simple M:N relation between batches and ISISNs. Each Batch could contain up to the 1000 ISISNs.
Here are some statistics:
Very fisrt run
SQL Server parse and compile time: 聽 CPU time = 0 ms, elapsed time = 6 ms.(2 rows affected) SQL Server Execution Times: 聽 CPU time = 10077 ms, 聽elapsed time = 4012 ms. SQL Server parse and compile time: 聽 CPU time = 0 ms, elapsed time = 0 ms.
Next run
SQL Server parse and compile time: 聽 CPU time = 0 ms, elapsed time = 0 ms.(2 rows affected) SQL Server Execution Times: 聽 CPU time = 8921 ms, 聽elapsed time = 2428 ms. SQL Server parse and compile time: 聽 CPU time = 0 ms, elapsed time = 0 ms.
Join with four batches
0 notes
Text
How to update .bashrc
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc
0 notes
Text
Connecting to github from Fedora
Here is another way how to connect to github from Fedora:
git config --global url."[email protected]:".insteadOf "https://github.com/" g git config --global user.email="[email protected]" git config --global user.name="Your Name" cd ~/.ssh/ # generate key pair and add public key to your github $ ssh-keygen -t rsa -C "[email protected]" #add generated public key to your GIT. #https://github.com/settings/keys ssh -vt <user>@github.com # When it prompts error ... #Are you sure you want to continue connecting (yes/no)? # Say 'yes' #Now your remote host is added to the known_hosts
git clone https://github.com/XYZ/edt-platform go get -v ./...
0 notes
Text
How to store environment variable with new lines
working well, when you need to store private keys into environment variables:
$ SAVEIFS=$IFS $ IFS='' $ export EDT_SFTP_PRIVATE_KEY="$(cat ~/key.private)" $ echo $EDT_SFTP_PRIVATE_KEY $ IFS=$SAVEIFS
more info about $IFS: https://unix.stackexchange.com/questions/164508/why-do-newline-characters-get-lost-when-using-command-substitution
0 notes
Text
Acessing RDP on AZURE RHEL 7.4
Here is step by step what needs to be done on VM to. First you need to install GNOME on your machine and thanallow remote desktop to access from Windows.
`#systemctl stop firewalld` `#systemctl disable firewalld` `#yum install 聽聽https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm` `#yum install xrdp tigervnc-server xterm` `#systemctl enable xrdp` `#systemctl enable xrdp-sesman` `sudo systemctl start xrdp` `sudo systemctl start xrdp-sesman` #Private key authentication is forbidden for RDP, so you need setup #password for user `sudo passwd <your user>` #following commands must show green result `sudo systemctl status xrdp` `sudo systemctl status xrdp-sesman` #Going with disabled firewall is antipattern # Please spend some time by investigating correct # iptables setup and enable firewall back. #After running GoLand installation you may see blank dialog. #This would be fixed by going to `/etc/xrdp/xrdp.ini` #and setting to `max_bpp=24`. #Restart RDP than..
0 notes
Text
Setup GIT for SSH on Windows 10
Once we switched to go we started to clone project including all dependencies聽
i.e.聽
go get github.com/Deutsche-Boerse/gRPC
normally we run :
git config --global url."[email protected]:".insteadOf "https://github.com/"
go get github.com/Deutsche-Boerse/gRPC - Clone project
go get ./... - Install project dependencies
Because traffic goes through SSH you need to make additional steps on your machine:
git config --global user.email="[email protected]" git config --global user.name="Your Name" #open Git Bash from START menu and run $ ssh-keygen -t rsa -C "[email protected]" # generate key pair and add public key to your github (https://github.com/settings/keys) #add github public key to your GIT $ ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
And that's all! enjoy...
3 notes
路
View notes
Text
View Kubernetes Cluster on Azure
To see kubernetes cluster you need to install kubernetes聽and azure-cli. Than run following commands聽
az login az aks get-credentials "resource-group EDT4AKS "name edtAKSCluster kubectl config use-context edtAKSCluster # switch kubectl context to edtAKSCluster kubectl get services
dt-api-gateway-deployment LoadBalancer 10.0.229.117 40.114.248.163 80:32367/TCP 38d edt-api-gateway-service NodePort 10.0.127.236 <none> 80:30811/TCP 38d edt-etl-service ClusterIP 10.0.18.93 <none> 9020/TCP 38d edt-globalnotes-service ClusterIP 10.0.217.54 <none> 9030/TCP 38d edt-interaction-service ClusterIP 10.0.202.8 <none> 9010/TCP 38d edt-upload-service ClusterIP 10.0.52.91 <none> 9000/TCP 38d edt-validator-service ClusterIP 10.0.105.41 <none> 9040/TCP 38d edt-workflow-service ClusterIP 10.0.6.163 <none> 8010/TCP 38d kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 38d
0 notes
Text
Publish/Subscribe vs Producer/Consumer
Although both Publisher/Subscriber and Producer/Consumer terms are related to messaging, they are different and can't be used interchangeably.
Publisher/Subscriber is a messaging pattern where a publication is distributed to multiple receivers. Whereas in Producer/Consumer pattern, Producer is the sender of messages and consumer is the receiver of messages. Producer and consumers are an integral part of both Publisher/Subscriber and Point-to-Point messaging patterns.
more info about produce consumer is here
0 notes
Text
Covariance x Contravariance
This is one of the moost confusing generic parts of C# (exists from 4.0)
The goal is to moving from specific to general. 聽Look at the code below: thanks to out T 聽we are able to do something like this:
public interface IFoo<out T> { T GiveMeFoo(); } public class Program { public static void Main(string[] args) { IFoo<string> foos = null; IFoo<object> generals = foos; /*covariance enables such analogy with generic types*/ string foo = "text"; object general = foo; } }
If you move 鈥渙ut鈥澛爁rom interface you cannot convert from IFoo<string> to IFoo<object>.聽
Now something more difficult:
public interface IFoo<out T> { T GiveMeFoo(); } public interface IBar<T> : IFoo<T> { } public class Program { public static void Main(string[] args) { IBar<string> barStr = null; IBar<object> barObj = barStr; /*BUILD FAILS because IBar has not covariant T*/ IFoo<object> fooObj = barStr; /*is Ok, because IBar derives from IFoo and IFoo has out T*/ } }
Invariant IList<T>
Problem with IList is similiat to IBar<T> in previous example. 聽It is invariant (it doesnt allow either covariance or contravariance ). Take look at the next example :聽
public interface IFoo<out T> { IEnumerable<T> GetAllFoos(); /*WORKING*/ IList<T> GetSomeFoos(); /*DOESNT COMPILE*/ } public interface IEdible { }; public abstract class Fruit : IEdible { } public class Apple : Fruit{ } public class Banana: Fruit { } public class Pizza : IEdible { } public class Program { public static void Main(string[] args) { List<Banana> bananas = new List<Banana>(); List<IEdible> edibles = bananas; /*DOESNT COMPILE, IList doesnt allow Covariance*/ IEnumerable<IEdible> eedibles = bananas; /* working IEnumerable allows Covariance*/ IEnumerable<Fruit> fruit = bananas; /* working */ edibles.Add(new Banana()); EatAll(bananas); /*DOESNT COMPILE*/ } public static void EatAll(List<IEdible> edibles) { foreach (var item in edibles) { //Do stuff here } } }
聽Don鈥檛 worry, compiler always keep you safe and tell鈥檚 you when covariently or contravariently you shouldn鈥檛 be.聽
Covariance is no type conversion it is allows Reference conversion聽(you still working with the same object but in the different kind of way).
Contravariance
Because Covariance allows only returned values you cannot mix it with input values. That鈥檚 why contravariance exists.
interface IFoo<out T, in U> where T : string, where U : string聽
{
聽 聽 聽 T QuerySomething(U param);
}
1 note
路
View note
Text
SQL Update script
/* sets NotionalCurrency to Deliverablecurrency */ SET XACT_ABORT ON SET NOCOUNT ON PRINT N'Preparing data.' declare @transactionsToUpdate table ( DeliverableCurrency1ExtRefInID int, DeliverableCurrency2ExtRefInID int, NotionalCurrency1ExtRefInID int, NotionalCurrency2ExtRefInID int) BEGIN PRINT 'Starting..' DECLARE @cnt INT SELECT @cnt = COUNT(*) FROM @transactionsToUpdate BEGIN TRANSACTION /* UPDATE CODE HERE. Don't forget to fill AuditLog */ IF(XACT_STATE() = -1) BEGIN ROLLBACK TRAN PRINT N'ROLLED BACK' END ELSE BEGIN IF(@@TRANCOUNT = 0 ) BEGIN PRINT 'ERROR OCCURED' END ELSE BEGIN ROLLBACK TRAN PRINT N'HA HA HA! transaction was ROLLBACKED because COMMIT is commented!' --PRINT N'COMMITED' --COMMIT TRAN END END END
0 notes
Text
Horizontal VS Vertical Deployment
More info here
0 notes
Text
Compression ratio 1:454
Our beamer project will compress huge XML and chunks them into small zipped files. We started with simulation 3GB input XML (top limit) . This valid xml is composed from many repeating parts differ by its growing ID. Because smaller parts are repeating in less than one minute we were able to compress 3GB data into one 6MB zipped chunk !
Beautiful , int鈥檛 it ?
3 notes
路
View notes
Text
Docker + Ansible + Jenkins
We are looking for right build pipe of our new .net core project - BEAMER. I found this article that brings me a light into chaos聽
Basic (Continuous Integration?) Deployment with Ansible, Docker, Jenkins and Git
Jenkins manages WHEN and WHAT to do.
Ansible manages HOW and WHERE to do.
Docker ISOLATE your application with the host, if the host can run docker, you can deploy your application.
0 notes