Viet's Blog

Install RabbitMQ on Ubuntu 16.04 LTS

  • Jun 4, 2017
  • POST
Enable RabbitMQ application repository: echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list Add the verification key for the package: curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add - Update the sources with our new addition from above: apt-get update And finally, download and install RabbitMQ: sudo apt-get install rabbitmq-server In order to manage the maximum amount of connections upon launch, open up and edit the following configuration file using nano and uncomment the line ulimit:

Install Golang on Ubuntu 16.04 LTS

  • Jun 4, 2017
  • POST
To install Golang on Ubuntu you will need to add a PPA repo: sudo add-apt-repository ppa:longsleep/golang-backports sudo apt-get update sudo apt-get install golang-go It does not give you the latest minor version but tends to give to the latest major version. Golang 1.8.3 is released and as of today I still get 1.8.1 via this PPA repo.

Securely Publish Hugo via rsync

  • Jun 4, 2017
  • POST
Steps 1. Install rssh Install rssh to limit shell activity for users using the shell rssh: sudo apt-get install rssh Now edit the config file /etc/rssh.conf to allow scp and rsync: allowscp allowrsync #allowsftp #allowcvs #allowrdist #allowsvnserve NOTE: Since you are going through SSH, you don’t need to enable firewall rule for rsync. # DO NOT RUN this: sudo ufw allow rsync # You can safely run this: $ sudo ufw delete allow rsync 2.

How to Install a Git Repo & Serve via SSH

  • Jun 4, 2017
  • POST
Love Git but don’t want to pay GitHub to have a private repo? No problem. Here’s the solution. I was looking for a way to create a repo and serve it on my server via ssh. Git made it really simple and we can do in 3 steps (copied from the Reference 1): Steps 1. Create a repo # On the server side mkdir ~/repos/ cd ~/repos/ GIT_DIR=project.git git init cd project.

Listing all header files your cpp depends on

  • Jun 3, 2017
  • POST
I needed to extract certain Boost headers from its huge code base for memory mapped file & shared memory containers. The first idea came to my mind was a simple grep command for #include statements and then parse the paths. This is simple but not so useful for the cases when headers are conditionally included. For example: #ifndef NO_STL #include "my_class_no_stl.h" #else #include "my_class_stl.h" #endif To be honest, grep won’t be able to handle it.

Got Locked Out From Gitolite

  • May 1, 2017
  • POST
A couple of years ago I installed gitolite to self-host Git and access it via SSH. All was well until recently I discovered a problem: I could not access some repositories: $ git clone git@simpleit.us:apache2-config.git Cloning into 'apache2-config'... R access for apache2-config DENIED to gitadmin (Or there may be no repository at the given path. Did you spell it correctly?) fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

Add Extra Entropy for Ubuntu and Debian

  • May 1, 2017
  • POST
Recently I ran gpg --gen-key and had problems with lack of randomness (entropy). If you are running a virtual server and have little traffic coming your way, you will not have enough entropy for security/cryptographic applications. To address this problem, you could use rng-tools and Haveged packages. This tutorial will show how to add more entropy for Ubuntu/Debian. You can do the same for other Linux distros. Guide rng-tools Install rng-tools:

Secure GitHub Pages

  • May 1, 2017
  • POST
Nowadays getting HTTPS is no longer expensive. GitHub provides free HTTPS for your GitHub pages and you can choose to enable in the Settings for each of your repository: The benefits of this is multi-fold: Better security for your readers Better SEO for your pages Styles will not degrade because when loading from HTTPS, no insecure HTTP styles and scripts are allowed. You can however load scripts and styles served via HTTPS on your HTTP pages If you are using a blogging engine like Hugo, remember to change our baseURL to HTTPS or your readers will moan and groan about ugly face of your page without make ups from CSS & Javascript:

PySmile: Transparency Preservation

  • May 1, 2017
  • POST
I have been writing PySmile - a tool for batch processing (resize, convert) images. Resizing by ratio, to fixed width, fixed height was easy-peasy. So was conversion from non-transparent formats to any format (from JPG, BMP to JPG, BMP, PDF, PNG, GIF). However, there was a challenge converting transparent PNG to other formats: JPG, BMP, GIF, PDF. Have a look at the output: There are 2 problems with the output:

PySmile: Handy Image Processing

  • May 1, 2017
  • POST
If you are an active blogger or creating lots marketing material, you probably use a huge number of images and photos to keep your audience engaged. If you share on Facebook and Twitter, you may want to have suitable thumbnails. It’s a hell lot of work to have so many images and their derivatives. Some common tasks: Create a derivative image for Facebook post of size 281x394, 470x235, 470x246, … Generate an image for Twitter post of size 600x335, 800x320, … Create round, square thumbnails, … Generate images for Facebook Open Graph and Twitter Card Without simple and effective tools, you won’t be able to accomplish those tasks efficiently.
Prev Next
LATESTS
Make Grub Font Size Bigger
  • Sep 22, 2019
  • POST
Endianness Agnostic ntoh
  • Jun 22, 2019
  • POST
Upcoming Posts
  • Jun 15, 2019
  • POST
Taming Elementary OS
  • May 11, 2019
  • POST
Fix Wifi for Ubuntu on Microsoft Surface
  • May 11, 2019
  • POST
Endianness Detection the Hard Way
  • Jun 17, 2018
  • POST
OCaml Packaging With Topkg and OPAM
  • May 28, 2018
  • POST
Safer C++ By Handling Function Result
  • May 12, 2018
  • POST
P2P Browsing Web With Beaker and Dat
  • Mar 31, 2018
  • POST
Edit and Annotate PDF
  • Mar 30, 2018
  • POST
CATEGORIES
TAGS
  • dev
  • tips
  • ubuntu
  • hugo
  • blog
  • c++
  • config
  • git
  • security
  • social-media

© Viet's Blog

Powered by Hugo.

Robust designed by Daisuke Tsuji.