Code/node.js

Reverse of hostname’s IP

Posted by Kevin Kivi on

Are you tired of typing host domain.tld and then typing host 123.123.123.123 just to be able to get the reverse of the ip of the hostname you’re interested in. I know I am. Here is my node.js commandline application as a solution for that problem.

This software requires node.js to run, which you can download here: https://nodejs.org/en/download/

Installation
npm i fore-cli -g

Usage
fore domain.tld

Example

# fore kevinkivi.com
hel1-77-86-179-68.ext.nebulacloud.fi

GitHub repository: https://github.com/nake89/fore
NPM: https://www.npmjs.com/package/fore-cli

Guides

Fix Certificate error with wget

Posted by Kevin Kivi on

So, you are unable to download from https sources with wget. Instead you get the following error.

ERROR: The certificate of `www.google.com' is not trusted.
ERROR: The certificate of `www.google.com' hasn't got a known issuer.

No problemo. This error is most likely occurring for missing root certificates. Simply install the ca-certificates package:

sudo apt-get install ca-certificates

This should work on Ubuntu and Debian derivatives.

Guides/Bash

How to Search Contents of File in Linux

Posted by Kevin Kivi on

This is something you need to do often for one reason or another. Maybe you have a bunch of text files, which have been named horribly and you have no idea which file has the thing you are looking for, but you happen to remember a word in that file. Or maybe you need to find which file contains a certain variable to find the root cause of an error you are experiencing in your script. What ever the reason may be, this command lets you search a directory recursively (meaning all the directories in it as well) to find your file(s).

Below is the command.

grep -rnw '/give/your/path/' -e "pattern"

The command-line options are as the following:
-r, Recursive
-n, Gives you the line number
-w, Searches the whole word
-e, Searches the pattern you tell it.

Source: http://stackoverflow.com/questions/16956810/how-to-find-all-files-containing-specific-text-on-linux

Code/Guides

How to pass command-line arguments in node.js

Posted by Kevin Kivi on

So you want to pass information to your program. This can be quite easily achieved. The arguments are contained in process.argv.

arg.js

console.log(process.argv[0]);
console.log(process.argv[1]);
console.log(process.argv[2]);
console.log(process.argv[3]);
console.log(process.argv[4]);

Testing the code:

nake89@debian:~/nodeprojects/soacomp$ node arg.js what is this
/home/nake89/.nvm/versions/node/v6.10.2/bin/node
/home/nake89/nodeprojects/soacomp/arg.js
what
is
this

So the first line is the location of your node executable and the second one is the location of the script. These are largely unnecessary which is why the following script is so popular. It strips away the first to results of the array.

var args = process.argv.slice(2);

args.js

var args = process.argv.slice(2);
console.log(args[0]);
console.log(args[1]);
console.log(args[2]);

Testing the new code:

nake89@debian:~/nodeprojects/soacomp$ node arg.js what is this
what
is
this

As you can see the unnecessary parts are removed and you can focus on the arguments you want to manipulate. Happy coding!

Guides

Installing Vim UltiSnips on Debian 7 Wheezy

Posted by Kevin Kivi on

I had some problems recently installing UltiSnips on my Debian Wheezy. The first problem is that the Vim which comes with Debian does not come precompiled with Python, which UltiSnips needs. The second problem is that the version of the Vim is too old and is unsupported by UltiSnips.

First uncomment or add the following line to your /etc/apt/sources.list. This is because the version of Vim in the default repository is too old. You can read more about backports here.

deb http://ftp.debian.org/debian wheezy-backports main

Run the following commands:

sudo apt-get update # always remember to do this
sudo apt-get remove vim # remove the old Vim which doesn't have python
sudo apt-get remove vim-common # you can try to do this without this line. I personally needed to this.
sudo apt-get -t wheezy-backports install vim-nox # Installing the correct compiled version of Vim which has Python.

After this you can install UltiSnips normally by using the official guide: https://github.com/SirVer/ultisnips

Code

Joker.com automation

Posted by Kevin Kivi on

I’ve been working on automation for joker.com, so that I can unlock domains and order the auth-id (epp-key, transfer key) faster. It uses the joker.com API. I wrote it in node.js. It is still in development and I will add more functionality to this application.

Here is the npm page: https://www.npmjs.com/package/joker-auto

Github: https://github.com/nake89/joker-nodejs

This is a node.js script for automating Joker.com services. Still in early development. Currently only logs you in and unlocks a domain and gives you the auth-id (transfer key) of a domain.

npm i joker-auto -g

Add your joker.com login credentials to the joker.js file.

joker-auto login

This command returns the temporary (1h) session id.

joker-auto getkey domain.com <INSERT THE SESSION ID HERE>

This will queue the auth-id order. You will have to wait a bit. You will get the queue ID here.

joker-auto showkey <INSERT THE QUEUE ID HERE> <INSERT THE SESSION ID HERE>

If you do this too fast. You will not get the auth-id. Patience is key.