Showing posts with label tool. Show all posts
Showing posts with label tool. Show all posts

Thursday, September 17, 2020

Github cli tool (gh)

gh is the new  Github command-line tool. I'm super excited about this new tool. It makes the engineers / devops engineer experience much better. It allows you to use github(not fully yet but the basics) in the command line, so you dont need to use the browser. GH is written in GO and I believe in the future we will have amazing tooling from Github to CI/CD using GitHub Actions. So let's get started.


The Video

The Instructions

Cheers,

Diego Pacheco

Monday, August 3, 2020

Terraform Module

Terraform is a great DevOps tool. Terraform has support for Custom Module which is a killer function. Functions allow you to take much more advantage of Terraform and avoid the right custom code in bash or other languages. Today I made a video showing some functions in terraform like how we can work Custom Module. So Let's get started.


Video


Code


Cheers,
Diego Pacheco


Terraform Null-Resource & Local-Exec

Terraform is a great DevOps tool. Terraform has support for Dynamic Provisioning which is a killer function. Functions allow you to take much more advantage of Terraform and avoid the right custom code in bash or other languages. Today I made a video showing some functions in terraform like how we can work Dynamic Provisioning. So Let's get started.


Video


Code


Cheers,
Diego Pacheco

Terraform Functions

Terraform is a great DevOps tool. Terraform has support for functions which is a killer function. Functions allow you to take much more advantage of Terraform and avoid the right custom code in bash or other languages.  Today I made a video showing some functions in terraform like how we can work with external JSON files and use functions. So Let's get started.


Video


Code


Cheers,
Diego Pacheco

Sunday, March 17, 2019

JQ the best Devops Json Processor tool

JQ is a very powerful json processing tool. JQ is great because is written in C and is super fast. JQ also make json appear with a color highlight when you use it in Linux terminal. JQ is useful because you can combine with other DevOps tools like kubectl, docker, ectd, vault, and so on one. Basically, anything that returns a json output you can use JQ in order to process it. JQ has lots of interesting features and is possible to do pretty simple and yet powerful json processing. JQ allow us to subtract parts of the json document and also provide some powerful processing function like map, add, flatten and much more. It's possible to do some very high level and simple functional programming with it.


Now let's take a look on Sheet Cheat I made for JQ.

JQ Sheet Cheat


I hope you like it. Enjoy!

cheers,
Diego Pacheco

Thursday, May 3, 2018

C Unit Testing with Check

When I start on IT, several years ago(+15), C was the first language that I learned. But was not the first language I mastered and deployed in production which was...surprisingly Visual Basic 6.0. However, when I learned C or any language back on that old and arcane time noddy was into testing. However now is impossible to work professionally in any language without tests. C is a low-level language but still kicks ass and has several interesting libs/frameworks. People use to fear C a lot because of lack of syntactical sugar but once you get used to it is not that hard at all. Today I want to show how you can do Unit Testing with C. I will not show how to do Unit Testing with C++ but with C ANSI actually. We will be using Check a unit test lib for C ANSI.




Installing Check on Ubuntu

Currently, I run ubuntu 18.04 LTS on my laptop. So, first of all, let's install check on our machine.

Once you still check now we can get down to the code.

We will create the following directory structure. Please create these folders and touch this files.

Creating the Header file

We will build a simple Calculator solution in order to try out unit tests with Check. So if you are not familiar with OOP like programming in C you can check this out first. Our calculator will be pretty basic we will do basic arithmetic functions. So let's get started with the header file(calc.h).


Here we have a type definition(typedef) Calc which represents a Calculator. Here we basically have function pointers to all math operations(also known as methods) outside of the "Object" Struct we have the constructor and destructor for the type. Right now we have the header file and then we can move to the implementation.

Creating Implementation

Let's move to the C implementation code. Let's look the calc.c file.

Here we have the basic math operations and the destructor which pretty much calls free to release memory. We also have the constructor(newCalc) method which is responsible for creating the Struct instance in memory but also to link the function pointer to the concrete implementations.

Coding the Tests

Now we can move to the Unit Test. We will need to do 2 things here. First of all, we will need to create the uni tests that we want and then we will need to set up a test case and run the tests with the main function in C. Let's go.

Here we have the tests on the function: test_new_calc. There are some start and end tests macros here as well. We create a new calc instance and apply assertions like in any other language.

Finally, we need to set up the test suite e and run the tests. Basically, we create a test suite and we add your tests to the suite. If I want I could add more tests and I would not need more runners.

Running the Tests

Before running the tests we need a simple script in order to properly link the tests(we need the link with check framework) then we need run and also delete the tests binary file. Few free to discard my script and use Makefile straight if you like.



Here we use GCC in order to build the code.  There are some dependencies here like Thread and Check(-lcheck) we need include in order to do proper linking. Now we can run $ ./build.sh we you shall see some result like this:

That's it we create simple unit tests with C using Check.

Cheers,
Diego Pacheco

Monday, September 21, 2015

Installing and Running Monitorix on Amazon Linux OS

Let`s say you need monitor a box and see what happens in sense of CPU, IO, Network, Memory and you want see some nice charts? There is a great tool todo that is monitorix you can real good data and is very easy to get it running.

Monitorix is very simple to use and have a very nice web interface . Today i will show how to install and run monitorix on Amazon Linux OS.






Installing and Running Monitorix on Amazon Linux

You should see something like this:



















Cheers,
Diego Pacheco

Installing and Running ntop 2 on Amazon Linux OS

NTOP 2 is a great tool for linux monitoring. It`s focused on network and have all sorts of charts, visualization and network information you might need.

Today i will show how to install and run ntop2 on Amazon Linux OS(CentOS based) this is not a straight forward task because there are lots of dependencies.

This is very useful if you are doing Stress Tests or Network or Network Failure tests because you can see whats going on with plenty of details the whole thing is very colorful.

Installing NTOP 2 on Amazon Linux OS

Them you can open NTOP 2 and see something like this:




Cheers,
Diego Pacheco

Chuyên mục văn hoá giải trí của VnExpress

.

© 2017 www.blogthuthuatwin10.com

Tầng 5, Tòa nhà FPT Cầu Giấy, phố Duy Tân, Phường Dịch Vọng Hậu, Quận Cầu Giấy, Hà Nội
Email: nguyenanhtuan2401@gmail.com
Điện thoại: 0908 562 750 ext 4548; Liên hệ quảng cáo: 4567.