NerdOfLinux's Tech Blog https://www.nerdoflinux.com Tech Blogs are Cool Sat, 26 May 2018 11:00:37 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.6 https://i0.wp.com/www.nerdoflinux.com/wp-content/uploads/2017/08/cropped-IMG_6747.jpg?fit=32%2C32&ssl=1 NerdOfLinux's Tech Blog https://www.nerdoflinux.com 32 32 134050150 OpenSSL command https://www.nerdoflinux.com/tech/linux-tutorials/openssl-command/ https://www.nerdoflinux.com/tech/linux-tutorials/openssl-command/#respond Sat, 26 May 2018 11:00:37 +0000 http://nerdoflinux.com/?p=3766 The OpenSSL command is built into most Linux distributions, and can be used for encrypted and encoding things. Encrypting a message OpenSSL can be used to encrypt and decrypt messages. The following command will encrypt a message: echo "Hello" | openssl enc -bf -pass pass:abc123 I chose to use blowfish, […]

The post OpenSSL command appeared first on NerdOfLinux's Tech Blog.

]]>
The OpenSSL command is built into most Linux distributions, and can be used for encrypted and encoding things.

Encrypting a message

OpenSSL can be used to encrypt and decrypt messages. The following command will encrypt a message:

echo "Hello" | openssl enc -bf -pass pass:abc123

I chose to use blowfish, but you can get a list of all available ciphers with:

openssl --show-ciphers

However, you’ll notice it gives you non-unicode characters:

Salted__XᲡ��N��2�[���

To fix this, simply tell OpenSSL to use base64 encoding:

echo "Hello" | openssl enc -a -bf -pass pass:abc123

this will return something like:

U2FsdGVkX1+gY6RSJ4HUntrKFFzJbdQt

but, it will be different each time because OpenSSL adds a salt to make it harder to crack.

Decrypting a message

To decrypt a message, simple run the same thing, but with the -d flag:

echo "U2FsdGVkX1+gY6RSJ4HUntrKFFzJbdQt" | openssl enc -d -a -bf -pass pass:abc123

this should return:

Hello

Encrypting a file

To encrypt a file, you simply need to add a few options to OpenSSL. First, make a file:

echo "test" > test.txt

then, let’s encrypt it with blowfish:

openssl enc -a -bf -in test.txt -out test.enc -pass pass:abc123

The file test.enc will now contain:

U2FsdGVkX19l7MAkosqzp+oAjBeaRM3P

While you don’t really need to use base64 since it’s in a file, I still recommend it because it makes copying and pasting possible.

Decrypting a file

Simply run the same command to encrypt, but with the -d flag.

openssl enc -d -a -bf -in test.enc -out test.dec -pass pass:abc123

and, check test.dec, ad you should see:

test

This means everything worked! Also, if you don’t use the -pass flag, OpenSSL will automatically ask you for the password, so it’s not needed, but it makes copying and pasting the commands easier.

Hashing

If you ever need to hash something, to verify it hasn’t been tampered with, OpenSSL can also help you out. Simply use openssl dgst:

echo "test" | openssl dgst -sha512

will return:

(stdin)= 0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123

there are other hashing algorithms, but SHA512 is currently the most secure one.

Hashing files

To get the hash of a file, simply use the cat command, as I couldn’t find a way to hash a file directly with OpenSSL, as the help page returns:

options are
-c              to output the digest with separating colons
-r              to output the digest in coreutils format
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-hmac arg       set the HMAC key to arg
-non-fips-allow allow use of non FIPS digest
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-keyform arg    key file format (PEM or ENGINE)
-out filename   output to filename rather than stdout
-signature file signature to verify
-sigopt nm:v    signature parameter
-hmac key       create hashed MAC with key
-mac algorithm  create MAC (not neccessarily HMAC)
-macopt nm:v    MAC algorithm parameters or key
-engine e       use engine e, possibly a hardware device.
-md4            to use the md4 message digest algorithm
-md5            to use the md5 message digest algorithm
-ripemd160      to use the ripemd160 message digest algorithm
-sha            to use the sha message digest algorithm
-sha1           to use the sha1 message digest algorithm
-sha224         to use the sha224 message digest algorithm
-sha256         to use the sha256 message digest algorithm
-sha384         to use the sha384 message digest algorithm
-sha512         to use the sha512 message digest algorithm
-whirlpool      to use the whirlpool message digest algorithm

so, just run:

cat file | openssl dgst -sha512

Also, if you want to get just the hash, run:

echo "test" | openssl dgst -sha512 | cut -d " " -f 2

which returns:

0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123

instead of (stdin)= and then the hash.

The post OpenSSL command appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/openssl-command/feed/ 0 3766
The ports I use and for what https://www.nerdoflinux.com/tech/linux-tutorials/ports-used-why/ https://www.nerdoflinux.com/tech/linux-tutorials/ports-used-why/#respond Thu, 24 May 2018 11:00:37 +0000 http://nerdoflinux.com/?p=3741 Since I spend the majority of every day at my school, which only has two ports open, I need to be creative with how I use them. First, let me start off by saying my school is terrible with restricting access to anything. Yes, they block 99% of the internet […]

The post The ports I use and for what appeared first on NerdOfLinux's Tech Blog.

]]>
Since I spend the majority of every day at my school, which only has two ports open, I need to be creative with how I use them.

First, let me start off by saying my school is terrible with restricting access to anything. Yes, they block 99% of the internet on their computers and WiFi, but everything that goes through port 443 or 80(aside from blocked websites) works just fine.

These are the only ports accessible by the internet, I have more ports only available for localhost(such as MySQL).

UDP

53 and 1194

I have OpenVPN configured on port 53, and port 1194 gets forwarded to port 53 via iptables. This is mainly as a backup in case SSLH crashes, as my school doesn’t block this port. However, some places throttle connections to UDP 53, which is understandable as you generally don’t do more than a few DNS queries per minute(much of the requests are cached), and UDP 53 is abused in amplification attacks. So, for the locations that don’t block UDP 1194, but throttle 53, I use 1194.

TCP

22

Similar to most servers, I have SSH listening on TCP 22. This is blocked at my school, so I also have SSH on other ports, but I’ll get to that in a bit. When I’m feeling too lazy to use my custom SSH ports, and port 22 isn’t blocked, it does make using SSH and SFTP a bit easier, as I don’t have to configure any options. Also, many tools that work on top of SSH only work(ok, only easily work) with the standard port(i.e. scp).

25

TCP port 25 is used for what’s is designed for: SMTP. This is for sending and receiving emails, although I believe there are two other ports, but 25 is used the most. The other ports for for TLS, but STARTTLS works on 25, so that’s what I use.

80

Next up, is TCP port 80. I have SSH listening here as well, in case 22 is blocked and SSLH down. This has already saved me a few times, mainly when I break SSLH’s config file 🙂 . TCP port 80 is generally used for HTTP, so it is mostly unblocked. CloudFlare redirects everything to HTTPS, so I have no need to have NGINX listening on TCP 80.

443

TCP port 443 is unblocked in 99.9% of places I’ve been to. I’ve only ever been to one place that prevented me from using OpenVPN over port 443. This is mainly because TCP 443 is the port used for HTTPS, and blocking it would brick the majority of the internet. I have SSLH configured to listen on this port, so I have the following services on port 443:

  • HTTP
  • HTTPS
  • SSH
  • OpenVPN

993

This is also used for email, but instead of receiving and sending, it’s for reading emails. This is for IMAPS, the secure version of IMAP.

995

This is additional for email, but is POP3s, another way of reading emails. This supports much less features than IMAP, and I mainly use it for Gmail’s import feature.

Why did I just reveal all these ports?

Some of you will probably think I just reduced the security of my VPS by showing which services I have on what ports, but I don’t agree. A port scan will show all standard ports, and while it will get the use wrong(i.e. say TCP 80 is for HTTP), you’ll still be able to tell what ports are open. Additionally, I have services running that will block IP addresses after brute-force attempts, and some iptables rules that will slow down attackers.

Please don’t try to hack my VPS, but if you do try, you’ll probably fail 🙂 , and get your IP reported.

The post The ports I use and for what appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/ports-used-why/feed/ 0 3741
How to install sshguard(with email notifications) https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-sshguard/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-sshguard/#respond Tue, 22 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3485 sshguard is a nice, smaller alternative to fail2ban that serves the same purpose: stop people and bots from brute-forcing their way into your server. The biggest difference is that sshguard uses significantly less resources than fail2ban, which I believe is due to the fact that it’s written in C, and […]

The post How to install sshguard(with email notifications) appeared first on NerdOfLinux's Tech Blog.

]]>
sshguard is a nice, smaller alternative to fail2ban that serves the same purpose: stop people and bots from brute-forcing their way into your server. The biggest difference is that sshguard uses significantly less resources than fail2ban, which I believe is due to the fact that it’s written in C, and is compiled rather than interpreted.

Installion

While you can just install with a simple:

sudo apt install sshguard

I found that this does not give the flexibility I want. I cannot configure sshguard to send emails upon blocking an IP, and the version in the repositories did not seem to actually block ips. So, I built it from the source, which wasn’t hard at all. Just run the following:

cd /tmp
wget https://goo.gl/DfBv9M -O sshguard.tar.gz
tar xzvf sshguard.tar.gz 
cd sshguard-2.1.0/
./configure --prefix=/usr/local
make
sudo make install

Configuration

Now, go to /usr/local/libexec, and edit the sshg-fw-iptables file to your liking. I added:

printf "Dear $(hostname) admin,\nThe ip address $1 has tried to hack into your VPS. sshguard has blocked it, and here is some IP info:\n\n$(/usr/local/bin/iplookup $1 silent)\n\nIf you would like to report this IP, click on the following link: https://www.abuseipdb.com/report?ip=$1\n\nRegards,\nYour Linux VPS" | mail -s "$1 blocked by sshguard" -a "From: VPS<sshguard@$(hostname)>" admin@yourdomain.com

to the fw_block function. This script utilizes my iplookup script, and sends an email containing a link to report the IP.

Next, copy the sample config file:

sudo cp /tmp/sshguard-2.1.0/examples/sshguard.conf.sample /usr/local/etc/sshguard.conf

and edit it to your liking. Be sure to at least set the following:

BACKEND="/usr/local/libexec/sshg-fw-iptables"
FILES="/var/log/auth.log"

and everything else can stay the default. Now, to add this as a service, run:

sudo cp /tmp/sshguard-2.1.0/examples/sshguard.service /lib/systemd/system/sshguard.service

and comment out the following line:

ExecStartPre=-/usr/sbin/iptables -N sshguard

Now, run:

sudo systemctl daemon-reload

and restart the service:

sudo service sshguard restart

To get sshguard to run on boot, just run:

sudo systemctl enable sshguard

To check up on how sshguard is doing, just run:

sudo service sshguard status

This will show you some IP addresses that are attacking your server, and those that have been blocked by sshguard.

Update: I have disabled email notifications because sshguard will send multiple notifications for the same IP. This is not sshguard’s fault, but it got really annoying.

iptables

Now, you need to configure the iptables rules. This is fairly simple; all you need is to run the following:

sudo iptables -N sshguard
sudo iptables -I INPUT -j sshguard
sudo ip6tables -N sshguard
sudo ip6tables -I INPUT -j sshguard

Basically, this just sends everything through the sshguard rules before allowing or denying any IP addresses.

Sources: sshguard

The post How to install sshguard(with email notifications) appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-sshguard/feed/ 0 3485
Easter Eggs https://www.nerdoflinux.com/tech/linux-tutorials/easter-eggs/ https://www.nerdoflinux.com/tech/linux-tutorials/easter-eggs/#respond Sun, 20 May 2018 11:00:37 +0000 http://nerdoflinux.com/?p=3519 If you liked my post about fun terminal commands, you’ll also probably enjoy this one. apt If you ever noticed that apt --help ends with: This APT has Super Cow Powers. you probably wondered what on earth that means. Well, the command apt moo may shed some light on this: […]

The post Easter Eggs appeared first on NerdOfLinux's Tech Blog.

]]>
If you liked my post about fun terminal commands, you’ll also probably enjoy this one.

apt

If you ever noticed that apt --help ends with:

This APT has Super Cow Powers.

you probably wondered what on earth that means. Well, the command apt moo may shed some light on this:

                 (__) 
                 (oo) 
           /------\/ 
          / |    ||   
         *  /\---/\ 
            ~~   ~~   
..."Have you mooed today?"...

Aptitude

On the subject of moos, aptitude --help contains:

This aptitude does not have Super Cow Powers.

So, if you run aptitude moo, you get:

There are no Easter Eggs in this program.

I think not aptitude -v moo:

There really are no Easter Eggs in this program.

I’m not so sure aptitude -vv moo:

Didn't I already tell you that there are no Easter Eggs in this program?

Yes, but aptitude -vvv moo:

Stop it!

Why? aptitude -vvvv moo:

Okay, okay, if I give you an Easter Egg, will you go away?

Maybe aptitude -vvvvv:

All right, you win.

                               /----\
                       -------/      \
                      /               \
                     /                |
   -----------------/                  --------\
   ----------------------------------------------

Yay! One more aptitude -vvvvvv moo

What is it?  It's an elephant being eaten by a snake, of course.

Ok, fine.

For you vim fans:

If you’ve ever pondered the meaning of life, run vim, and then :help 42:

What is the meaning of life, the universe and everything?  *42*
Douglas Adams, the only person who knew what this question really was about is
now dead, unfortunately.  So now you might wonder what the meaning of death
is...

==============================================================================

Next chapter: |usr_43.txt|  Using filetypes

emacs

This is fun if you’re ever using a mac as emacs is built in to the terminal, I think. There are quite a few programs built in, which you can list with:

ls /usr/share/emacs/*/lisp/play

I got:

5x5.elc       dissociate.elc  gomoku.elc     mpuz.elc       tetris.elc
animate.elc   doctor.elc      handwrite.elc  pong.elc       zone.elc
blackbox.elc  dunnet.elc      hanoi.elc      snake.elc
bubbles.elc   fortune.elc     landmark.elc   solitaire.elc
cookie1.elc   gamegrid.elc    life.elc       spook.elc
decipher.elc  gametree.elc    morse.elc      studly.elc

I like pong, so I ran emacs, then Esc followed by x, then pong. I also tried tetris. My favorite was doctor(what I type begins with a --):

I am the psychotherapist.  Please, describe your problems.  Each time
you are finished talking, type RET twice.
-- I like pie. RET RET

Why do you say you like pie ret ret?
-- Why not?

What do you think?
-- Pie tastes good.

Is it because of your plans that you say pie tastes good?
-- No, are you even paying attention?

Maybe your life has something to do with this.
-- No, really?

What makes you believe really?
-- yes

I see...  Well, are you sure that this is so?
-- yes

Yes, hmmm... so, do you really think this is so?
-- yes

I understand.  So what makes you think this is so?

and I got bored.

Source: DigitalOcean | a bunch of other sites I don’t have the links to 🙂

The post Easter Eggs appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/easter-eggs/feed/ 0 3519
How to bypass DPI for OpenVPN https://www.nerdoflinux.com/tech/linux-tutorials/how-to-bypass-dpi-for-openvpn/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-bypass-dpi-for-openvpn/#respond Fri, 18 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3502 If you’ve ever been on a network that blocks OpenVPN, even when running on TCP 443, you might think you’r e out of options. Well, you’re not, because you can hide OpenVPN traffic behind an SSH tunnel. This makes all traffic appear to be SSH, which has a lower likelihood […]

The post How to bypass DPI for OpenVPN appeared first on NerdOfLinux's Tech Blog.

]]>
If you’ve ever been on a network that blocks OpenVPN, even when running on TCP 443, you might think you’r e out of options.

Well, you’re not, because you can hide OpenVPN traffic behind an SSH tunnel. This makes all traffic appear to be SSH, which has a lower likelihood of being blocked.

DPI

DPI, or Deep Packet Inspection, is a method of filtering packets that can determine the type of packet it is(i.e. HTTPS, OpenVPN,SSH, etc.). This is often used to restrict access to certain services, making it harder to bypass the firewall. However, if one protocol is not blocked, it can sometimes be used to mask another protocol that is blocked, such as SSH encapsulating OpenVPN traffic.

Creating the SSH tunnel

Creating the SSH tunnel is quite simple. All you need to do is make sure you have OpenVPN running on a TCP port(such as TCP 443), and run the following command:

ssh -L 1194:localhost:1194 server 

Replace server with what you usually use to log in(i.e. bob@ssh.domain.com). This will create a tunnel listening on localhost 1194/tcp and forward it to the remote server on port 1194/tcp.

Setting up OpenVPN

Next, you’ll need to configure OpenVPN to actually use the SSH tunnel instead of connecting directly to the external server. Simply edit your .ovpn file, and replace the remote line(s) with:

proto tcp
remote localhost 1194

This will tell OpenVPN to send all traffic through the SSH tunnel.

Why not just an SSH tunnel?

Well, one reason is that when using OpenVPN through SSH, all traffic is sent through the VPN, instead of just the applications you’ve configured to go through the SSH tunnel. Another reason is mobile support; there are many SSH apps that support setting up SSH tunnels, but very few(or no) iOS apps support using a SOCKS proxy.

Setting this up on iOS

I needed to set this up on iOS a few days ago, so here’s how I did it:

  1. Install the Termius app, and set up local port forwarding with the following settings:
    • Host: your server
    • Port from: 1194
    • Destination: your server’s IP address/hostname
    • Port to: 1194
  2. Edit the .ovpn file and email it to your phone, then import it into the OpenVPN app
  3. Click on the port forwarding setting you just created in Termius to enable it
  4. Try to connect to your VPN

You should now be able to bypass firewalls on both your iPhone/iPad/iPod touch and any Linux-based operating system. If you’re on Windows, then I guess you can use Putty, but you should really switch to Linux 🙂

Sources: redfern.me

The post How to bypass DPI for OpenVPN appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-bypass-dpi-for-openvpn/feed/ 0 3502
A rant about the GDPR https://www.nerdoflinux.com/tech/internet/a-rant-about-the-gdpr/ https://www.nerdoflinux.com/tech/internet/a-rant-about-the-gdpr/#respond Wed, 16 May 2018 11:00:37 +0000 http://nerdoflinux.com/?p=3528 I’m not the only one that doesn’t like the GDPR, but I’ll put my reasons here. What counts as personal data Under the GDPR,IP addresses count as personal data. Some sources just say IP addresses, while others say IP addresses only if it can be combined with other information to […]

The post A rant about the GDPR appeared first on NerdOfLinux's Tech Blog.

]]>
I’m not the only one that doesn’t like the GDPR, but I’ll put my reasons here.

What counts as personal data

Under the GDPR,IP addresses count as personal data. Some sources just say IP addresses, while others say IP addresses only if it can be combined with other information to figure out who the person is. Aside from the fact that confusion about something as important as this means the EU needs to clarify things a bit more, IP addresses are never personally identifiable information.

Most computers out there are behind a router. The router has a public IP address and is connected to the internet. When a computer connected to the router want to access a website, the website only sees the IP address of the router. This means that if multiple people use the same router, then there is no way to figure out who did what on a website, with just the IP address. Also, how are websites supposed to know if a person is in the EU? What if they’re in the EU, but using a VPN in the US? What if they’re in the US, but using a VPN in the EU?

Companies will just block all people from the EU

If it’s too expensive for a company to be GDPR compliant, they’ll likely just not allow anyone in the EU to access they’re website and/or services. Blocking IP ranges is much cheaper than paying developers and wasting hours or days on adding opt-in forms. Also, how the f*** are companies supposed to store a user’s opt-in or opt-out without cookies?

Opt-ins

The user on reddit said this best:

And as a consumer, I also hate it. I hate it that I now am going to have to go through all sorts of legal stuff when I just want to do something simple on a simple European website. “Check this box to consent to this. Check this box to consent to this. Please check this box. Don’t forget to log into your account at least once every x days, or we will delete your data to comply with legal requirements! Please check this box saying that you consent to our use of cookies on our system. Please read this page in its entirety so that you understand your rights before registering. Please check this box to allow us to retain this data.” For example… just to even make a post on blogspot…I gotta read through all sorts of blurbs and check agreement boxes to indicate that I’m compliant with EU law in my blog, and that as a user, I understand EU law and how it applies to me. As a US citizen. What’s not wrong with that picture?!

The GDPR basically requires that users opt-in to anything even somewhat related to personally identifiable information. All of which is useless, because 90% of web servers probably have their standard logs turned on. Also, what if there are two users on the same IP address, and one consents to being tracked, but one doesn’t? How, as a website owner, am I supposed to prove I only have the IP address of the one user that did consent?

Money

Most blog owners DO NOT have the s***loads of money required to make their blogs GDPR compliant. Is the EU really going to sue every blog that isn’t compliant. Really? This also will lead to way less competition. If you don’t already have a business with tons of money, you won’t be able to become GDPR compliant. So, start-ups will need more funding, and have less money available to focus on their business because they spent all their money on making opt-in forms for their website. Opt-in forms are not that simple, they require a lot of backend and frontend code to work.

Common Sense

Seriously, if you enter your email on a form on a website, assume it will be stored. Why should I have to add a checkbox to make sure people understand that?

Privacy on the internet is not possible

The internet was not designed with privacy in mind, and it’s too late to change it now. If you want your privacy, then don’t use the internet.

Alternatives

I’m fine with a regulation that analytics must not track people with “Do Not Track” turned on, and that there should be a summary of the privacy policy that’s easy to understand. But the GDPR is just ridiculous, and will likely fail pretty fast, after 99% of the internet simply blocks the EU from accessing their website to save money.

Sources:

The post A rant about the GDPR appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/a-rant-about-the-gdpr/feed/ 0 3528
Fun shell commands https://www.nerdoflinux.com/tech/linux-tutorials/fun-shell-commands/ https://www.nerdoflinux.com/tech/linux-tutorials/fun-shell-commands/#respond Mon, 14 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3482 If you’re ever bored, this post covers some fun shell commands! sl sl, short for “Steam Locomotive” is a fun little command that display[s] animations aimed to correct users who accidentally enter sl instead of ls. It can be installed with: sudo apt install sl and has some cool options. […]

The post Fun shell commands appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re ever bored, this post covers some fun shell commands!

sl

sl, short for “Steam Locomotive” is a fun little command that

display[s] animations aimed to correct users who accidentally enter sl instead of ls.

It can be installed with:

sudo apt install sl

and has some cool options. My personal favorite is:

sl -alF

which makes a smaller, flying train appear on your screen. By default, ctl + c won’t work, so I like to create an alias:

alias sl="sl -e"

which makes it less annoying.

cal

I bet you didn’t know you could print a calendar from bash! Just use the cal command, and you’ll get something like:

      May 2018        
Su Mo Tu We Th Fr Sa  
       1  2  3  4  5  
 6  7  8  9 10 11 12  
13 14 15 16 17 18 19  
20 21 22 23 24 25 26  
27 28 29 30 31        

or, you can print the whole year with cal -y:

     January               February               March          
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6               1  2  3               1  2  3  
 7  8  9 10 11 12 13   4  5  6  7  8  9 10   4  5  6  7  8  9 10  
14 15 16 17 18 19 20  11 12 13 14 15 16 17  11 12 13 14 15 16 17  
21 22 23 24 25 26 27  18 19 20 21 22 23 24  18 19 20 21 22 23 24  
28 29 30 31           25 26 27 28           25 26 27 28 29 30 31  


       April                  May                   June          
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
 1  2  3  4  5  6  7         1  2  3  4  5                  1  2  
 8  9 10 11 12 13 14   6  7  8  9 10 11 12   3  4  5  6  7  8  9  
15 16 17 18 19 20 21  13 14 15 16 17 18 19  10 11 12 13 14 15 16  
22 23 24 25 26 27 28  20 21 22 23 24 25 26  17 18 19 20 21 22 23  
29 30                 27 28 29 30 31        24 25 26 27 28 29 30  


        July                 August              September        
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
 1  2  3  4  5  6  7            1  2  3  4                     1  
 8  9 10 11 12 13 14   5  6  7  8  9 10 11   2  3  4  5  6  7  8  
15 16 17 18 19 20 21  12 13 14 15 16 17 18   9 10 11 12 13 14 15  
22 23 24 25 26 27 28  19 20 21 22 23 24 25  16 17 18 19 20 21 22  
29 30 31              26 27 28 29 30 31     23 24 25 26 27 28 29  
                                            30                    

      October               November              December        
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6               1  2  3                     1  
 7  8  9 10 11 12 13   4  5  6  7  8  9 10   2  3  4  5  6  7  8  
14 15 16 17 18 19 20  11 12 13 14 15 16 17   9 10 11 12 13 14 15  
21 22 23 24 25 26 27  18 19 20 21 22 23 24  16 17 18 19 20 21 22  
28 29 30 31           25 26 27 28 29 30     23 24 25 26 27 28 29  
                                            30 31         

Unlike the sl command, this one can actually be useful 🙂

Fun with telnet

This one is from lifehacker, and shows a fun little Star Wars scene in ASCII. Unfortunately, I couldn’t find anything for Star Trek, which we all know is better 🙂 . Anyways, to get it, just run:

telnet towel.blinkenlights.nl

I’m pretty sure telnet comes pre-installed, but if not, run:

sudo apt install telnet

Browse the web

If you feel like browsing the web without using a GUI, there’s a simple way to do that: w3m. Simply run:

sudo apt install w3m

and then use

w3m https://www.nerdoflinux.com

or any other site, and you’ll see the website appear in your terminal. You navigate using the arrow keys, and use enter to press links. w3m even supports entering things into forms, so you can technically log in to websites! If you use xterm, you can even get support for images.

List every single file

This is more of a way to annoy someone, but it’s still fun. Simply run:

ls -laR

and watch as every single file on your server is listed. Keep in mind that this will slow down your server, so be ready with ctl+c!! Or, you can also just run the yes command to repeat anything over and over, such as:

yes NerdOfLinux

will print NerdOfLinux forever, until you exit the program.

history -s

The history -s command will add something to your command history. You can abuse this with a simple loop:

x=100
while [ $x -ge 0 ]; do history -s $(openssl rand -hex 8); x=$(expr $x - 1); done

and this will add 100 random strings to the history. This is useful if someone is working on something using the up arrow often, and they leave their terminal logged in 🙂 . Unfortunately, this does not appear to fill up command logs 🙁 .

The post Fun shell commands appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/fun-shell-commands/feed/ 0 3482
How to install Redis on Ubuntu https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-redis-on-ubuntu/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-redis-on-ubuntu/#respond Sat, 12 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3477 Redis is one of the many in-memory database thingies that makes stuff faster. I use the Redis Object Cache plugin for WordPress, but you obviously need a Redis server for that. This tutorial will be on how to install redis on Ubuntu server. Install The installation is pretty simple, all […]

The post How to install Redis on Ubuntu appeared first on NerdOfLinux's Tech Blog.

]]>
Redis is one of the many in-memory database thingies that makes stuff faster.

I use the Redis Object Cache plugin for WordPress, but you obviously need a Redis server for that. This tutorial will be on how to install redis on Ubuntu server.

Install

The installation is pretty simple, all you need is to install two packages; one for the actual server, and another one for PHP. Both can be installed with:

sudo apt install redis-server php-redis

You should now be able to run:

sudo service redis-server restart

and not get an error 🙂 .

Configuration

I prefer to use Unix sockets because they’re faster than TCP if you’re on the same system. Since I only own one VPS, I chose to use redis on a socket. To do this, you’ll need to edit the redis config file:

sudo nano /etc/redis/redis.conf

and look for the following section:

# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
# 
#unixsocket /var/run/redis/redis.sock

All you need to do is uncomment the unixsocket line:

# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
# 
unixsocket /var/run/redis/redis.sock

Then, restart the redis-server. Next, you’ll need to configure the plugin, which can be done by adding the following line to wp-config.php:

define('WP_REDIS_SCHEME', 'unix');
define('WP_REDIS_PATH', '/var/run/redis/redis.sock');

Permissions

You’ll now realize that the plugin won’t work for some reason. This is due to the fact that the socket permissions are set to the redis user and not the web-server user. This can be easily fixed with:

sudo chown www-data:www-data /var/run/redis/redis.sock

After running the command, check again. You should now have a fully functional redis install that can be accessed via a unix socket from PHP, or any other process that runs as www-data, such as python(if you’re using that to power a site).

Checking RAM usage

To check how much RAM the redis server is using(i.e. check if it’s doing anything), you can run the following command:

ps -C redis-server v

which will return something along the lines of(the RSS is the memory):

  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
21793 ?        Ssl    4:50   1788     0 65004  7220  1.4 /usr/bin/redis-server 1

I have no idea what the arguments do, but I found it somewhere on lowendbox, and it works 🙂 . It gives you the size in Kilobytes, so just run the following command to convert to Megabytes:

expr 7220 / 1024

The post How to install Redis on Ubuntu appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-redis-on-ubuntu/feed/ 0 3477
Which CloudFlare SSL option should I use? https://www.nerdoflinux.com/tech/internet/which-cloudflare-ssl-option-should-i-use/ https://www.nerdoflinux.com/tech/internet/which-cloudflare-ssl-option-should-i-use/#respond Thu, 10 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3456 Did you know that websites with HTTPS are ranked higher on some search engines, including Google? Setting up HTTPS can seem difficult and expensive, especially if you’re not a tech person, and just want to blog. However, not having HTTPS will make it harder for your site to be near […]

The post Which CloudFlare SSL option should I use? appeared first on NerdOfLinux's Tech Blog.

]]>
Did you know that websites with HTTPS are ranked higher on some search engines, including Google?

Setting up HTTPS can seem difficult and expensive, especially if you’re not a tech person, and just want to blog. However, not having HTTPS will make it harder for your site to be near the top of Google searches, and it makes your site seem less professional. Many shared hosting providers do not let you use Let’s Encrypt to get a free SSL certificate, and require you to pay them large amounts of money to have SSL set up. So, you switch to CloudFlare to enable SSL. Great job, but which SSL option is the best?

Flexible SSL

Flexible SSL is designed to make deploying SSL as easy as possible. The server does NOT need to be configured to work with SSL, and does not even require a self-signed certificate. It works by encrypting all data between visitors and the nearest CloudFlare data center, but from there to your server, it’s unencrypted. CloudFlare has a good description of this on their SSL page:

While not as secure as the other options, Flexible SSL does protect your visitors from a large class of threats including public WiFi snooping and ad injection over HTTP.

Basically, Flexible SSL is easy to set up, but is not as secure as the other two options. While it does improve security, and possible your SEO a bit, if the connection between CloudFlare and your server is compromised, all user data can be stolen in unencrypted form.

Full SSL

Full SSL is also quite easy to deploy, but requires the server to be configured with at least a self-signed SSL certificate, and be listening on TCP 443. All traffic is encrypted between your visitors and CloudFlare, and then from CloudFlare to your server. This way, even if your server’s connection to the outside world is compromised, all the data available to snoopers is useless because it’s encrypted(hopefully with modern ciphers). This mode protects your visitors from attacks from being on open WiFi networks, and attacks that are between the CloudFlare datacenter and your server.

Full SSL(strict)

The third free options is Full SSL(strict). This mode is most similar to Full, but it requires a valid SSL certificate, or one signed by them. This ensures that not only all data is encrypted to your server, but also that no hacker is pretending to be your server. As forging an SSL certificate is nearly impossible, this is the most secure method CloudFlare offers.

Which one to use?

Well, it depends on the kind of site you run.

Is your site a blog without comments or user logins? then Flexible SSL will be just fine, as no important information is being sent.

Is your site a blog that has users comment and/or login? then I’d recommend at least Full SSL mode to ensure their password is encrypted until it reaches your server.

Is your site something like an e-commerce site? then two things: one, shame on you for using a free CloudFlare plan 🙂 , and two, please use Full SSL(Strict) with at least a custom SSL certificate.

Sources: CloudFlare

The post Which CloudFlare SSL option should I use? appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/which-cloudflare-ssl-option-should-i-use/feed/ 0 3456
How to speed up your site(Part 2) https://www.nerdoflinux.com/tech/wordpress/how-to-speed-up-your-sitepart-2/ https://www.nerdoflinux.com/tech/wordpress/how-to-speed-up-your-sitepart-2/#respond Tue, 08 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3441 My last post was about how to speed up your site in general, so, as promised, here is specifically how to speed up WordPress. Caching WordPress, like many other content management systems, using PHP and MySQL as the backend to create pages. This works great on small sites as all […]

The post How to speed up your site(Part 2) appeared first on NerdOfLinux's Tech Blog.

]]>
My last post was about how to speed up your site in general, so, as promised, here is specifically how to speed up WordPress.

Caching

WordPress, like many other content management systems, using PHP and MySQL as the backend to create pages. This works great on small sites as all changes and comments are displayed immediately, but on larger sites, processing PHP and MySQL requests can kill your server pretty fast. So, the need for WordPress caching was created, and there are many plugins out there to do it for you.

My recommendation is WP Super Cache, as it’s really simple to set up, and does make a noticeable difference in page loading time. All you need to do is install the plugin, activate it, and enable it in the WP Super Cache menu, which is a sub-menu of the settings tab in the admin panel. You can go into the advanced settings and enable the expert caching mode, which does further decrease server load, but this will not work for everyone, so I don’t recommend it unless you know how to configure it for your specific web server(if you use Apache, .htaccess rules are generated).

Minification

Minifying your site may sound like a lot of work, but it really isn’t. All you have to do is install a plugin called Autoptimize, and configure it. After you install and activate the plugin, you will see a new tab in the top bar of the admin panel called Autopimize with a green circle next to it. Click on that, and you will be taken to it’s settings page.

Now, enable the options one by one, and check your website each time. If one setting breaks your site, then disable it, but keep the other ones enabled. For the best performance, I recommend enabling the “inline and defer CSS” option, which will require you to show the advanced settings. You don’t have to put anything in the box, but you can put some critical CSS there so your site doesn’t appear broken as it’s loading.

CDN

If you can’t or don’t want to use CloudFlare, then there is another free option, for your images anyways. The CDN is called Photon, and requires you to install and activate the Jetapck plugin. This is completely free, but does require a WordPress.com account, and sharing a bit of information about your site with them.

After setting up Jetpack, which takes less than a minute, go into the Jetpack settings menu. This can be accessed by hovering over the Jetpack tab on the left section of the Admin Panel, and clicking on the settings option that appears. Then, scroll down to the “Speed up your site” section,and enable the “Serve images from our servers” option, which may or may not be already enabled. Also, in the same section, I also recommend enabling the “Lazy load images” option, which will only load images as they are made viewable within the browser window, decreasing the initial load time of your site(this won’t make much of a difference after the images are in the browser cache).

CloudFlare

I still recommend using CloudFlare, even if you choose to use the plugins. CloudFlare’s caching and minifying options will NOT interfere with the plugins, and CloudFlare provides more than just a CDN. They also protect your site against DDoS attacks, and other WordPress attacks. They have a free-for-life plan which will work for most people, until your site grows enough to make you more than enough money to cover their other plans, which further increase performance.

W3 Total Cache

You can replace WP Super Cache with W3 Total Cache, but W3 Total Cache is more complicated to set up. I would recommend still leaving the minification to Autoptomize as it will also defer the scripts, decreasing the time until the essence of the page is displayed.

Update– I recently switched to the Breeze caching plugin by Cloudways, and it handles caching and minification.

The post How to speed up your site(Part 2) appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/how-to-speed-up-your-sitepart-2/feed/ 0 3441
How to speed up your site(Part 1) https://www.nerdoflinux.com/tech/internet/how-to-speed-up-your-sitepart-1/ https://www.nerdoflinux.com/tech/internet/how-to-speed-up-your-sitepart-1/#respond Sun, 06 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3436 One of the most important things about running a website is having low loading times. Why? The answer to this is easy: people expect your site to load fast. If your site takes more than a few seconds to load, you lose a lot of potential visitors. In fact: In […]

The post How to speed up your site(Part 1) appeared first on NerdOfLinux's Tech Blog.

]]>
One of the most important things about running a website is having low loading times.

Why?

The answer to this is easy: people expect your site to load fast. If your site takes more than a few seconds to load, you lose a lot of potential visitors. In fact:

In a study done by Akamai, about half of web users expect a site to load in 2 seconds or less. If it isn’t loaded within 3 seconds, those users tend to abandon the site.

Google even uses site speed as part of their SEO ranking equation thing.

How?

I’m sure you want to know how to speed up your site after those two sentences in the why section 🙂 . Well, anyways, here they are:

Use a CDN

If you’re too lazy to install and configure plugins, or just aren’t using WordPress, this can work fine as the only step you do, and will probably have one of the biggest impact of all these steps. Basically, what a CDN does is take the contents of your site, and puts them in tons of data centers all throughout the world. Then, when someone makes a request to one of the CDN-hosted contents, requests are routed to the nearest physical location, decreasing the time it takes to get said contents.

If you’re like me and don’t want to change all your image URL’s to point to a CDN, then I recommend CloudFlare. All you need to do is make a free account, and point your domain to them. Then, all traffic flows through them, and their complex systems take care of all the caching magic. Additionally, they cache some of your pages(such as the home page) every now and then to serve to visitors if your server is down, or takes too long to respond.

Browser Caching

This is also really easy to set up, and can have huge performance benefits for visitors(after the first page load). Even if you run a blog where you post daily, there are still a lot of resources that don’t change that often, such as images, JavaScript, and CSS. Browser caching is basically telling your visitor’s browser to store those files locally for minutes, hours, days, weeks, etc., so the next time they’re requested, the browser has the files available and does not need to make another HTTP request. This also decreases load on your server as less requests have to be made, because a large portion will be cached on the visitor’s computer.

If you don’t know how to set this up, the easiest way is through CloudFlare. CloudFlare has an option under the caching menu to set the browser cache expiration date. The cool thing about doing this through CloudFlare is that they use whichever expiration time is larger, what you set on the dashboard, or your server’s original expiration date.

Minification

Minification is basically taking all the parts out of your website that aren’t needed to make it function. When writing the HTML, Stylesheets, or JavaScript of a website, many developers will make newlines and comments to make the code easier to understand and update. The problem with this is that all the comments and newlines take up space, and increase the amount of information the server has to send, increasing page load time. And, comments and newlines are not needed by the browser to understand how to render the page.

Similar to browser caching, CloudFlare can also take care of this for you 🙂 . Simply go to the speed tab, and the first section, called auto-minify, has three checkboxes for different things to minify. I recommend you select all of them, but be sure to check it doesn’t break your site. Most of the time nothing breaks, but in the rare case that it does, you want to make sure the least amount of visitors possible see a broken site.

Compression

Compression allows you to send the same information, but using less bandwidth. I don’t exactly know how this works, but it basically just reduces all the resources on the server, and the browser expands the resources upon receiving them. This allows for faster page load times, as less information needs to be sent in the first place. Since compression reduces the amount of time it takes to send the information, it also means more room will be available on your server faster to serve more requests, in case your site is popular and has more concurrent visitors that your VPS can handle during peak hours.

Yet again, CloudFlare can take of this for you without requiring any changes server-side. Simply enable Brotli compression under the speed tab, and CloudFlare will do the compression magic for you. You can check if your site already uses compression(which it likely does) by using https://checkgzipcompression.com.

Sources: Impact

Please comment anything I left out, and my next post will be about how to optimize WordPress by installing a few plugins. Also, let me know if you’d prefer longer posts like this about once or twice a week, or my usual short post every other day.

The post How to speed up your site(Part 1) appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/how-to-speed-up-your-sitepart-1/feed/ 0 3436
Why you should (also) post on Medium https://www.nerdoflinux.com/tech/wordpress/why-you-should-also-post-on-medium/ https://www.nerdoflinux.com/tech/wordpress/why-you-should-also-post-on-medium/#respond Fri, 04 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3425 If you’re like me, and trying to get more traffic to your blog, then medium.com is a good place to start. What is Medium? Unlike WordPress, Medium is a hosted platform for writing. But, it’s also different from most hosted platforms such as Blogger, and WordPress.com. While it is possible […]

The post Why you should (also) post on Medium appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re like me, and trying to get more traffic to your blog, then medium.com is a good place to start.

What is Medium?

Unlike WordPress, Medium is a hosted platform for writing. But, it’s also different from most hosted platforms such as Blogger, and WordPress.com. While it is possible to have your own page through a publication, it’s more geared towards just a huge database of content. Readers read what they want, writers write what they want, and the Medium platform handles all the work of connecting readers with the authors they want.

Why not just use a normal blog?

Medium is often used to accompany a blog, although many people have found success by using it instead of a blog. Medium has an amazing importer tool that makes it easy to import your best posts. All you need is to make a free account, and you can start writing. If you use the importer, Medium will automatically add a link at the bottom with the original source, and add the proper html tags to tell search engines where the original content is from, so your SEO is not hurt at all. Plus, if readers really like one of your posts, they might click the link to your site, and subscribe to your blog 🙂

Why not use just Medium?

If you’re planning on starting a blog, then I recommend you check out Medium to see if it can work for you. The main problem is that they no longer offer custom domains, so you’re stuck with medium.com/publication name, which looks a bit less professional than yourdomain.com. But, if you were going to use Blogger or something like that anyways, that’s not a big problem. But, there’s no harm in having a blog and a Medium publication,as long as you remember to use the importer, and not just copy and paste your posts, which will hurt your SEO because of duplicate content.

If you’re interested, you can see an example of a Medium publication by checking out mine on medium.com/nerdoflinux.

Sources: Medium’s About Page

The post Why you should (also) post on Medium appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/why-you-should-also-post-on-medium/feed/ 0 3425
How to remove docker https://www.nerdoflinux.com/tech/linux-tutorials/how-to-remove-docker/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-remove-docker/#respond Wed, 02 May 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3421 I tried using docker for something that failed, so I wanted to remove it. The problem I thought a simple sudo apt purge docker.io would do the job for me. And it seemed like that, until: Removing docker.io (1.13.1-0ubuntu1~16.04.2) ... '/usr/share/docker.io/contrib/nuke-graph-directory.sh' -> '/var/lib/docker/nuke-graph-directory.sh' Purging configuration files for docker.io (1.13.1-0ubuntu1~16.04.2) ... […]

The post How to remove docker appeared first on NerdOfLinux's Tech Blog.

]]>
I tried using docker for something that failed, so I wanted to remove it.

The problem

I thought a simple

sudo apt purge docker.io

would do the job for me. And it seemed like that, until:

Removing docker.io (1.13.1-0ubuntu1~16.04.2) ...
'/usr/share/docker.io/contrib/nuke-graph-directory.sh' -> '/var/lib/docker/nuke-graph-directory.sh'
Purging configuration files for docker.io (1.13.1-0ubuntu1~16.04.2) ...

Nuking /var/lib/docker ...
  (if this is wrong, press Ctrl+C NOW!)

+ sleep 10

/var/lib/docker/nuke-graph-directory.sh: 64: /var/lib/docker/nuke-graph-directory.sh: shopt: not found
dpkg: error processing package docker.io (--purge):
 subprocess installed post-removal script returned error exit status 127
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)

More specifically, this line:

/var/lib/docker/nuke-graph-directory.sh: 64: /var/lib/docker/nuke-graph-directory.sh: shopt: not found
dpkg: error processing package docker.io (--purge):

For those of you that don’t know:

$ type shopt
shopt is a shell builtin

so, shopt is part of bash, so I edited /var/lib/docker/nuke-graph-directory.sh, and found that the first line was:

#!/bin/sh

and in /bin/sh:

type shopt
shopt: not found

Bam! I found the problem, now how do I fix it?

The solution

It’s quite simple actually, just edit the /var/lib/docker/nuke-graph-directory.sh file, and change the first line to:

#!/bin/bash

and run:

sudo apt purge docker.io

again.

This time, I got:

Nuking /var/lib/docker ...
  (if this is wrong, press Ctrl+C NOW!)

+ sleep 10

+ rm -rf /var/lib/docker/containers /var/lib/docker/image /var/lib/docker/network /var/lib/docker/nuke-graph-directory.sh /var/lib/docker/overlay2 /var/lib/docker/plugins /var/lib/docker/swarm /var/lib/docker/tmp /var/lib/docker/trust /var/lib/docker/volumes
dpkg: warning: while removing docker.io, directory '/etc/docker' not empty so not removed

a simple rm -rf /etc/docker did the job, and everything seems to be removed.

This is what I like about Linux

In Linux distros, you get a real error message if something goes wrong, not just “something went wrong”. If you know what you’re doing, fixing problems in Linux is way easier, thanks to amazing error and debugging logs. If something like this happened on Windows, you’d probably need at least a few days to find solutions, trying everything you see on the internet one by one. With Linux, read the error message, edit a file, and you’re done. Oh, and Linux is free Windows 10 is $100 🙂

The post How to remove docker appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-remove-docker/feed/ 0 3421
PyPy https://www.nerdoflinux.com/tech/linux-tutorials/pypy/ https://www.nerdoflinux.com/tech/linux-tutorials/pypy/#respond Mon, 30 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3406 Ever need more performance from that amazing python program you wrote? Or even if you just want to wait less while your Python programs does your math homework for you, PyPy is the solution. What is PyPy? I’ll let their documentation do the explaining: PyPy is a fast, compliant alternative […]

The post PyPy appeared first on NerdOfLinux's Tech Blog.

]]>
Ever need more performance from that amazing python program you wrote?

Or even if you just want to wait less while your Python programs does your math homework for you, PyPy is the solution.

What is PyPy?

I’ll let their documentation do the explaining:

PyPy is a fast, compliant alternative implementation of the Python language (2.7.13 and 3.5.3). It has several advantages and distinct features:

Speed: thanks to its Just-in-Time compiler, Python programs often run faster on PyPy.

Memory usage: memory-hungry Python programs … might end up taking less space than they do in CPython.

Compatibility: PyPy is highly compatible with existing python code. It supports cffi and can run popular python libraries like twisted and django.

Stackless: PyPy comes by default with support for stackless mode, providing micro-threads for massive concurrency.

How do I use this?

If you’re on Ubuntu, it’s really easy. Just run:

sudo apt install pypy

and you’re done. Now, instead of

python program.py

use

pypy program.py

or, change the shebang to:

#!/usr/bin/env pypy

My tests:

I created a simple factoring program in Python, which I didn’t spend a lot of time optimizing. With the standard, CPython program:

time python factoring.py 900 60
30 and 30

real    0m0.944s
user    0m0.827s
sys     0m0.011s

now, with pypy:

time pypy factoring.py 900 60
30 and 30

real    0m0.498s
user    0m0.076s
sys     0m0.092s

as you can see, the time is nearly cut in half by simply switching to pypy from CPython, without changing any code. PyPy is designed to be compatible with existing python code, and supports many of the highly-used and/or standard python libraries.

Disadvantages

There are a few problems with PyPy, however. The biggest one is that in order to enjoy faster run times, your users will also need to have PyPy installed. While this won’t be a problem for many, for people using systems they don’t have admin on (a Mac, for example), they’ll be stuck with the slower CPython. Also, while most programs are compatible, and I have not noticed anything it can’t run, there will likely be at least a few programs that PyPy can’t run.

Sources: PyPy.org

The post PyPy appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/pypy/feed/ 0 3406
How to replace SSH with Dropbear https://www.nerdoflinux.com/tech/linux-tutorials/how-to-replace-ssh-with-dropbear/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-replace-ssh-with-dropbear/#respond Sat, 28 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3310 This tutorial will show you how to install the dropbear SSH server on Ubuntu 16.04. This steps should, however, also work on newer versions of Ubuntu, and modern versions of Debian. Why? Here are a few reasons you might want to use dropbear instead of the OpenSSH server: RAM- Dropbear […]

The post How to replace SSH with Dropbear appeared first on NerdOfLinux's Tech Blog.

]]>
This tutorial will show you how to install the dropbear SSH server on Ubuntu 16.04. This steps should, however, also work on newer versions of Ubuntu, and modern versions of Debian.

Why?

Here are a few reasons you might want to use dropbear instead of the OpenSSH server:

  • RAM- Dropbear uses less resources than SSH, which is especially important when on < 1GiB of RAM
  • Compatible- Dropbear is fully compatible with SSH clients, and will even set variables such as $SSH_CONNECTION. It will even work with authorized-keys files

Why not?

Here is the only reason you might not want to switch to Dropbear:

  • PAM- Dropbear will NOT support PAM modules such as two-factor authentication

Installation

To install on Ubuntu 16.04, simply run the following two commands on your VPS:

sudo apt update
sudo apt install dropbear

Configuration

To enable dropbear, edit the config file with:

sudo nano /etc/default/dropbear

and change:

NO_START=1

to

NO_START=0

and make sure the following is set:

DROPBEAR_PORT=22

22 is the default for SSH, but you can change it if you use another port for SSH(such as 443 to get around firewalls).

Disable SSH

You could just delete the OpenSSH server with

sudo apt purge openssh-server

but, in case you mess up, you can just stop and disable SSH from auto-starting on boot with:

sudo systemctl disable ssh
sudo service ssh stop

Test Dropbear

Now, in a NEW terminal window(in case you messed up;the current session will continue and allow you to troubleshoot without using the console) use:

ssh user@server-ip

and everything should be the exact same as when you used OpenSSH. Be sure to check that your authorized_keys file works.

Re-enable SSH

In case you break something, and want to revert to SSH, just run the following commands:

sudo systemctl enable ssh
sudo systemctl disable dropbear
sudo service dropbear stop
sudo service ssh restart

and SSH should be restored, assuming you didn’t delete OpenSSH, in which case you need to re-install it:

sudo apt install openssh-server

The post How to replace SSH with Dropbear appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-replace-ssh-with-dropbear/feed/ 0 3310
The easy way out of creating a login system https://www.nerdoflinux.com/tech/internet/the-easy-way-out-of-creating-a-login-system/ https://www.nerdoflinux.com/tech/internet/the-easy-way-out-of-creating-a-login-system/#respond Thu, 26 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3386 If you’re designing a website, and don’t want to use social logins, but at the same time, don’t know how to create a login system, this post will show you the easy way out 🙂 . Luckily for you, one of the thing I like doing is using SQLite, and […]

The post The easy way out of creating a login system appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re designing a website, and don’t want to use social logins, but at the same time, don’t know how to create a login system, this post will show you the easy way out 🙂 .

Luckily for you, one of the thing I like doing is using SQLite, and one of the projects I’m working on is a website login system written in PHP that uses SQLite. You can check out the GitHub Repo to learn more about it.

Things you should know

This is a simple script, and is likely to break as I’m still working on it. It can work, but it’s not ready for production websites yet. But, if you’d like to focus your efforts on other things and need a login system for that, this script will help.

What is it?

I created a single PHP file that does all of the following:

  • Logins
    • Passwords are salted and hashed
  • Signups
    • Email verification is done by sending an email with a link
  • Password changes
  • Username changes
  • Emails and usernames must be unique

The reason I made it a single file was to make it really easy to deploy. Just make sure you have sqlite support with PHP, which you can install on Ubuntu with:

sudo apt install php-sqlite3

Using it

If you’re too lazy to read the readme file, here’s the installation part:

wget https://raw.githubusercontent.com/NerdOfLinux/SQLite-Web-Login/master/index.php -O account.php
sqlite3 .ht.users.db

In SQLite:

CREATE TABLE pending (code TEXT UNIQUE NOT NULL,username TEXT UNIQUE NOT NULL, email TEXT UNIQUE NOT NULL, password TEXT NOT NULL);
CREATE TABLE users (username TEXT UNIQUE NOT NULL, email TEXT UNIQUE NOT NULL, password TEXT NOT NULL);

After doing so, edit the account.php file, and change the following line:

$domain="example.com";

with your real domain, including subdomain.

Test it out

Go to https://yourdomain.com/account.php and test out signing up, verifying your email, and updating your password.

Limitations

At the time of writing, you still can’t change your email address, but I’m working on that. There is also no support for two-factor logins, although I might add that later on if it’s a feature people want. Please do NOT use this on a site that processes critical information as I don’t sanitize user input yet, so there is a chance of SQL injections.

The post The easy way out of creating a login system appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/the-easy-way-out-of-creating-a-login-system/feed/ 0 3386
You can’t hide https://www.nerdoflinux.com/tech/internet/you-cant-hide/ https://www.nerdoflinux.com/tech/internet/you-cant-hide/#comments Tue, 24 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3380 The internet is a great place; you can find nearly anything on it, but at what cost? Privacy It’s impossible to remain private on the internet. Every website you go to keeps logs, and even scarier than that is how much websites you don’t visit know about you. Google knows […]

The post You can’t hide appeared first on NerdOfLinux's Tech Blog.

]]>
The internet is a great place; you can find nearly anything on it, but at what cost?

Privacy

It’s impossible to remain private on the internet. Every website you go to keeps logs, and even scarier than that is how much websites you don’t visit know about you. Google knows pretty much every page to go to, because of Google Analytics, Adsense, or both. But other companies still know a lot about you. Take Facebook, for example; every website that contains a Facebook like button, or comments, can see what pages each person goes to, from where, and in some cases, to where.

Requests

Each time your browser makes a request for information, be it a photo, or some javascript, the source of that request can learn a lot about you. If you’re on a site using Disqus comments, they can access all sorts of browser data, such as where you came from, your OS, your screen size, your IP, and they can even use cookies to keep even more in-depth logs by identifying you specifically instead of just your IP.

VPN

Sure, a VPN will hide your IP, but not all the other browser data. Cookies can still be used as a way to track you, and signing in to Google makes it pretty easy for them to identify you, regardless of your IP.

Ads

You probably noticed that ads seem to know a lot about you. You search for laptops on Amazon, and the next thing you know, every site you visit has Amazon deals on laptops. Why? Chances are, they’re using Google Adsense, and Google knows which sites you go to, when, and how. And if they don’t know enough about you, they can buy that information from other services that do track you.

What you get in return

While you are sacrificing a lot of privacy to use the internet, you do get access to hundreds of millions of free websites, and that’s pretty much it. It’s hard to not use the internet, so there are some steps you can take, such as browser extensions that block analytics, and so on. But, I wouldn’t recommend blocking analytics on all sites, just sites such as Facebook that take too much info. Analytics are how content creators make content that people actually want instead of guessing, and without that, we have no way of knowing if you like cat videos or tech blogs 🙂 .

Update: Read NerdOfCode’s point of view here

The post You can’t hide appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/you-cant-hide/feed/ 1 3380
Theme My Login https://www.nerdoflinux.com/tech/wordpress/theme-my-login/ https://www.nerdoflinux.com/tech/wordpress/theme-my-login/#respond Sun, 22 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3370 This site, and many others, use the Theme My Login plugin in order to create login pages that fit with the theme of the site. This tutorial will show you how to set it up. Why? Using the default WordPress login/sign up page will work fine for small sites. However, […]

The post Theme My Login appeared first on NerdOfLinux's Tech Blog.

]]>
This site, and many others, use the Theme My Login plugin in order to create login pages that fit with the theme of the site. This tutorial will show you how to set it up.

Why?

Using the default WordPress login/sign up page will work fine for small sites. However, having a more customized, unique login page will make your site look more professional. The Theme My Login plugin creates pages to manage all aspects of creating, and maintaining an account, which fit with the look and feel of the theme.

How?

Set up is pretty easy, simply install the plugin via plugins management page on WordPress, and activate it. This will automatically generate the pages used by the plugin, and depending on your settings, the pages will likely be automatically added to the menu. The menu structure I use is the following:

  • Log In
  • Your Profile
    • Log out

The login menu item will be automatically hidden when a user is logged in. You’ll notice that while I have a your-profile page, your site doesn’t have that yet. To activate this page, go to the Theme My Login settings page, and enable the Themed Profiles options. Upon saving, you’ll notice more menu items by hovering over the Theme My Login icon, one of which will be themed profiles. Press that link, and you’ll be able to disable themed profiles for certain user roles, such as the administrator. I prefer the WordPress profile page as I use plugins that leave options there, but most users will not need to access that, so I only disabled Theme My Login profiles for the Administrator.

reCaptcha

The other module I enabled is reCaptcha. Just go to the Theme My Login settings page, activate the module, and go to the sub-menu(I think that’s what it’s called). Now, go here to generate a site and secret key, and enter the keys into the settings page. reCaptcha is now enabled on your registration page, which will help with reducing bots abusing the sign up page.

The post Theme My Login appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/theme-my-login/feed/ 0 3370
Battle of the CMS’s https://www.nerdoflinux.com/tech/wordpress/battle-of-the-cms/ https://www.nerdoflinux.com/tech/wordpress/battle-of-the-cms/#respond Fri, 20 Apr 2018 11:00:37 +0000 https://www.nerdoflinux.com/?p=3364 In the past month, I’ve used a ton of CMS platform thingies. This post will compare: Ghost, Jekyll, and WordPress. Ghost This is the one I most recently used, aside from WordPress. It’s focused on being a blogging platform, and nothing else. Everything is super simple, and after installation, there’s […]

The post Battle of the CMS’s appeared first on NerdOfLinux's Tech Blog.

]]>
In the past month, I’ve used a ton of CMS platform thingies.

This post will compare: Ghost, Jekyll, and WordPress.

Ghost

This is the one I most recently used, aside from WordPress. It’s focused on being a blogging platform, and nothing else. Everything is super simple, and after installation, there’s very little maintenance,aside from upgrades. Posts are written in markdown, and you use tags instead of categories. Permalinks are a bit weird, as you can only choose between the WordPress equivalent of %postname% and the date permalinks. There are no plugins, and free themes are hard to come by, but it makes up for that with everything it does built-in. AMP, sitemaps, SEO, and more is already built-in and integrated with Ghost, so it feels like it belongs, unlike some WordPress plugins 🙂 .

Jekyll

This one is quite special for one reason: static pages. Jekyll takes text files from the _posts folder, and builds a static site with them. These sites can be hosted on GitHub Pages for free, or you can host them on your server. Combined with NGINX, a Jekyll blog can handle way more traffic faster than WordPress. However, comments have to be external, and so do contact forms. AMP is not built in, but there are plugins you can get to add that functionality. The biggest downside is that you have to edit text files to write posts, but there are tools, such as Jekyll Admin, that give you a more standard CMS backend.

WordPress

Good old WordPress is a one size fits all CMS. It works for blogs, business sites, portfolios, photography sites, eCommerce sites, and more. There are thousands of free plugins and themes to add functionality, and it’s really easy to write your own. There are also caching plugins to create static pages, which can bring WordPress’s performance closer to that of Jekyll’s. Comments are built in, and a simple plugin install can give you a contact form that’s run by you, not some third party.

Overall, which one is best is up to you, but I’d recommend trying Jekyll, and if that doesn’t work, then Ghost, then WordPress. If you already have a WordPress blog, there’s no reason to switch, but if you’re starting out, see if GitHub pages + Jekyll can work for you before trying anything else.

The post Battle of the CMS’s appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/battle-of-the-cms/feed/ 0 3364
How to disable WordPress multisite https://www.nerdoflinux.com/tech/wordpress/how-to-disable-wordpress-multisite/ https://www.nerdoflinux.com/tech/wordpress/how-to-disable-wordpress-multisite/#respond Wed, 18 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3346 I recently moved my personal blog from a WordPress multisite to the Ghost CMS. That means, I have no need for a multisite, so this post will explain how I returned my WordPress install to a standard one. The easy way If you didn’t change your primary site, all you […]

The post How to disable WordPress multisite appeared first on NerdOfLinux's Tech Blog.

]]>
I recently moved my personal blog from a WordPress multisite to the Ghost CMS. That means, I have no need for a multisite, so this post will explain how I returned my WordPress install to a standard one.

The easy way

If you didn’t change your primary site, all you need to do is remove the multisite-related settings from the wp-config.php file, after deleting all the sites except the main one. Those directives look something like this:

define( 'WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'nerdoflinux.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Then, you’ll need to revert the .htaccess rules back to the default, but if you’re not using Apache, you can skip this step.

The hard way

If you’re like me and changed the primary site for some reason, you’ll need a few extra steps. First, delete all the sites you can, and remove the rules from wp-config.php. Then, you’ll need to change the database prefix, something like:

$table_prefix  = 'wp_';

to whatever the site id was:

$table_prefix = 'wp_2_';

Now, you’ll realize that your site won’t let you log in. That’s because of the user tables, so run the following commands in a root MySQL shell:

USE wordpress_DB;
RENAME TABLE wp_users TO wp_4_users;
RENAME TABLE wp_usermeta TO wp_4_usermeta;

and you should now be able to log in! But, if you’re like me and need the database prefix to be just wp_ without the site id, you’ll need to also run the following (bash) commands:

sudo mysqldump wordpress_DB > orig.sql
sudo cp origi.sql mod.sql
sudo mysql -e "DROP DATABASE wordpress_DB"
sudo sed -i "s/wp_4_/wp_/g" mod.sql
sudo mysql -e "CREATE DATABASE wordpress_DB"
sudo mysql wordpress_DB < mod.sql

and, with a bit of luck, you should be able to change your table prefix back to:

$table_prefix = 'wp_';

and be able to log in!

Settings

All your settings should still be stored, and plugins, while they may be deactivated, should retain all of their settings. However, whenever modifying anything as big as the DB in WordPress, be sure to have a backup in case you break something.

The post How to disable WordPress multisite appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/how-to-disable-wordpress-multisite/feed/ 0 3346
Ghost CMS https://www.nerdoflinux.com/reviews/other-reviews/ghost-cms/ https://www.nerdoflinux.com/reviews/other-reviews/ghost-cms/#respond Mon, 16 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3332 I recently moved my personal blog, personal.nerdoflinux.com, to the Ghost CMS from WordPress. So, here’s what I think about it so far: Purpose First of all, the purpose of the Ghost CMS is just for blogging. If you plan on running a business site, you can do it, but it’s […]

The post Ghost CMS appeared first on NerdOfLinux's Tech Blog.

]]>
I recently moved my personal blog, personal.nerdoflinux.com, to the Ghost CMS from WordPress. So, here’s what I think about it so far:

Purpose

First of all, the purpose of the Ghost CMS is just for blogging. If you plan on running a business site, you can do it, but it’s not designed for that. You can write posts, make pages, and that’s about it. And that works just fine for the majority of blogs. Also, it’s written in node.js instead of PHP, but it’s themes are written in something else that I forget what it’s called, but it’s easy enough to make edits.

What it lacks

So, it’s still evolving, but it does lack a lot of features that are pretty darn essential on a blog. The biggest three I encountered were: search, comments, and email subscriptions. Many themes have support for Disqus, but then you need to trust someone else with all of your comments, unlike WordPress which hosts it all for you. The solution to this is the isso commenting system, which you self-host, and similar to Disqus, you just paste a bit of javascript in your site and you’re good to go. The next thing was search, there is no search widget, or widgets at all for that matter, so you can use Google Custom Search, or if you want to self-host, you can simply use Ghost Hunter, a project that adds search functionality. It takes less than five minutes to set up, and is definitely worth it. Lastly, email subscriptions. It is being added, and you can currently have an email form to collect emails, but notifications for new posts are NOT yet available. My self-hosting solution for this was mailtrain with its RSS campaign and widget feature. Just set up mailtrain, paste a bit of javascript in a page, and you have email subscriptions working.

What it’s amazing at

Aside from the three features it lacks, it has everything else, without the need for plugins. Want to add Google Analytics? Just use the code injection feature without editing any theme files. Need a sitemap? Ghost does that automatically for you. Love markdown? Ghost has that built-in. Need live previews while you write? Ghost can do that for you. Don’t have MySQL? Ghost supports SQLite.

Conclustion

For 9/10 blogs, Ghost works fine and is 100 times simpler to manage than WordPress. But, if you need more than just a blog, WordPress is still the best. I’m even considering moving this blog over to ghost just because of the editor 🙂

After using Ghost for a few days, I switched my personal blog back to WordPress. You’re supposed to run Ghost on > 1GB of RAM, and as I only have 512MB, my VPS was swapping too much 🙁

The post Ghost CMS appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/reviews/other-reviews/ghost-cms/feed/ 0 3332
WP Super Cache NGINX mobile theme https://www.nerdoflinux.com/tech/wordpress/wp-super-cache-nginx-mobile-theme/ https://www.nerdoflinux.com/tech/wordpress/wp-super-cache-nginx-mobile-theme/#respond Sat, 14 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3321 If you use NGINX, and want the best performance, you probably use a caching plugin such as WP Super cache with the standard rules over at wordpress.org. Well, the biggest problem is that those rules don’t work if you use the Jetpack Mobile theme, or any other mobile theme. I […]

The post WP Super Cache NGINX mobile theme appeared first on NerdOfLinux's Tech Blog.

]]>
If you use NGINX, and want the best performance, you probably use a caching plugin such as WP Super cache with the standard rules over at wordpress.org.

Well, the biggest problem is that those rules don’t work if you use the Jetpack Mobile theme, or any other mobile theme. I figured out a way to fix that, and all it takes is editing your NGINX virtual host. Just replace the standard rules with:

#Browser Caching
location ~* \.(jpg|jpeg|png|gif|ico|css|js){
        expires 30d;
}
location ~*\.(html){
        expires 7d;
}
# WP Super Cache rules.
# Designed to be included from a 'wordpress-ms-...' configuration file.

set $cache_uri $request_uri;
set $file "index-https.html";
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
        set $cache_uri 'null cache';
}

if ($query_string != "") {
        set $cache_uri 'null cache';
}   

# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $cache_uri 'null cache';
}   

# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
        set $cache_uri 'null cache';
}

# START MOBILE
#Set file to mobile if user agent
if ($http_user_agent ~* (2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800)) {
        set $file "index-https-mobile.html";
}
# Use cached or actual file if they exists, otherwise pass request to WordPress
location / {
    try_files /wp-content/cache/supercache/$http_host/$cache_uri/$file $uri $uri/ /index.php?$args ;
}    

It’s basically just the standard rules, but instead of bypassing the cache for mobile devices, it serves the cached mobile version, if that option is enabled.

Why not just use PHP to serve cached files?

This is also what I did for a while, but using NGINX directly instead of invoking PHP is much faster, and uses less resources. Put those together, and your server can now deal with more visitors at a time, while being faster! Hopefully WP Super cache will copy W3 Total Cache, and just create a nginx.conf file. But, until then, you’ll have to edit the configs yourself.

The post WP Super Cache NGINX mobile theme appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/wp-super-cache-nginx-mobile-theme/feed/ 0 3321
Use Chromebook as WiFi repeater https://www.nerdoflinux.com/tech/linux-tutorials/use-chromebook-as-wifi-repeater/ https://www.nerdoflinux.com/tech/linux-tutorials/use-chromebook-as-wifi-repeater/#respond Thu, 12 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3315 If you’re like me and have your chromebook in developer mode, you’re probably wondering how to use it as a WiFi repeater 🙂 . Install crew First, the simplest part, install crew. This is an amazing tool that will install gcc and make to allow you to build virtually anything. […]

The post Use Chromebook as WiFi repeater appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re like me and have your chromebook in developer mode, you’re probably wondering how to use it as a WiFi repeater 🙂 .

Install crew

First, the simplest part, install crew. This is an amazing tool that will install gcc and make to allow you to build virtually anything. It even has a ton of programs pre-compiled such as clamav and nano. Anyways, installation is easy, just run:

curl -Ls git.io/vddgY | bash

and follow the instructions.

Install hostapd

This part took me a while to do, but here are the steps.
1. Go into /usr/local/bin because you have execute permissions there:

cd /usr/local/bin
  1. Clone the first git repo, and build:
git clone https://github.com/tgraf/libnl-1.1-stable.git
cd libnl-1.1-stable
bash configure
make
sudo make install
  1. Actually build hostapd:
cd ..
git clone http://w1.fi/hostap.git
cd hostap/hostapd
cp defconfig .config
make
make install

Install dnsmasq

  1. Go to /usr/local/bin
cd /usr/local/bin
  1. Clone the repo
git clone https://github.com/imp/dnsmasq.git
  1. Build and install
make
sudo make install

Get create_ap

  1. Go to your home folder
cd ~/
  1. Clone the repo
git clone https://github.com/oblique/create_ap.git
  1. Run
cd create_ap
sudo stop shill
sudo start shill ignore=ap0
sudo bash create_ap wlan0 wlan0 SSID Password

Troubleshoot

If there is an issue with create_ap, make sure you ran:

sudo stop shill
sudo start shill ignore=ap0

and that you have the right interface. You can list all of your interfaces with:

ifconfig

Or, if you get a driver error, your WiFi card may just not support virtual adapters, in which case you’ll need to install another Linux distro and plug in another WiFi card(i.e. USB WiFi adapter)

Please leave any problems you have in the comments and I will try to help.

Sources(a.k.a. where the code snippets are from 🙂 ) Crew Wiki| Hostapd GitHub | DNSmasq GitHub

This post is now 300 words.

The post Use Chromebook as WiFi repeater appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/use-chromebook-as-wifi-repeater/feed/ 0 3315
How to change your VPS’s hostname https://www.nerdoflinux.com/tech/linux-tutorials/how-to-change-your-vpss-hostname/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-change-your-vpss-hostname/#respond Tue, 10 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3303 If you recently changed your domain name, and want your server’s hostname to match, you’ve come to the right post 🙂 . Immediate, temporary way The immediate way to do this, is with one simple command: sudo hostname example.com where example.com is your new domain name. Now, exit the SSH […]

The post How to change your VPS’s hostname appeared first on NerdOfLinux's Tech Blog.

]]>
If you recently changed your domain name, and want your server’s hostname to match, you’ve come to the right post 🙂 .

Immediate, temporary way

The immediate way to do this, is with one simple command:

sudo hostname example.com

where example.com is your new domain name. Now, exit the SSH session, and open a new one, and the hostname should have changed:

admin@example:~$

if you don’t use bash, then check with the hostname command:

example.com

Persist across reboots

If you want the new hostname to persist across reboots, then you need to edit a few more files. First, edit /etc/hostname with:

sudo nano /etc/hostname

and edit the first, and only line, to your new domain. Next, you need to edit the /etc/hosts file, with:

sudo nano /etc/hosts

and change all lines with your old domain to your new one, which should just be 127.0.0.1, and the IPv6 equivalent if you have that enabled.

A few more considerations

When changing your domain name, make sure you also update the following(if you use them):

Postfix

Edit the config file:

sudo nano /etc/postfix/main.cf

and change all occurrences of your old domain with the new one.

Apache

Edit the virtual hosts:

sudo nano /etc/apache2/sites-enabled/*

and change all occurrences of your old domain with the new one.

NGINX

Edit the virtual hosts:

sudo nano /etc/nginx/sites-enabled/*

and change all occurrences of your old domain with the new one.

Lighttpd

Edit the virtual hosts:

sudo nano /etc/lighttpd/lighttpd.conf

and change all occurrences of your old domain with the new one.

Lets Encrypt

If you use Let’s Encrypt, be sure to get a certificate for your new domain, and remember to change all apps that use the SSL certificates to the new path.

Short way

If you’re lazy, use the sed way:

sudo sed -i 's/olddomain/newdomain/g' /path/to/file/here

after making a backup of course 🙂

The post How to change your VPS’s hostname appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-change-your-vpss-hostname/feed/ 0 3303
Swapfiles https://www.nerdoflinux.com/tech/linux-tutorials/swapfiles/ https://www.nerdoflinux.com/tech/linux-tutorials/swapfiles/#respond Sun, 08 Apr 2018 12:00:37 +0000 https://gateblogs.com/?p=3278 If you’re a Linux user, you’ve probably at least heard of swap. What is it? Well, Linux.com’s articles describes it best: Linux divides its RAM…into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the…swap space to free up that page of […]

The post Swapfiles appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re a Linux user, you’ve probably at least heard of swap. What is it? Well, Linux.com’s articles describes it best:

Linux divides its RAM…into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the…swap space to free up that page of memory.

Basically, when the Linux kernel decides that a chunk of memory no longer needs to be stored in RAM, it puts it onto the file or partition designated for use as swap space. Swap space is also used when the system is low on RAM to try and prevent a total crash.

Do NOT disable swap

If you’re using a lot of swap, and you think it’s slowing down your system, get more RAM, not swap. If you disable swap and your system does not have enough RAM, instead of your browser slowing down, the kernel will panic and initiate the OOM(out of memory) killer, which will begin killing processes in a last attempt to keep the system somewhat stable.

How do I create a swapfile?

Well, I’m glad you asked that 🙂 . First, you need to create a file, so you can use:

sudo fallocate -l 1G /swapfile

which is NOT recommended, read this answer on Ask Ubuntu to learn more. Or, you can do the recommended way, which is:

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

to create a 1GiB swapfile. Next, turn it into a swapfile with:

sudo mkswap /swapfile

give the proper permissions:

sudo chmod 0600 /swapfile

and enable:

sudo swapon /swapfile

Now, you can check if it’s working with free -h which will return something like(this system was already using swap for a while):

              total        used        free      shared  buff/cache   available
Mem:           488M        266M         25M         31M        196M        143M
Swap:          1.0G        267M         757M

Auto-mount

If you’d like the swapfile to mount on boot, simply edit /etc/fstab with nano or another text editor:

sudo nano /etc/fstab

and add:

/swapfile swap sw  0 0

Save and close the file, and check free -h after a reboot.

Sources: Linux.com | Archlinux Wiki

The post Swapfiles appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/swapfiles/feed/ 0 3278
How to debug/fix the Jetpack plugin https://www.nerdoflinux.com/tech/wordpress/how-to-fix-the-jetpack-plugin/ https://www.nerdoflinux.com/tech/wordpress/how-to-fix-the-jetpack-plugin/#respond Fri, 06 Apr 2018 12:00:37 +0000 https://gateblogs.com/?p=3294 For a long time, XML-RPC and all plugins that require that, such as Jetpack, refused to work unless I was using Apache. I finally managed to get XML-RPC working, so I’ll share my debugging steps: Jetpack Debug The easiest way to debug is to go to https://example.com/wp-admin/admin.php?page=jetpack-debugger, and check if […]

The post How to debug/fix the Jetpack plugin appeared first on NerdOfLinux's Tech Blog.

]]>
For a long time, XML-RPC and all plugins that require that, such as Jetpack, refused to work unless I was using Apache. I finally managed to get XML-RPC working, so I’ll share my debugging steps:

Jetpack Debug

The easiest way to debug is to go to https://example.com/wp-admin/admin.php?page=jetpack-debugger, and check if you get an error. If you do, click on the little red rectangle that tells you about the error, and an array or JSON or whatever it is will pop up, which contains everything you could possible need to debug. The most helpful is the error code and message the server returned. If this is 404, check you rewrite rules, and hopefully when you refresh your problems are fixed, if not, continue.

Reinstall/Install the xml-rpc extension

I’m using Ubuntu server, so the command would be:

sudo apt install --reinstall php-xmlrpc
sudo service php7.0-fpm restart

And after a webserver restart, check again. This will likely fix your problem, if not, purge all PHP modules:

sudo apt purge php*

Then, copy your configs over to a new folder:

sudo mv /etc/php /etc/php.old

And reinstall:

sudo apt install php7.0-fpm php-mysql php-xml php-xmlrpc

restart your webserver, and this is what fixed it for me. Now, check your old configs and start to add all your changes again until something breaks, and you’ve found the cause 🙂

Lighttpd

At the time of writing, I’m still using and liking lighttpd. It’s light, it’s fast, and it does everything I need while using < 10MB of RAM. It also uses just one process, while NGINX uses 2 after I set it to use one worker. Anyways, I wouldn’t say its worth switching to from NGINX, but if you’re on Apache and your website is growing, I’d highly recommend switching to Lighttpd, unless you need to proxy to a https backend 🙂

The post How to debug/fix the Jetpack plugin appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/how-to-fix-the-jetpack-plugin/feed/ 0 3294
Blog Update(April 2018) https://www.nerdoflinux.com/other/blog-updateapril-2018/ https://www.nerdoflinux.com/other/blog-updateapril-2018/#respond Wed, 04 Apr 2018 12:00:37 +0000 https://www.nerdoflinux.com/?p=3300 You probably realized the URL of this site has changed. Why? Well, originally Gate Blogs was a project that both NerdOfCode and I worked on, but he decided to one day go and make nerdofcode.com. For a while, I kept using Gate Blogs, but eventually I bought this domain, and […]

The post Blog Update(April 2018) appeared first on NerdOfLinux's Tech Blog.

]]>
You probably realized the URL of this site has changed.

Why?

Well, originally Gate Blogs was a project that both NerdOfCode and I worked on, but he decided to one day go and make nerdofcode.com. For a while, I kept using Gate Blogs, but eventually I bought this domain, and I think it fits the blog better. Also, I’m the only one posting here now, so yeah. This change will also hopefully help this site get more visitors as searching Gate Blogs on Google didn’t bring up this site. Now, searching NerdOfLinux does bring up this site, so people that hear about it and use Google will actually find this site now!

Redirects

Don’t worry, if you shared the old URL with anyone, it will redirect to this one for the time being, although I’m considering not renewing gateblogs.com because it still has 100 days left, which I think is enough to remember the new URL. Also, if you noticed, my personal blog was here for a week or something like that, so that has moved to personal.nerdoflinux.com.

Anything else?

No, and the post schedule will continue as normal in two days. As always, thank you for reading this blog, and please subscribe with the form below.

The post Blog Update(April 2018) appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/other/blog-updateapril-2018/feed/ 0 3300
Web servers,web servers https://www.nerdoflinux.com/tech/wordpress/web-servers/ https://www.nerdoflinux.com/tech/wordpress/web-servers/#comments Mon, 02 Apr 2018 12:00:37 +0000 https://gateblogs.com/?p=3272 You probably know I like changing my web server every two minutes.While that is not recommended as it causes a lot of downtime, I like experimenting and learning about all the options. That is why I recently was testing the Lighttpd web server. Here are my thoughts about each server: […]

The post Web servers,web servers appeared first on NerdOfLinux's Tech Blog.

]]>
You probably know I like changing my web server every two minutes.While that is not recommended as it causes a lot of downtime, I like experimenting and learning about all the options. That is why I recently was testing the Lighttpd web server.

Here are my thoughts about each server:

Apache

Apache is know, in my opinion, for just working. You install it, create a virtual host, and your site is up. Yes, it’s not the most efficient, but many people are willing to make that trade-off between efficiency and ease of use. Tons of applications and CMS’s use .htaccess files, something which is only available in Apache.

NGINX

NGINX is known for its low resource usage. Some people find it a bit harder to use than Apache, but it’s amazing with static files. It uses just a few megabytes of RAM for thousands to tens of thousands of concurrent visitors. However, this does require you to set up php-fpm, but after that, it can do much of what Apache can. Many CMS’s are also adding NGINX rules to their configuration guides as it’s gaining popularity.

Lighttpd

Good old Lighttpd, while it has had some memory leaks in the past, is also known for being a low-resource web server. While I find its configuration a bit more complicated, creating a virtual host with a web root takes 3 lines in a config file! It also requires php-fpm if you want to use PHP applications. Many CMS’s have rewrite rules for Lighttpd, although it’s not as popular as NGINX.

Lighttpd + WordPress

If you’re like me, and want to run WordPress on Lighttpd, then here are the rules you need to add:

url.rewrite = (
    "^/(.*)\.(.+)$" => "$0",
    "^/(.+)/?$" => "/index.php/$1"
)

And for PHP-FPM, edit 15-fastcgi-php.conf in conf-available:

fastcgi.server += ( ".php" =>
        ((
                "socket" => "/var/run/php/php7.0-fpm.sock",
                "broken-scriptfilename" => "enable"
        ))
)

then run:

lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php

and restart Lighttpd

Configs from: HowToGeek | Guy Rutenberg

Read more about Lighttpd on lighttpd.netLeave your favorite web server in the comments!

The post Web servers,web servers appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/web-servers/feed/ 1 3272
An introduction to UFW https://www.nerdoflinux.com/tech/linux-tutorials/an-introduction-to-ufw/ https://www.nerdoflinux.com/tech/linux-tutorials/an-introduction-to-ufw/#respond Sat, 31 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3242 If you’re new to Linux, iptables probably seems intimidating, so here’s the easy way out. UFW UFW stands for Uncomplicated FireWall and it’s way simpler than iptables You get a bit less flexibility, but it’s all worth it because you need to spend half as much time managing your firewall. […]

The post An introduction to UFW appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re new to Linux, iptables probably seems intimidating, so here’s the easy way out.

UFW

UFW stands for Uncomplicated FireWall and it’s way simpler than iptables You get a bit less flexibility, but it’s all worth it because you need to spend half as much time managing your firewall. Also, if you’re using Vultr, or another provider that offers IPv6 and IPv4 addresses on your VPS, UFW adds rules for both, something iptables can’t do.

Basics

UFW has three basic modes of operation: allow, limit, and delete. Allow is used to well, allow, requests to go through certain ports. For example, to allow SSH, you just run:

sudo ufw allow 22/tcp

and port 22 is now allowed on both IPv4 and IPv6. Or, to prevent simple DoS attacks and/or some brute force attacks, you can limit the port to 6 new connections every 30 seconds, with:

sudo ufw limit 22/tcp

Unfortunately, there is no easy way to change the limits themselves, you can only choose to limit or allow. Anyways, what happens when you change ports and want to close one? Well, just use the delete command:

sudo ufw delete limit 22/tcp

or, if you used allow:

sudo ufw delete allow 22/tcp

and open the new port.

One more thing, on a fresh Ubuntu install, run

sudo ufw enable

to activate UFW.

Adding iptables rules

What happens if you want to add some custom iptables rules? Well, UFW supports this by editing the /etc/ufw/before.rules for IPv4 and /etc/ufw/before6.rules for IPv6. Everything in there gets added to the iptables chain before the rest of the UFW rules. If you want to add rules after the UFW chain, then add your iptables rules(which you get from iptables-save) into /etc/ufw/after.rules and/or /etc/ufw/after6.rules.

Profiles

UFW even has some built-in profiles for certain application. For example, instead of specifying the port for SSH, you can just run:

sudo ufw allow SSH

and port 22/tcp will be opened. You can also use profiles for http, https, and more.

Fail2ban

Great, now you have UFW up and running. But what if you use Fail2ban? The default ipables mode won’t work anymore because UFW overrides that. Luckily all you need to do is change iptables-multiport or iptables-allports in your jail.local file to ufw and restart fail2ban. Now, fail2ban should insert rules into UFW. You can verify this by running sudo ufw status after an IP is blocked, and you should see the following near the top:

To                         Action      From
--                         ------      ----
Anywhere                   REJECT      1.2.3.4            

Summary

#Allow a port
sudo ufw allow port/proto
#Limit a port
sudo ufw limit port/proto
#Delete an allow rule
sudo ufw delete allow port/proto
#Delete a limit rule
sudo ufw limit port/proto

The post An introduction to UFW appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/an-introduction-to-ufw/feed/ 0 3242
How to get a free wildcard SSL certificate! https://www.nerdoflinux.com/tech/security/how-to-get-a-free-wildcard-ssl-certificate/ https://www.nerdoflinux.com/tech/security/how-to-get-a-free-wildcard-ssl-certificate/#respond Thu, 29 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3224 Let’s Encrypt recently released free wildcard certificates for everyone! acme.sh The script we’ll be using for this is acme.sh, which is currently one of the few programs that supports acme v2. Also, wildcard SSL certificates can only be made with DNS verification, and acme.sh has support for many DNS APIs, […]

The post How to get a free wildcard SSL certificate! appeared first on NerdOfLinux's Tech Blog.

]]>
Let’s Encrypt recently released free wildcard certificates for everyone!

acme.sh

The script we’ll be using for this is acme.sh, which is currently one of the few programs that supports acme v2. Also, wildcard SSL certificates can only be made with DNS verification, and acme.sh has support for many DNS APIs, so it can auto-renew for you. To get this script, simply run:

curl https://get.acme.sh | sh

Getting the certificate

I use Cloudflare, so that’s what I’m going to use in this example. You need to get your Cloudlfare API key, and then run:

export CF_Key="yourapikeygoeshere"
export CF_Email="test@example.com"

Then, you can issue the certificate with:

acme.sh --issue -d example.com -d *.example.com --dns

Using the certificate

Now, in the user you ran acme.sh with, you’ll see a .acme.sh folder appear. In that folder, among other things, will be a folder called example.com and *.example.com. You’ll want to use the certificates in example.com as those will cover every subdomain for example.com, and example.com itself. To use this in apache, use something like:

SSLCertificateFile  /home/www-data/.acme.sh/example.com/fullchain.cer
SSLCertificateKeyFile   /home/www-data/.acme.sh/example.com/example.com.key

and then restart apache. Be sure that the apache user can access the .acme.sh folder and all of its contents.

What these certificates will work for

These certificates will work exactly like the paid ones, except that you can’t get extended validation ones. You can use them in dovecot to not get warnings each time you check your mail, you can use them on your website without Cloudflare, you can use them with Cloudflare strict SSL, as they are valid certificates, and more. Since I use Cloudflare, I mainly just use the certificates for dovecot, and that works fine for me. For example, gmail can use POP3S to check another email account and import the messages into your gmail. Before I had a valid certificate, gmail would refuse to connect, but with Let’s Encrypt, gmail accepts the certificate and actually imports all of my emails into one place 🙂

Let me know what you do with your certificate in the comments below.

Source: GitHub

The post How to get a free wildcard SSL certificate! appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/security/how-to-get-a-free-wildcard-ssl-certificate/feed/ 0 3224
How to install swift on Ubuntu https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-swift-on-ubuntu/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-swift-on-ubuntu/#respond Tue, 27 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3217 While Apple doesn’t have pre-compiled versions for anything beyond Ubuntu 16.10, that didn’t stop me from trying 🙂 Installation All you need to do is download and decompress the .tar.gz file. That can be done with the following two lines of bash: wget https://swift.org/builds/swift-4.0.3-release/ubuntu1610/swift-4.0.3-RELEASE/swift-4.0.3-RELEASE-ubuntu16.10.tar.gz tar xzvf swift-4.0.3-RELEASE-ubuntu16.10.tar.gz and you should […]

The post How to install swift on Ubuntu appeared first on NerdOfLinux's Tech Blog.

]]>
While Apple doesn’t have pre-compiled versions for anything beyond Ubuntu 16.10, that didn’t stop me from trying 🙂

Installation

All you need to do is download and decompress the .tar.gz file. That can be done with the following two lines of bash:

wget https://swift.org/builds/swift-4.0.3-release/ubuntu1610/swift-4.0.3-RELEASE/swift-4.0.3-RELEASE-ubuntu16.10.tar.gz
tar xzvf swift-4.0.3-RELEASE-ubuntu16.10.tar.gz

and you should be able to run:

cd swift-4.0.3-RELEASE-ubuntu16.10/usr/bin/
./swift

and get a swift shell-thingie. Anyways, if you get an error, the best advice I can give is Google it, and you’ll probably have to install a package or two. Funnily enough, I didn’t need the packages the Apple tutorial says you need, and everything worked fine.

Adding it to your path

So, now all you need is to add this into your path. I like to create a folder called .swift in my home directory, so I don’t see it, but can still add to my path. Here’s the commands to do that:

mv swift-4.0.3-RELEASE-ubuntu16.10 .swift
PATH=$PATH:~/.swift/usr/bin

and you can now run swift without needing the full path. But this will not work if you start a new session. To do that, you need to add the last line into your .bashrc file, so here’s the one-line bash way of doing that:

echo 'PATH=$PATH:~/.swift/usr/bin' >> ~/.bashrc

Be sure to use single quotes, or else the variable will get expanded into the current path, which we don’t want in case it changes later. You should now be able to start a new bash session and have access to the swift commands.

All users

If you want something accessible to all users, then put the .swift folder into something like /home, or anywhere everyone has access to with the smallest chance of breaking anything. I once deleted the entire /usr folder while doing this, and that wasn’t fun to recover.

Anyways, let me know if this worked in the comments below!

The post How to install swift on Ubuntu appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-swift-on-ubuntu/feed/ 0 3217
How to make money in the age of AdBlock https://www.nerdoflinux.com/tech/internet/how-to-make-money-in-the-age-of-adblock/ https://www.nerdoflinux.com/tech/internet/how-to-make-money-in-the-age-of-adblock/#respond Sun, 25 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3207 So, you have a website that used to make tons of money, but now, all your visitors use adblock. What do you do now? Mining There are many tools out there that allow you to use your visitor’s CPU power to mine various cryptocurrencies. I DO NOT recommend you mine […]

The post How to make money in the age of AdBlock appeared first on NerdOfLinux's Tech Blog.

]]>
So, you have a website that used to make tons of money, but now, all your visitors use adblock. What do you do now?

Mining

There are many tools out there that allow you to use your visitor’s CPU power to mine various cryptocurrencies. I DO NOT recommend you mine in the background, as your users will get pretty upset once they learn you’ve been making money off their computer without letting them know. That’s why I recommend you use purely opt-in mining solutions, like what this site does. If you go to the about page, there’s a little javascript miner you can use to mine Monero which will help support this site. You can use a miner like that on the sidebar, and then visitors will be more likely to see it and want to help out.

Sponsored posts

This is less common in blogging than YouTube channels, but is still a thing. If you have a big enough audience, you can get companies to pay you to review their products. While this is an easy method, it does get annoying for your visitors pretty quickly. Also, can you honestly analyze a product properly once you’ve been payed to do so? Some people can, but most will be biased towards that company that just payed them 🙂 . So, if you do decide to go this route, be sure to actually look through all the pros and cons, and not just say “product X is amazing” because you got payed to write that.

Affiliate links

Many big companies have affiliate programs that give you a link that you can put on your site. Whenever a visitor goes to the site through your link, and creates an account and/or purchases something, you get money, which is usually in the form of account credit. However, account credit is not as useless as you think, especially if you regularly use the service anyways. For example, I have an affiliate link with Vultr, which can be found on the about page. Whenever anyone signs up using that link, and spends a certain amount of money, I get $10 of account credit. That credit is then used to run this site.

Which one?

There’s no reason to not do a little of each, but be sure to remember the purpose of your site. You most likely made a site to inform people, not to make money. Sure, making money is nice, but that’s not the main motive. So, be sure to remember that, and not have 10 shout outs and 15 affiliate links with a background Monero miner on each post.

The post How to make money in the age of AdBlock appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/how-to-make-money-in-the-age-of-adblock/feed/ 0 3207
How to install WordPress on a VPS https://www.nerdoflinux.com/tech/wordpress/how-to-install-wordpress-on-a-vps/ https://www.nerdoflinux.com/tech/wordpress/how-to-install-wordpress-on-a-vps/#respond Fri, 23 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3200 If you have outgrown your shared hosting provider, hosting your site on a VPS is the next step. But, configuring that can be a bit difficult sometimes, so this post is here to help.## Video I actually made a video about this, which you can view in the player below: […]

The post How to install WordPress on a VPS appeared first on NerdOfLinux's Tech Blog.

]]>
If you have outgrown your shared hosting provider, hosting your site on a VPS is the next step. But, configuring that can be a bit difficult sometimes, so this post is here to help.## Video
I actually made a video about this, which you can view in the player below:

Steps

Basically, here’s what you need to do:

  1. Get a VPS from Vultr
  2. Configure it with Ubuntu
  3. Update your VPS
  4. Install the LAMP stack
  5. Set up the DB
  6. Finish setting up WordPress

Commands

First, SSH into your server with:

ssh root@yourvultriphere

Then, update your VPS with:

sudo apt update && sudo apt upgrade

Next, install the LAMP stack(and unzip):

sudo apt install apache2 libapache2-mod-php7.0 mariadb-client mariadb-server php-mysql unzip

Configure UFW for security:

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw enable

Configure apache

#Enter the correct directory
cd /etc/apache2/sites-available
#Copy the file
cp 000-default.conf 000-wordpress.conf
#Edit the file(change DocumentRoot to /var/www/wordpress)
nano 000-wordpress.conf
#Disable the old site and enable the new site
a2dissite 000-default.conf
a2ensite 000-wordpress.conf
#Restart apache
apachectl restart

Install WordPress

cd /var/www
mkdir wordpress
cd wordpress
wget https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress/* .
mv wordpress/.* .
rmdir wordpress

Create the database

sudo mysql
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'blog'@'localhost' IDENTIFIED BY 'securepassword';
FLUSH PRIVILEGES;
exit;

Configure WordPress

Follow the on-screen instructions, and set:

Database Name: wordpress
Username: blog
Password: securepassword
Database Host: localhost
Table Prefix: wp_

Then, set the site name, etc. to whatever you want.

Start blogging!

I hope this tutorial made sense, and leave any questions in the comments, and I will do my best to answer them! Also, leave your new blog domain in the comments and I will try to check it out.

If you decide on choosing Vultr, please use my affiliate link:
It helps cover the costs of running this site 🙂

The post How to install WordPress on a VPS appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/how-to-install-wordpress-on-a-vps/feed/ 0 3200
Do you need a CMS? https://www.nerdoflinux.com/tech/wordpress/do-you-need-a-cms/ https://www.nerdoflinux.com/tech/wordpress/do-you-need-a-cms/#respond Wed, 21 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3193 If you’re starting a website, you’re probably wondering if you need a CMS, or if you should just create the site yourself. Well, this short post is here to help you decide. CMS A CMS, or Content Management System is intended to make managing content easier(what a surprise). So, using […]

The post Do you need a CMS? appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re starting a website, you’re probably wondering if you need a CMS, or if you should just create the site yourself. Well, this short post is here to help you decide.

CMS

A CMS, or Content Management System is intended to make managing content easier(what a surprise). So, using a CMS makes sense when your website will have a ton of changing content, such as a blog. It makes very little sense to hand-code each page for a blog, as you’ll easily reach hundred, or thousands of HTML pages. What happens when you want to change the design? That’s a hundred pages you need to modify. So, you’ll make it dynamic and use PHP, create header.php, footer.php, etc. which will add even mor files. Then, there’s the problem of comments, etc.

Hand-coding

However, if you’re making a site for a product, that will be updated every now and then, having a full CMS doesn’t make as much sense. If you just have a product page, a link to purchase your product, and an about page, then hand-coding that site won’t be difficult to update. Basically, if you just have a handful of pages, then hand-coding gives you full control over the site, which might be helpful. But then, using existing themes and templates won’t be as easy to update as using a CMS, where you just press an install button.

Which CMS?

If you decided that you want to use a CMS based off my ten sentences 🙂 , then you’ll have to choose between the many CMS’s out there. I prefer WordPress, but you can also use Jekyll, Drupal, Joomla, or one of the not-self-hosted ones just as Blogger and Medium. I think the closest to a one-size-fits-all option will be to use a self-hosted version of WordPress. This gives you near full control of everything, while giving you tools to manage thousands of posts at ease.

What you do with your site is up to you, but for most people, I’ll just say stick to a self-hosted version of WordPress.

The post Do you need a CMS? appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/do-you-need-a-cms/feed/ 0 3193
WordPress multisites https://www.nerdoflinux.com/tech/wordpress/wordpress-multisites/ https://www.nerdoflinux.com/tech/wordpress/wordpress-multisites/#respond Mon, 19 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3180 So, you have a WordPress install, and you’re wondering if you should create a multisite, or do something else. Well, this post is here to try and help you figure that out! What’s a multisite? A WordPress multisite allows you to have multiple websites all under a single WordPress install. […]

The post WordPress multisites appeared first on NerdOfLinux's Tech Blog.

]]>
So, you have a WordPress install, and you’re wondering if you should create a multisite, or do something else. Well, this post is here to try and help you figure that out!

What’s a multisite?

A WordPress multisite allows you to have multiple websites all under a single WordPress install. This means that, for plugins that support it, you only have to manage one plugin that works for both sites, instead of changing all the settings individually, like you would if you had two installs. A multisite can work as either a subdomain(newsite.example.com), or a directory(example.com/newsite).

When should I use it?

If you need two sites, and don’t want the work of managing two separate installs, then a multisite is your solution. However, there is more work involved, and not all plugins are multisite compatible. Before you choose to create a multisite, I recommend you make sure that categories and/or tags will not work for you. If you want a different theme, then you do need a multisite. But, if you’re planning on having the same theme, and just have different posts, then categories may be better for you.

Themes and Plugins

Themes and plugins become a huge problem when you use a WordPress multisite. The super-admin has to install the theme, and then the individual site admin has to activate it. If you’re using a theme that has a page builder, then this isn’t much of a problem, but if you want to have different themes on each site, you have to go to the superadmin dashboard, install it, go to your site dashboard, and activate it. Plugins also work in the same way; plugins that don’t support multisites require you to install the plugin via the superadmin dashboard, and then go to the individual site dashboard to configure it.

Why do I use it?

Well, I use a multisite to host this site, and my personal blog, nerdoflinux.nerdoflinux.com which you should check out 🙂 .Anyways, I do this because I do need a separate website for my personal blog, and I don’t want to handle two completely separate installs, so a multisite fits my needs. But, for most people, stick to categories and a permalink structure like mine:

/%category%/%postname%/

which allows you to have /blogging and /wordpress without the hassle of handling 1 and a half sites(what I think handling a two-site wordpress install is).

Source: HalfElf.org

The post WordPress multisites appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/wordpress-multisites/feed/ 0 3180
Why do people buy Windows(OS)? https://www.nerdoflinux.com/tech/why-do-people-buy-windowsos/ https://www.nerdoflinux.com/tech/why-do-people-buy-windowsos/#respond Sat, 17 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3171 Windows, in my opinion, is a proprietary piece of garbage that happens to do stuff when you turn on your computer. Reboots On one hand, there’s Linux that can go for months at a time without reboots, or years, if you have live kernel patching, that’s 100% free. And on […]

The post Why do people buy Windows(OS)? appeared first on NerdOfLinux's Tech Blog.

]]>
Windows, in my opinion, is a proprietary piece of garbage that happens to do stuff when you turn on your computer.

Reboots

On one hand, there’s Linux that can go for months at a time without reboots, or years, if you have live kernel patching, that’s 100% free. And on the other, you have Windows, which needs to reboot pretty much every day because it’s RAM usage increases by the second, that costs upwards of $100. So, why do people pay that? I honestly have no idea, there’s free OS’s that are a billion times better than Windows.

Security

I don’t think Microsoft is even trying on this one. Recently, a security flaw was discovered that allows for anyone to instruct Cortana to go to an unsecured site, allowing an attacker to inject their own website instead. From there, the attacker can install malware, even though the device is “locked”. On top of that, getting viruses to run without the user’s knowledge is too easy on Windows, and on top of that, there are more viruses for Windows than say, Linux. But that doesn’t matter, as even if you do download a virus on Linux, unless you manually execute it, you’re pretty much safe.

Privacy

Here’s a big one: privacy. You’re basically paying Microsoft to take all your personal information, and make money off of it. Microsoft collects a bleep load of data about you, which in some cases includes everything you type! Microsoft then sells that data to advertisers or basically anyone that will pay for it. There is no way to completely turn of diagnostics, you can only choose between “standard” or “full”, both of which are terrible. I didn’t even get to Cortana, which can theoretically listen to everything that goes on around you. Sure, Alexa and Siri can do that to, but I trust Amazon and Apple more than Microsoft.

Crashes

I can not even count how many times computers have frozen for teachers and students at my school. After you boot Windows, you have to wait for about fifteen minutes before you can use it, and then it’ll probably just crash if you manage to open a web browser. Windows is terrible, and I have no idea why people pay for it.

The post Why do people buy Windows(OS)? appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/why-do-people-buy-windowsos/feed/ 0 3171
How to use 2 factor authentication with SSH https://www.nerdoflinux.com/tech/linux-tutorials/use-2-factor-authentication-ssh/ https://www.nerdoflinux.com/tech/linux-tutorials/use-2-factor-authentication-ssh/#respond Thu, 15 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3164 I think I already wrote a post about this, but this post is about how to use a proper two factor method, not just a shell script. Install While I recommend you check out the full tutorial from the sources link at the bottom of this post, here’s the summary: […]

The post How to use 2 factor authentication with SSH appeared first on NerdOfLinux's Tech Blog.

]]>
I think I already wrote a post about this, but this post is about how to use a proper two factor method, not just a shell script.

Install

While I recommend you check out the full tutorial from the sources link at the bottom of this post, here’s the summary:

sudo apt install libpam-google-authenticator
google-authenticator

and answer the questions. Next, edit a file with

sudo nano /etc/ssh/sshd_config

and change/add

ChallengeResponseAuthentication yes
UsePAM yes
AuthenticationMethods publickey,password publickey,keyboard-interactive

edit another file

sudo nano /etc/pam.d/sshd

and comment out

@include common-auth

and at the bottom, add:

auth required pam_google_authenticator.so nullok

and restart SSH with:

sudo service ssh restart

Allowing password authentication

Now, you have two factor with public keys, but what about passwords? Well, you just disabled passwords from disabling the pam module for that, so here’s my workaround:

Add a user called backup:

sudo adduser backup --disabled-password

Now, add the following to the bottom of /etc/ssh/sshd_config:

Match User backup
    AuthenticationMethods publickey keyboard-interactive
    ForceCommand sudo login

Run sudo visudo, and at the bottom, add the line:

backup ALL=(ALL:ALL) NOPASSWD:/bin/login

Now, copy your .google_authenticator file to /home/backup. Now, when you want to log in with a password, simply ssh into the backup user, and you’ll get the system login prompt. Here, enter the username and password of your normal user, and you’re in! This still uses two-factor, and will in fact ask for your TOTP key before allowing you to login with your username and password.

Whitelisting IPs

To the bottom of /etc/pam.d/sshd right before the

auth required pam_google_authenticator.so nullok

line, add

auth [success=done default=ignore] pam_access.so accessfile=/etc/security/access-local.conf

Now, in /etc/security/access-local.conf, add/edit:

#localhost doesn't need two step verification
+ : ALL : IP here
+ : ALL : LOCAL
#All other hosts need two step verification
- : ALL : ALL

This part is from the stack exchange link at the bottom of the post

Sources: DigitalOcean | Unix Stack Exchange

The post How to use 2 factor authentication with SSH appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/use-2-factor-authentication-ssh/feed/ 0 3164
My adventures with NextCloud https://www.nerdoflinux.com/tech/linux-tutorials/my-adventures-with-nextcloud/ https://www.nerdoflinux.com/tech/linux-tutorials/my-adventures-with-nextcloud/#respond Tue, 13 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3149 For about a month now, I’ve had my own cloud server, which runs on NextCloud, a nice open source cloud solution that’s based on ownCloud. Installation Well, installing it is actually not that bad, aside from the fact that 90% of the time, the browser and server give up becuase […]

The post My adventures with NextCloud appeared first on NerdOfLinux's Tech Blog.

]]>
For about a month now, I’ve had my own cloud server, which runs on NextCloud, a nice open source cloud solution that’s based on ownCloud.

Installation

Well, installing it is actually not that bad, aside from the fact that 90% of the time, the browser and server give up becuase of a timeout. However, it does still get installed, and reloading the page gets you to a working installation. All you need to do is to get the zip file, and decompress it into your webroot, and go through the installer.

Reverse-proxy

Even with the cheapest of VPS providers, getting terabytes of SSD or HDD will cost you. So, my way around this is to set up NextCloud on my Raspberry Pi, which is connected to 2TB of external HDD space(two 2TB drives in RAID 1). Then, I use my web server(still switching between Apache and NGINX every five minutes), to forward all requests over to my Raspberry Pi, via my VPN. This way, I don’t need port forwarding on my router, and it also means no DNS record points to my house’s IP address.

Using it

They have a free iOS and Android app that allows for automatic photos syncing(on iOS at least), which is a nice feature. Each time I open the app, it puts all new photos and videos on my cloud, which is cheaper than iCloud, because I had the 2TB drives anyways, so it’s basically free storage. Even without the app, the Web UI is amazing, and even works on mobile. I haven’t managed to set up Collabora, so I can’t fully replace Google Drive, but if you do manage, this could be a full Google Drive replacement!

Encryption

NextCloud has support for file encryption, and end-to-end encryption is currently in beta. I opted to not use NextCloud’s encryption, because my hard drives are encrypted, and I access NextCloud with either HTTPS, or via HTTP within my VPN, which is also encrypted. The only problem I ran into is CloudFlare’s 100MB upload limit, so I just created a DNS record that point to the internal VPN address of my raspberry pi to bypass that.

The post My adventures with NextCloud appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/my-adventures-with-nextcloud/feed/ 0 3149
Come on, ChromeOS https://www.nerdoflinux.com/tech/linux-tutorials/come-on-chromeos/ https://www.nerdoflinux.com/tech/linux-tutorials/come-on-chromeos/#respond Sun, 11 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3139 I recently re-installed Chrome OS on my chromebook, and here are some things that I think Google needs to fix. OpenVPN By far, the most annoying thing about Chrome OS is the lack of a decent OpenVPN client. The built in one can only work on UDP 1194, and you […]

The post Come on, ChromeOS appeared first on NerdOfLinux's Tech Blog.

]]>
I recently re-installed Chrome OS on my chromebook, and here are some things that I think Google needs to fix.

OpenVPN

By far, the most annoying thing about Chrome OS is the lack of a decent OpenVPN client. The built in one can only work on UDP 1194, and you can’t use your standard .ovpn profile to connect with. Even when you go via the android app, it runs in the background, but ChromeOS is so locked down that no traffic goes through it! The only way to have OpenVPN on a chromebook is to install an OS via crouton, and use a real OpenVPN client through there, and then all Chrome OS traffic will go through it.

Alternative: The only viable alternative is SSH tunneling. You can get this configured on TCP 443, so it will still bypass most firewalls, but still, OpenVPN is nicer and easier to use.

Python

I mean, seriously, this should not require developer mode at all. The Chrome OS shell should have python built-in to let people write scripts. If not without developer mode, fine, but even with developer mode on, you have to install python via chromebrew. I get that Chrome OS is designed for ease of use, but 99% of people that enable developer mode do so because they are power users. And what do power users want? Programming languages. Python is one of the most used, so it makes sense to have it in developer mode, at least.

Alternative: SSH into a server that has python

C and make

Come on, Chrome OS in developer mode should have a C compiler. Once you get a C compiler, you can compile your way to anything, but there isn’t one. You once again have to use chromebrew. Oh, and even more ridiculous: even after you get a C compiler, you can’t build anything, because 90% of the directories are read only. Again, this is a secuirty mechanism, but there should be an easy way to disable it for users who decided to go into developer mode!!!

Anyways, leave what you want in Chrome OS in the comments, and hopefully that will be added one day 🙂

The post Come on, ChromeOS appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/come-on-chromeos/feed/ 0 3139
How to only allow CloudFlare access to port 443 and/or 80 https://www.nerdoflinux.com/tech/linux-tutorials/allow-cloudflare-access-port-443-80/ https://www.nerdoflinux.com/tech/linux-tutorials/allow-cloudflare-access-port-443-80/#respond Fri, 09 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3134 If you’re like me and use CloudFlare, you might want to make sure only CloudFlare can access your webserver ports. Doing that will make it substantially harder to DDoS your system, even if the IP address is compromised. Sure, you could drop packets with NGINX or Apache, but the best […]

The post How to only allow CloudFlare access to port 443 and/or 80 appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re like me and use CloudFlare, you might want to make sure only CloudFlare can access your webserver ports. Doing that will make it substantially harder to DDoS your system, even if the IP address is compromised. Sure, you could drop packets with NGINX or Apache, but the best performance will be by blocking them at the iptables level(aside from blocking them before they hit your server).

How?

Well, I found a script over at rietta.com that gets the list from CloudFlare, and uses iptables to apply them. I made a modified version that makes it easier to have BOTH ipv6 and ipv4 rules. Here’s the script:

#!/bin/bash
if [ $(whoami) != "root" ]
then
    echo "Please run as root"
    exit
fi
type="4"
for i in `curl -s https://www.cloudflare.com/ips-v$type`
do
    if [ $type = "6" ]
    then
        iptables="ip6tables"
    else
        iptables="iptables"
    fi
        $iptables -I INPUT -p tcp -s $i --dport 80 -j ACCEPT
    $iptables -I INPUT -p tcp -s $i --dport 443 -j ACCEPT
done

just copy and paste, and you should be able to run it with

bash yourfilenamehere.sh

then, change the line

type="4"

to

type="6"

and run it again to apply to ip6tables. You probably should run this after:

iptables -A INPUT -p tcp --dport 80 -j DROP
iptables -A INPUT -p tcp --dport 443 -j DROP

to drop all packets not from CloudFlare.

How effective is this?

Well, nothing can block DDoS attacks completely, but this should be close enough. When I DoS my VPS from another VPS, the CPU usually doesn’t jump up that much when packets are blocked by iptables, but when blocked via NGINX, the CPU load skyrockets. So, you should be good against small-ish attacks, but don’t expect to stay up during a 500 Gbps attack. One more thing to note is when blocked via iptables, bandwidth is still being used up, so if the attack is larger than what your internet connection can handle, your CPU usage will stay low, but your site will still be slow, if not completely offline.

Well, I hope this post helped someone, and leave a comment with your DDoS mitigation techniques 🙂

The post How to only allow CloudFlare access to port 443 and/or 80 appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/allow-cloudflare-access-port-443-80/feed/ 0 3134
Linux uptime https://www.nerdoflinux.com/tech/linux-tutorials/linux-uptime/ https://www.nerdoflinux.com/tech/linux-tutorials/linux-uptime/#respond Wed, 07 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3101 If you read this blog, you’ll know I love Linux, and believe that is is far superior to the Windows kernel. Well, here’s one more reason why Linux is a billion times better than its competition. Uptime is insane with Linux I mean seriously, if you think its impressive that […]

The post Linux uptime appeared first on NerdOfLinux's Tech Blog.

]]>
If you read this blog, you’ll know I love Linux, and believe that is is far superior to the Windows kernel.

Well, here’s one more reason why Linux is a billion times better than its competition.

Uptime is insane with Linux

I mean seriously, if you think its impressive that Windows can go 15 minutes without a reboot, check out Linux. Ubuntu server can go for months without a reboot, as you only need to reboot whenever a new kernel was released. Even updating core parts of the OS do not require a reboot, and the less you reboot, the less servers you need to achieve 100% uptime. Rebooting every few months is great, but you can further increase how long Linux can run by utilizing live kernel patching. Live kernel patching means that even kernel updates do not require a reboot, which means with tools like canonical livepatch, you can run your server for years at a time without rebooting, or sacrificing any important kernel patches.

Why you should care

If you’re like me, and use your VPS to run websites and VPNs, or a mail server, you know how important uptime is. If you’re server is down, you lose visitors, which is obviously a bad thing. Sure, you can have multiple servers and a load balancer, and then reboot your servers one at a time. And that will work, but nobody has the time to do that, especially when you need to it once a month. Linux requires you to do that process just once every few years, and even when you do, reboots are fast. My server, after shutting down, can accept SSH connections in about 10 seconds, and that’s on a low end VPS. If you’re using SSDs in a RAID array, you could probably get near-instant reboots. So even without live kernel patching, Linux still has less reboots.

The post Linux uptime appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/linux-uptime/feed/ 0 3101
I cracked the code to sending MMS to T-Mobile phones! https://www.nerdoflinux.com/tech/linux-tutorials/cracked-code-sending-mms-t-mobile-phones/ https://www.nerdoflinux.com/tech/linux-tutorials/cracked-code-sending-mms-t-mobile-phones/#respond Mon, 05 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3095 You have no idea how much time I spent trying to figure this out. Why I did this T-Mobile has a service that lets you send emails to yourphonenumber@tmomail.net and it will arrive on your phone as an SMS. The problem is that their processing causing the messages to arrive […]

The post I cracked the code to sending MMS to T-Mobile phones! appeared first on NerdOfLinux's Tech Blog.

]]>
You have no idea how much time I spent trying to figure this out.

Why I did this

T-Mobile has a service that lets you send emails to yourphonenumber@tmomail.net and it will arrive on your phone as an SMS. The problem is that their processing causing the messages to arrive from a new shortcode each time, even if the emails are from the same sender. This caused me problems, because I configured my server to text me whenever there is an SSH login, and having a hundred different phone numbers I have to clear every day is too much work. So, I did a bit of experimenting, and I finally managed to create a template that causes T-Mobile to send it as an MMS, which means your phone’s messaging app will see the email address, and group the text messages together.

How?

Now that you’re bored and probably close to closing this post, I’ll give you the bash script I use:

if [ -z $1 ] || [ -z $2 ]
then
    echo "Use: mms.sh subject body"
fi
cat <<EOF |
Mime-Version: 1.0
From: admin@example.com
Subject: $1
To: yourphonenumber@tmomail.net
Content-Type: multipart/alternative;
 boundary="--=multi"

----=multi
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
$2
----=multi
EOF
sendmail -t

To create a script with this, all you need is to copy and paste it into a file, and change the from and to headers. Then, just run the script with

bash mms.sh "subject goes here" "message goes here"

and within a few seconds, a message should be sent to your phone.

How I found this?

T-Mobile support gave me this link, which said that I should just be able to set is as an HTML email. The problem is that then, the message was sent as an attachment, which was really annoying. I eventually figured out that messages sent from rainloop webmail worked just fine, and the script is a slimmed down version of all the headers.

Why not just email?

Because MMS works even without an internet connection, and for some reason, I can’t get LTE in my school, but messages and calling goes through just fine. So, now I get notified even when I’m in my school 🙂

The post I cracked the code to sending MMS to T-Mobile phones! appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/cracked-code-sending-mms-t-mobile-phones/feed/ 0 3095
PHP built-in web server! https://www.nerdoflinux.com/tech/linux-tutorials/php-built-web-server/ https://www.nerdoflinux.com/tech/linux-tutorials/php-built-web-server/#respond Sat, 03 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3084 If you’re like me, and like to develop with PHP, but want to use a REAL IDE, and not nano, emacs, vi, vim, tim(not a real editor, but it rhymes) , etc? Well, PHP has a built-in web server, so you don’t even need to install apache(or NGINX)! Installation If […]

The post PHP built-in web server! appeared first on NerdOfLinux's Tech Blog.

]]>
If you’re like me, and like to develop with PHP, but want to use a REAL IDE, and not nano, emacs, vi, vim, tim(not a real editor, but it rhymes) , etc? Well, PHP has a built-in web server, so you don’t even need to install apache(or NGINX)!

Installation

If you’re on Linux, which you should be if you’re developing 🙂 , then simply run:

sudo apt install php

or use pacman or whatever your favorite package manager is. Then, create a file called index.php with the following:

<?php
phpinfo();
?>

and run

php -S localhost:8080

you now have a running web server which you can access by going to http://localhost:8080 in a browser!

What about PHP plugins?

What if you want to use PHP with sqlite, or mysql, or something else? Easy, just run something like:

sudo apt install php-sqlite

and restart your PHP server, and you now have whatever plugin you installed!!!

What about LAMP?

If you have a powerful enough computer, and want to have a full LAMP stack to see how it would run on a real server, then simply install it the same way your would on a server:

sudo apt install apache2 libapache2-mod-php mariadb-server mariadb-client

or use actual MySQL, whatever you want. Now, for something like local development, mod-php with mpm_prefork will be just fine, there is no need to add PHP-FPM, as there will be only one connection at a time(you).

Which one should I use?

If you need just PHP for testing(no rewrite rules, etc.), then the PHP built in web server uses very little resources, and will likely have all you need. However, if you need rewrite rules, or want to test something like a WordPress plugin or theme locally, then the good old LAMP stack will be your best friend. You could use NGINX, but I doubt you’ll notice a difference with only one connection 🙂

The post PHP built-in web server! appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/php-built-web-server/feed/ 0 3084
What WordPress hosting should I get? https://www.nerdoflinux.com/tech/wordpress/wordpress-hosting-get/ https://www.nerdoflinux.com/tech/wordpress/wordpress-hosting-get/#respond Thu, 01 Mar 2018 12:00:37 +0000 https://gateblogs.com/?p=3066 When starting your first blog, deciding on what hosting to get can be a challenge. So, in this post I will try to make this decision easier. Types The two main types of hosting are managed and VPS hosting. Each one has its pros and cons, but in general, when […]

The post What WordPress hosting should I get? appeared first on NerdOfLinux's Tech Blog.

]]>
When starting your first blog, deciding on what hosting to get can be a challenge. So, in this post I will try to make this decision easier.

Types

The two main types of hosting are managed and VPS hosting. Each one has its pros and cons, but in general, when starting, I’d stick with managed. Managed hosting is basically when a company puts a billion websites on one server, and gives each person a limited amount of resources(disk space, bandwidth, etc.). This makes it really affordable, but if one or more sites get a ton of traffic, or a DDoS attack, your site will also go down. The reputable hosting companies likely have defenses against DDoS attacks, and some will move websites that are getting a spike in traffic to another server to increase performance. VPS hosting, on the other hand, gives you more resources. You get your own (virtualized) CPU, RAM, and disk space. This means that one site getting hit with a lot of traffic will only slow that site down, since it’s isolated in a virtual machine.

WordPress.com

Another options is sticking with good old wordpress.com. You could argue that this fits in with managed hosting, but I’d say it’s in between VPS and managed hosting. While they likely don’t put each site in a VPS, I’d say they have the most powerful servers of all managed hosting providers. All websites hosted with them are fast, and I’ve never seen one with an error message. The main limitation is the lack of installing custom plugins and themes, but that feature is added in their $25 a month plan. The most enticing reason is their free plan. You can get started with a subdomain for free, and then later export your data to another provider, or just upgrade to a paid plan with them. All in all, millions of websites run off them, and with good reason.

Which one?

It’s up to you, but I’d suggest starting with the free plan on WordPress.com, then managed hosting, then VPS hosting. But, if managed or VPS hosting ever gets more expensive than $25, just switch to WordPress.com’s business plan. That is, unless you’re like me, and have a VPS anyways, in which case you should just install WordPress yourself.

The post What WordPress hosting should I get? appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/wordpress-hosting-get/feed/ 0 3066
Credit Card 101 https://www.nerdoflinux.com/other/finance/credit-card-101/ https://www.nerdoflinux.com/other/finance/credit-card-101/#respond Tue, 27 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=3036 I haven’t wrote about credit cards for a while, so here’s a summary of everything you should know: Interest Interest will only apply if you: 1.) Take a cash advance(more on that later) 2.) Don’t pay off your full balance Your credit card provider really wants you to pay the […]

The post Credit Card 101 appeared first on NerdOfLinux's Tech Blog.

]]>
I haven’t wrote about credit cards for a while, so here’s a summary of everything you should know:

Interest

Interest will only apply if you:

1.) Take a cash advance(more on that later)

2.) Don’t pay off your full balance

Your credit card provider really wants you to pay the minimum, so they get the maximum interest. Do NOT spend more than you can afford, and use it the same way you’d use a debit card. Also, there is more or less NO good reason to take a cash advance. You get charged interest from the second you get cash, and the APR is even higher than your usual purchase APR, unless you have a Discover card, and get cash from one of the stores they support(in which case, there might be a reason to get a cash advance).

Features

Be sure to know all the benefits your card gives you. Some cards offer purchase protection, return protection, and more. Also, be sure to look for a card with the best annual fee to cash back ratio. However, unless you’re a heavy spender, you’re generally better off with a no annual fee card, such as the Citi Double Cash back, 2% cash back with an annual fee of $0. Discover cards also have no annual fee, and have 1% on everything, with 5% in rotating categories, and a bunch of other features.

Network

This is the little logo that’s probably on your card. The main four in the U.S. are Visa, Mastercard, American Express, and Discover. From my research, here is the order of acceptance:

1.) Visa

2.) Mastercard

3.) Discover

4.) American Express

You can guess who charges the most merchant fees 🙂 (it’s Amex for those of you that didn’t know). Anyways, American Express does have a bunch of good cards, so I recommend you always have a Visa or Mastercard with you, on top of a Discover/American Express.

Don’t just use one card

Use two or more, preferably, a Discover It, and a Citi Double Cash back. Use the Citi card on everything that is not a rotating category for Discover, and you get 2% on everything and 5% on rotating categories, with no annual fee! Also, the more cards you have, generally, the higher your credit limit, so the lower your utilization will be, which will raise you credit score. Nothing beats paying off your card every month and having 0% utilization though.

Note: Please use more than one source before getting your first credit card. This is just a short post of what I think is important.

Always pay off your card!!!

The post Credit Card 101 appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/other/finance/credit-card-101/feed/ 0 3036
How to set up an OpenVPN server https://www.nerdoflinux.com/tech/internet/set-openvpn-server/ https://www.nerdoflinux.com/tech/internet/set-openvpn-server/#respond Sun, 25 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=3011 Creating your own VPN server is a cheap and now easy way to ensure your privacy. What is a VPN? Well, a VPN stands for Virtual Private Network, and it basically encrypts all the data between you and a server. This means that all internet traffic appears to be coming from the server’s […]

The post How to set up an OpenVPN server appeared first on NerdOfLinux's Tech Blog.

]]>
Creating your own VPN server is a cheap and now easy way to ensure your privacy.

What is a VPN?

Well, a VPN stands for Virtual Private Network, and it basically encrypts all the data between you and a server. This means that all internet traffic appears to be coming from the server’s IP address, and that hackers can’t intercept your connection, as it’s securely encrypted. OpenVPN is among the most popular and secure VPN servers out there. The problem? It’s nearly impossible to configure properly. So, that’s why I improved upon a script to give you the easiest way possible!

How?

Glad you asked!

First, download the script, and run it with:

curl -O https://raw.githubusercontent.com/NerdOfLinux/Scripts/master/OpenVPN.sh
sudo bash OpenVPN.sh

If it doesn’t find the server config file, it will assume OpenVPN is not installed, and begin the process of configuring it.

Follow these instructions:

First I need to know the IPv4 address of the network interface you want OpenVPN
listening to.
IP address: 

If this is correct, then just press enter, if not, correct it, and then press enter 🙂

Now,

What port do you want for OpenVPN?
Port: 1194

this is the default, but change it to 443 if you want to bypass firewalls.

Do you want tcp or udp?
Type: udp

UDP performs a bit better, but if you want to have your VPN work from behind 99% of firewalls, choose TCP, assuming you selected 443 for the port.

What DNS do you want to use with the VPN?
   1) Current system resolvers
   2) OpenDNS
   3) Level 3
   4) NTT
   5) Hurricane Electric
   6) Google
DNS [1-6]: 1

I use OpenDNS, but you can choose any of the options, and it should work.

Finally, tell me your name for the client cert
Please, use one word only, no special characters
Client name: client

Replace client with whatever you want the profile name to be.

What rsa key size would you want (2048 in the minimum recommended)?
Size: 2048

I’m paranoid, so I choose 4096, but 2048 is more than enough at the time of writing.

Which cipher would you like?
   1) AES
   2) CAMELLIA(may cause problems)
   3) Custom(not recommended)
Cipher: 1

Only change this if you believe the NSA can crack AES.

Which AES size would you like?
   1) 128
   2) 192
   3) 256
Encryption: 1

Up to you, but I like 256 bit.

How often would you like to renegotiate the keys?(if you're unsure, just press enter)
reneg-secs: 3600

Just leave this how it is, unless you’re paranoid, and want to change keys even faster

What SHA size do you want(256,384,512)?
SHA: 256

512 is the most secure, but 256 should be fine, not to mention that it’s a bit faster.

Okay, that was all I needed. We are ready to setup your OpenVPN server now
Press any key to continue...

Press any key, and it will more or less do everything for you! Once it’s done, you’ll have a .ovpn profile ready to go in your root’s home directory. Email this to your client, and you’re good. If you don’t have a GUI, you can send files with:

mpack -s "OVPN cert" client.ovpn email_address_here

Why not use the original script?

That’s up to you, but my version uses a more updated version of EasyRSA, gives you the option to choose cipher, cipher size, hash size, RSA key size, renegotiation time, and a bit more. There are a ton of other scripts out there too, but be sure to look at the source code before trusting them, you never know where a keylogger installer could be hiding.

The post How to set up an OpenVPN server appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/set-openvpn-server/feed/ 0 3011
Why I switched back to CloudFlare https://www.nerdoflinux.com/tech/internet/switched-back-cloudflare/ https://www.nerdoflinux.com/tech/internet/switched-back-cloudflare/#respond Fri, 23 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=2985 I know I switch things every other day, but I need a post for today, so here it is. DDoS This is the main reason for using CloudFlare for many people, including me. The problem was, I used to point the MX record to my VPS IP, which would expose […]

The post Why I switched back to CloudFlare appeared first on NerdOfLinux's Tech Blog.

]]>
I know I switch things every other day, but I need a post for today, so here it is.

DDoS

This is the main reason for using CloudFlare for many people, including me. The problem was, I used to point the MX record to my VPS IP, which would expose it to potential attackers, so I left CloudFlare because it was too easy to bypass. Now, I configured a separate VPS for email, so I’m safe from DDoS attacks, as there is no way to find my site’s IP address, unless you hack CloudFlare.

Performance

This was one of my reasons for leaving, but CloudFlare seems to have improved since then. My website appears to load faster, and minification doesn’t break any part of my site. Also, if my server goes down, at least a somewhat recent version of the home page can be displayed, instead of just an error. Also, since it’s a CDN, static files such as images are cached throughout their datacenters, so less requests hit my server, which means better performance is achieved, as their servers are way more powerful than mine.

Analytics

CloudFlare analytics are a decent source for checking unique viewers, and some other basic stats, like which countries visit your site the most. While not as in-depth as Google Analytics, it makes it easy to see how many visitors I got in one day. Not to mention the fact that it shows you all of the crawlers that visit your site, which showed me how much Bing sucks. Even Yandex, a search engine you probably never heard of, indexes my site more than Bing!

Security

CloudFlare also has some firewall rules to protect WordPress websites, which means hacking me is that much harder. Also, they’ll hide email addresses from bots to I’ll get less spam. BTW, I actually like getting spam, because it helps me teach my spam filter 🙂

Anyways, leave your favorite CDN in the comments!

The post Why I switched back to CloudFlare appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/internet/switched-back-cloudflare/feed/ 0 2985
W3 Total Cache(fixed) https://www.nerdoflinux.com/tech/wordpress/w3-total-cachefixed/ https://www.nerdoflinux.com/tech/wordpress/w3-total-cachefixed/#respond Wed, 21 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=2974 For a while, I used WP Super cache with NGINX to get the best performance because W3 Total Cache has a bug that breaks the entire nginx.conf file. So, a few people decided to create a new version that fixes those problems faster than the original plugin, which you can […]

The post W3 Total Cache(fixed) appeared first on NerdOfLinux's Tech Blog.

]]>
For a while, I used WP Super cache with NGINX to get the best performance because W3 Total Cache has a bug that breaks the entire nginx.conf file. So, a few people decided to create a new version that fixes those problems faster than the original plugin, which you can find on GitHub.

How to install

Installation is easy and all your settings in the original W3 Total Cache plugin will be kept. All you need to do is clone the plugin into the wp-content/plugins folder, which would look something like:

cd /var/www/html/wp-content/plugins
rm -rf w3-total-cache
git clone https://github.com/szepeviktor/w3-total-cache-fixed
mv w3-total-cache-fixed w3-total-cache

But be sure to disable the plugin before, or just delete it.

Why not WP Super Cache

With this version of the plugin, the answer is integrated NGINX support. With WP Super Cache you have to use a config that is not automatically created, which is fine, but it’s much easier to just add include to your site’s virtual host than it is to copy and paste, and then hope you didn’t break your site. Also, there is much more functionality than WP Super Cache, such as object caching, database caching, minification, and browser caching. Plus, W3 Total Cache’s config will serve cached pages without running PHP, meaning even if your server gets hit with thousands of concurrent views, it will continue to be really fast.

But it’s not official

True, but W3 Total Cache fixed is open source, so you could go through all of its code if you wanted to make sure there aren’t any viruses. Plus, it has more than 45 forks, and 200 stars, at the time of writing(it probably went up by the time this is published). It also seems to me updated more often than the official one, so bugs will likely be fixed faster, as that is the whole point of this version.

Let me know your favorite caching plugin in the comments!

Update: This site is now using WP Super Cache because of its support for the jetpack mobile theme. 🙂 I’m also testing Autoptimize to further improve performance.

Update Update: The official W3 total cache is now fixed and works with NGINX(I had to disable gzip though) 🙂

The post W3 Total Cache(fixed) appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/wordpress/w3-total-cachefixed/feed/ 0 2974
Gallium OS https://www.nerdoflinux.com/tech/linux-tutorials/gallium-os/ https://www.nerdoflinux.com/tech/linux-tutorials/gallium-os/#respond Mon, 19 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=2963 Gallium OS is an Operating System based off Ubuntu designed to run on Chromebook hardware.Unlike crouton, it can overwrite Chrome OS, or dual boot. First Impressions My first impressions of Gallium OS were amazing. After configuring your chromebook, all you need to do is boot from a Gallium OS flash […]

The post Gallium OS appeared first on NerdOfLinux's Tech Blog.

]]>
Gallium OS is an Operating System based off Ubuntu designed to run on Chromebook hardware.Unlike crouton, it can overwrite Chrome OS, or dual boot.

First Impressions

My first impressions of Gallium OS were amazing. After configuring your chromebook, all you need to do is boot from a Gallium OS flash drive, and you’re done. The install was easy, and the live desktop is a great way to test it out before installing. As promised, all the hardware, down to the brightness buttons on the keyboard, worked fine. It did come with chromium installed, which I replaced with Google Chrome, and that actually ended up using less disk space.

Why?

You’re probably wondering why anyone would ever replace Chrome OS. Well, I did it to get more out of it. I can know work on my C and Python programs without needing an internet connection. I can even mess around with Swift if I wanted to, which I couldn’t do before. Also, you get full control over everything about the OS. If you want to change Desktop Environments you can, although I wouldn’t recommend it. Also, the OpenVPN client you can install on Gallium OS is far superior to the built in ChromeOS one, as I can use port 443, which Chrome OS OpenVPN doesn’t support.

What if I want to go back?

If you like Gallium OS, install it, and end up not liking it, then all you need to do is create a Chrome OS recovery flash drive, which there are many tutorials on how to do. Switching back isn’t that hard, but if you think you’ll still use Chrome OS, then dual boot instead of overwriting.

Why not crouton?

Crouton is great if you want Chrome OS, and mess around with another Linux distro every now and then. But, if you want to have full control over everything, then Gallium OS will be the best solution for you.

The post Gallium OS appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/gallium-os/feed/ 0 2963
How to install Linuxbrew! https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-linuxbrew/ https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-linuxbrew/#respond Sat, 17 Feb 2018 12:00:37 +0000 https://gateblogs.com/?p=2956 Linuxbrew is a cool little program that will compile programs from scratch, ensuring you have the latest version. The install can be a little tricky, so I created a script for it. Download the script git clone https://github.com/NerdOfLinux/Scripts.git cd Scripts bash setup.sh cd Linuxbrew And you’re already done with the […]

The post How to install Linuxbrew! appeared first on NerdOfLinux's Tech Blog.

]]>
Linuxbrew is a cool little program that will compile programs from scratch, ensuring you have the latest version. The install can be a little tricky, so I created a script for it.

Download the script

git clone https://github.com/NerdOfLinux/Scripts.git
cd Scripts
bash setup.sh
cd Linuxbrew

And you’re already done with the hardest part!

Installing Linuxbrew

Just run:

bash install.sh

and follow the rest of this tutorial.

Would you like to install linuxbrew?
y)es or n)o?: 

Obviously, you press ‘y’ and enter here.
Note: If it tells you run the setup, do that, and the script should continue.

==> Select the Linuxbrew installation directory
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /home/admin/.linuxbrew
- Press Control-C to cancel installation

This is up to you. If you want the programs you install to be accessible for all users, enter your password. Otherwise, if you don’t have sudo, press Control-D. I’ll enter my password.

==> This script will install:
/home/linuxbrew/.linuxbrew/bin/brew
/home/linuxbrew/.linuxbrew/share/doc/homebrew
/home/linuxbrew/.linuxbrew/share/man/man1/brew.1
/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
/home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
/home/admin/.cache/Homebrew/
/home/linuxbrew/.linuxbrew/Homebrew
==> The following new directories will be created:
/home/linuxbrew/.linuxbrew/Cellar
/home/linuxbrew/.linuxbrew/Homebrew
/home/linuxbrew/.linuxbrew/bin
/home/linuxbrew/.linuxbrew/etc
/home/linuxbrew/.linuxbrew/include
/home/linuxbrew/.linuxbrew/lib
/home/linuxbrew/.linuxbrew/opt
/home/linuxbrew/.linuxbrew/sbin
/home/linuxbrew/.linuxbrew/share
/home/linuxbrew/.linuxbrew/share/zsh
/home/linuxbrew/.linuxbrew/share/zsh/site-functions
/home/linuxbrew/.linuxbrew/var

Press RETURN to continue or any other key to abort

Press the ‘enter’ key, and let’s move on! Give it a bit to download and install everything it needs, and then continue.

Useless header(for SEO)

Once you see

Finishing required steps...
Linuxbrew is now installed.
Fixing any issues...

that means that the install has finished, and my script is running brew doctor.

Your system is ready to brew.
Would you like to test linuxbrew?
 y)es or n)o?: 

If you have the time, type ‘y’ and enter. This will install a test program and see if everything went well.

Linuxbrew is functioning properly.

This means that install went through.

Would you like to disable linuxbrew analytics?
 y)es or n)o?: 

I like disabling them, but if you don’t care, please leave it on.

Done

The install is now complete, and you can now use Linuxbrew by running the

brew

command!

The post How to install Linuxbrew! appeared first on NerdOfLinux's Tech Blog.

]]>
https://www.nerdoflinux.com/tech/linux-tutorials/how-to-install-linuxbrew/feed/ 0 2956