These command lines show you how to get your current public IP address just from terminal, just follow one of these way to get yours:
$ curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
Or, the shorter one:
$ curl ipinfo.io/ip
After holiday, I have many pictures that needs to be uploaded and all of them should have watermark. Watermark in image is one thing that I could’ve done it with photoshop when I was in school. But I’m not gonna waste my time to do that one by one instead I’m doing with this simple python script. The library that I used was PIL (Python Image Library).
This one I’ve done with custom font so you can choose your favorite font in your images. This script will be run two jobs to edit every images you have in one directory. The first thing it gonna resize your image based on what I already defined inside the script, you might want to change the basewidth variable if you want and after resizing, the script will put the watermark at the corner of your image.
For the font, I was just searching for the free license in dafont.com
Make sure you download the .ttf extension, not sure whether the other extensions will work.
from PIL import Image, ImageDraw, ImageFont
image = Image.open('IMG_0495.JPG')
width, height = image.size
basewidth = 800
wpercent = (basewidth / float(image.size))
hsize = int((float(image.size) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
image = Image.open('TES.JPG')
width, height = image.size
draw = ImageDraw.Draw(image)
text = "Your credit written here"
font = ImageFont.truetype('Downloads/Capture_it.ttf', 15)
textwidth, textheight = draw.textsize(text, font)
# calculate the x,y coordinates of the text
margin = 5
x = width - textwidth - margin
y = height - textheight - margin
# draw watermark in the bottom right corner
draw.text((x, y), text)
Missing mbstring library for php in Centos 6.9, solution:
$ yum install php-mbstring
Sometimes it sucks when you listen to music on youtube with very limited sound level after your volume level has reached maximum and you’re using piece of shit earphone. Just go with this command to extend the limitation sound level, it works on ubuntu 14.04:
$ pactl -- set-sink-volume 0 150%
be careful with maximum sounds, can be dangerous for your ears.
To connect host with specific key
$ ssh user@host -i mykey.pem
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'YoUrP45sw0rd!' WITH GRANT OPTION;
Don’t forget to flush the privileges
If user still cannot see the tables, try to disconnect mysql and reconnect again.
Solution: replace utf8mb4 to utf8 in your .sql file
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
pydoc is a python library to make your console output paginates for easier reading. to use it follow the simple example below:
text = "...paginate me..."
pager = pydoc.ttypager(text)
you will see the output is gonna be truncated at the beginning when you start to see like when you open up a man page, then you have to scroll down with keyboard to read the rest of the text line by line. pretty cool!
Put this code inside Vagrantfile before the last end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
ansible.limit = "all"
ansible.verbose = "vv"
ansible.raw_arguments = [