Laur IVAN

Remove Large Files in Git

Posted by in Software, Tutorial

TL;DR: BFG is your friend. java -jar bfg.jar -b 50M myrepo-bfg.git for example The other day I’ve committed a rather large file by mistake (generated movie of the git commit history). This was a bit annoying because all other developers would have suddenly to check out a 1G file :( with no LFS support… As I took the opportunity to clean up the repository also, I’ve noticed the size of the cloned reop was rather huge! So, I was presented with several options Create a new repo with the cleaned…read more

Fix 418 Unused Error on Dreamhost

Posted by in IT

TL;DR: Have a look at the error log and then to the violated rule. Suddenly, I started to get 418 errors on one of my sites. I’d just get 418 from the source and as they say: that was that. Normally, I don’t even notice such errors, but this one broke a bunch of pages. The 418 errors look in general like this:

Now, this translates to an rule for mod_sec2. To fix, you need to go to the file referred by the error, at the specific line and…read more

Run a Rundeck Command as a Different User

Posted by in Software, Tutorial

TL;DR: Add the rundeck user to the sudoers and then use sudo Installing rundeck on Ubuntu usually results in creating a rundeck user. We had a bunch of issues creating a rundeck job because we needed to execute a command as a specific user (only that user had access to some resources). Unfortunately, rundeck is not as versatile as Jenkins (plugins and such) — or I couldn’t find anything relevant at the time. Initially, I’ve tried adding the rundeck user to the same group as the other user, but only…read more

Fix Not Found Package Errors with .staging Warnings on Npm Install

Posted by in Software

TL;DR: Clean the npm cache and the package-lock.json The other day I started to get ENOENT warning when running npm install like:

only to have the compilation failing with something like:

I’ve looked into it and the conclusion was that the error occurred because I’ve updated my node/npm version. Most answers recommend removing the npm cache either via rm -rf or via npm cache clean. however, this didn’t fix my problem. This issue seemed to match my behavious and one of the solutions was to remove package-lock.json and…read more

Fix TS1144 for e.g. flex-layout

Posted by in Software

TL;DR: Update your typescript version dependency. These days we’re updating some angular apps to the most recent version (6 at the time of writing this entry). Everything is nice, with the exception of various errors we get because of the other dependencies. The most recent one was a TS1144: ‘{‘ or ‘;’ expected in one of the dependencies (flex-layout to be precise). As it’s a popular 3rd party library, it’s more probable the error occurs because of something on our side than on theirs. So… Since it’s a TS error,…read more

Build a Django Docker Image with Cx-Oracle

Posted by in Software, Tutorial

TL;DR: Don’t use alpine images. There’s a glibc issue. We added a cx-oracle dependency to one of our django apps. As the previous image was just an alpine basic (python) image we needed to put in place a process to build the new image. Initially, I’ve tried to use the same alpine image (oh, the slimmed down size is sooo tempting), but then I’ve hit a bunch of “Unknown symbol” messages when I’ve ran the install of cx-oracle in the docker build process. Subsequently, I’ve had to switch to python:3.6-slim-jessie….read more

Execute a Command in Every Directory with Bash

Posted by in Software, Tutorial

TL;DR: Use a find-based loop The other day I was wondering how to execute a command in each sub-directory of a project. In python, you have os.walk. In C, I would’ve probably written myself something just for fun etc. In shell, I know you have find which is capable of finding all directories (find (dir) -type d). All I need to do is to wrap this in a loop and for this one has two options: Commmand line style

or

Script style with a loop

The choice…read more

Build Update Statements with Oracle SQL Developer and Python

Posted by in Software, Tutorial

By default, SQL Developer can only export INSERT statements. This is quite unfortunate when one needs to build UPDATE statements because their syntax is different. I’ve tried to use regexp to convert the statements but I didn’t find it not straight forward at all. So, I cam up with the following strategy: Export the data as JSON Use a python script (below) to write the statements The python script We first need to specify things like the DB Schema, table and the primary key:

Subsequently, I’ve defined a wrapper…read more

How to Develop Pipelines – Some Best Practices

Posted by in IT, Software

These days I’m developing a bunch of pipelines to automatise the build/deployment process. Here are some things I’ve learned: How to develop Initially, I’ve started developing the pipeline as any other program: Create a repository, fire my editor, write a Jenkinsfile and use the Pipeline script from SCM. While the result is exactly what you want to have at the end, the edit-deploy-run cycle becomes a chore and it’s quite unpleasant at the beginning (I had a bunch of typos for example), so DON’T. Instead, create a simple pipeline with…read more

Sending HTTP requests with Jenkins Pipelines

Posted by in IT

As part of the CI/CD process, we might need to communicate with some external services’ APIs (e.g. notifying elastic search of a new index alias). I found an easy way to do it: Using a jenkins plugin. Jenkins plugin Jenkins has a HTTP request plugin. If you install it (or have it installed), you have the ability to send HTTP requests to external servers from Jenkins. Fortunately, this plugin also plays wery well with pipelines. You can sent practically any (REST) command to a destination:

You can customisethe request…read more