Thursday, November 1, 2018

Gitlab Runner Register: x509: certificate signed by unknown authority Error

For Gitlab CI/CD, I was trying to register a runner using "gitlab-runner register" command; but I was continuously getting error " x509: certificate signed by unknown authority". After trying to fix the issue by SSL certificates path, I finally solved it using CURL. Here is the command I used.

curl --cacert <cert_name_fullchain>.crt --request POST  "https://<domain>/api/v4/runners/" --form "token=<the_token>" --form "description=test" --form "tag_list=test".

Monday, April 14, 2014

Creating PDF file from DVI with Embedded Fonts

These instructions are valid for Ubuntu. It may also work in Windows with ghostscript installed.

Use the following commands in order.

  1. dvips -Ppdf -G0 -tletter your_file.dvi 
  2. ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress your_file.ps 
In case you get a segmentation fault. Use the following steps.
  1. dvips -Ppdf -G0 -tletter your_file.dvi
  2. ps2ps your_file.ps your_new_file.ps
  3. ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress your_new_file.ps

Monday, March 17, 2014

Latex Tips & Tricks

Setup Page Margins

\newcommand{\CLASSINPUTinnersidemargin}{0.5in} % left side margin
\newcommand{\CLASSINPUToutersidemargin}{0.5in}% right side margin
\newcommand{\CLASSINPUTtoptextmargin}{1.0in} % top text margin
\newcommand{\CLASSINPUTbottomtextmargin}{1.0in}% bottom text margin
\documentclass {your_class}

** Change the number as necessary.

Solving italic-underline Problem

Problem definition: all the italic words are automatically underlined
Solution: Add the following line after \begin{document}

\normalem


Thursday, October 31, 2013

Matlab Reshape Matrix

Recently I faced a problem with reshaping a matrix. Here is how I solved it.

Input: x = n*1 matrix
Output: y = a*b matrix where a*b = n

Example:

       [1
        2
x =  3
       4
       5
       6 ]

      [ 1  2
y =  3  4
       5  6]

Code:

y = reshape(x, 2, 3)
y = transpose(y)
 

Tuesday, February 5, 2013

Make a Micro SIM from a Regular SIM


Recently I needed a micro SIM card for using in a Nexus 4 phone. Since AT&T wanted me to get a data plan for getting a micro SIM (which is ridiculous!), I made the micro SIM from the regular SIM card I have. Here is how to do it.

  • Download and print the following image. Use original image size while printing.

  • Use a ruler and ruler to extend the lines of micro SIM
  • Place the SIM card on the paper so that it fits in the border of Mini SIM in the image.
  • Use pencil and ruler to draw lines over the SIM card using the extended lines of micro SIM as reference.
  • Use a sharp scissor to cut the SIM.
  • Don't worry if does fit in the phone after the first try. Just trim it as necessary.
  • Make sure that the golden part is not cut in any way.

Saturday, January 19, 2013

Samsung Nexus S: Flush Jelly Bean Factory Image

I have been waiting for OTA for several months with no luck. So finally decided to flush my Samsung Nexus S with Jelly Bean 4.1.2 factory image. Here is how I did it. 
  1. (PC) Download Nexus Root Toolkit from here (don't worry. I did not root my phone, just unlocked it for flushing!). 
  2. (PC) Install the software. When prompted, choose your device. In my case, it was Samsung Nexus S, 850MHz, i9020a. Allow the software to download necessary files for your phone.
  3. (PC) Connect your phone to the PC with a USB cable. Run the 'Nexus Root Toolkit' software and click on 'Unlock'. Follow the on screen instructions to unlock your phone.
  4. (PC) Download Nexus S factory image from here
  5. (PC) Unzip the downloaded image in the installation directory of Nexus Root Toolkit. In my case the path was C:\Program Files\WugFresh Development\data
  6. (Phone) Turn off your device 
  7. (Phone) Go to Bootloader (press&hold volume up button then press&hold power button) 
  8. (PC) Go to the folder where you unzipped the factory image. Make sure that the folder contains adb.exe and fastboot.exe.
  9. (PC) Double click on flash-all.bat file. This will flush the factory image in the phone.
  10. (PC) When done, click on 'OEM Lock in the Nexus Root Toolkit to lock bootloader again.
Enjoy your Jelly Bean:)

Friday, December 14, 2012

Installing R in Ubuntu

To install R (http://cran.r-project.org) and desired packages in Ubuntu, follow the steps:
  1. sudo apt-get install r-base
  2. R (this will open R command window)
  3. To add a package, e.g., signal, run the following
    • install.packages("signal")
    • packageStatus()
    • update.packages()
 That's it!

** Adding R repository paths to package manager may be necessary.